I don't want to alarm you, but both of my past dogs. Both keeshonds, had the cough you describe and the gagging. Both ended up having cancer. One had pancreatic cancer, he was 9.5 and the other had liver cancer, he was 10.5. Other than the occasional cough and gagging, no other symptoms. Both ate fine, both had normal stools, right up until their tumours ruptured their organs, then all he-- broke loose and they were gone within 24 hours. Might be worth an xray to see if there is anything else going on.