This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcov can't collect data when process is executed by systemctl start but it can when executed by ./process
- From: Xi Ruoyao <ryxi at stu dot xidian dot edu dot cn>
- To: Xiaoli Feng <xifeng at redhat dot com>
- Cc: ryxi at stu dot xidian dot edu dot cn, Mason <slash dot tmp at free dot fr>, GCC help <gcc-help at gcc dot gnu dot org>
- Date: Tue, 01 Aug 2017 13:49:31 +0800
- Subject: Re: gcov can't collect data when process is executed by systemctl start but it can when executed by ./process
- Authentication-results: sourceware.org; auth=none
- References: <809232575.31313906.1501491302667.JavaMail.zimbra@redhat.com> <312354067.31314219.1501491465219.JavaMail.zimbra@redhat.com> <90cc5d01-5747-1aad-1006-cbd1c05e876a@free.fr> <1946892081.31324950.1501495541743.JavaMail.zimbra@redhat.com> <1501499082.2281.1.camel@stu.xidian.edu.cn> <1599292270.31614416.1501555874883.JavaMail.zimbra@redhat.com>
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