gcov can't collect data when process is executed by systemctl start but it can when executed by ./process

Xi Ruoyao ryxi@stu.xidian.edu.cn
Tue Aug 1 05:51:00 GMT 2017


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.
-- 
Xi Ruoyao <ryxi@stu.xidian.edu.cn>
School of Aerospace Science and Technology, Xidian University



More information about the Gcc-help mailing list