The function of words that end in -ing can be tough to figure out--that's a given--but here's a way that will hopefully make it easier for you.
First, determine the word's position in the sentence. If it sits in a subject or object position, it's a gerund, a noun:
- I stood there laughing at my cousin.
The word laughing, above, is neither a subject (it doesn't have a verb) nor an object (the verb stood is intransitive by default and the word there is an adverb, not a preposition; that is, prepositions take objects, adverbs never). In short, laughing is not a gerund.
Second, insert the same subject plus a form of the verb BE before the -ing word to see if it is a present participle:
- I stood there. I was laughing at my cousin.
Third, and final test: rephrase the statement with ... as ..., like this:
- I stood there laughing = I laughed as I stood there.
As you can see, the -ing word in question is a present participle, and its function is to modify the subject:
- I laughing at my cousin stood there.
A note on -ing adverbs
I'm trying to think of adverbs that end on -ing, and I just can't think of any. To my knowledge, I don't know of any adverbs that end in -ing, -ingly, yes, but not -ing. If you know of some, let me know. Moreover, if there are -ing adverbs, then they would answer the questions How?, When?, Where?, as in the underlined phrase here:
- She was standing in a laughing position
wherein the entire prepositional phrase in a ... position functions adverbially and word laughing functions adjectivally: it describes the noun position.
Learn more here about present participles:
From Present Participle in English grammar
When two actions occur at the same time, and are done by the same person or thing, we can use a present participle to describe one of them: They went out into the snow. They laughed as they went. They went laughing out into the snow.