Dogs do not have true heart attacks in the way people do. However being a pug they can have respiratory distress if they become extremely agitated. Check his gum color during these episodes to make sure it is pink. If it looks pale, white, or purple make him stop and settle down.
The whimpering and barking indicate something is bothering him. If he is also scooting them it is almost certain his anal glands are full and may be impacted. Constipation can also cause discomfort. A wound or trauma to the tail may be the culprit. Dermal parasites like fleas can cause irritation, itching, and lead to strange or self-mutilating behavior.
Have your dog examined by a veterinarian to determine the cause of his discomfort.
The whimpering and barking indicate something is bothering him. If he is also scooting them it is almost certain his anal glands are full and may be impacted. Constipation can also cause discomfort. A wound or trauma to the tail may be the culprit. Dermal parasites like fleas can cause irritation, itching, and lead to strange or self-mutilating behavior.
Have your dog examined by a veterinarian to determine the cause of his discomfort.