----- Original Message ----- > From: "Xi Ruoyao" <ryxi@xxxxxxxxxxxxxxxxx> > To: "Xiaoli Feng" <xifeng@xxxxxxxxxx> > Cc: ryxi@xxxxxxxxxxxxxxxxx, "Mason" <slash.tmp@xxxxxxx>, "GCC help" <gcc-help@xxxxxxxxxxx> > Sent: Tuesday, August 1, 2017 1:49:31 PM > Subject: Re: gcov can't collect data when process is executed by systemctl start but it can when executed by > ./process > > On 2017-07-31 22:51 -0400, Xiaoli Feng wrote: > > Thanks Xi Ruoyao so much. I have a question. Is *.gcda file only created > > when > > process exit? I did a test. Ran the process. Keep it running. Then check if > > *.gcda > > is generated. And it did acturally. So if it is started by systemd. And > > keep running. > > I think it will generate *.gcda. But it doesn't. I check the namespaces of > > two processes. > > They are the same. > > According to man page gcov(1): > > The data in the .gcda files is saved immediately before the program exits. > > And I wrote a simple program looping forever, compiled it with gcc > --coverage. The > generated executable only creates .gcda file when it exits. Yes, you are right. Here what I test can create .gcda before progress exits because the child progress exits. I will try to catch the signal SIGTERM. Thanks a ton for your help. > -- > Xi Ruoyao <ryxi@xxxxxxxxxxxxxxxxx> > School of Aerospace Science and Technology, Xidian University >