[Bug gcov-profile/78783] gcov-tool fails in gcov_read_counter_mem
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Apr 13 14:15:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78783
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Opera Wang from comment #2)
> We have similar issues in our environment, and I found two situations can
> trigger it.
>
> 1. When profile2 have more files than profile1, which is fixed in bug 67097
Great.
>
> 2. When nftw has issues and can't remove all gcda files in output dir.
Well, it can happen when unlink_profile_dir does not have nftw:
static int
unlink_profile_dir (const char *path ATTRIBUTE_UNUSED)
{
#if HAVE_FTW_H
return nftw(path, unlink_gcda_file, 64, FTW_DEPTH | FTW_PHYS);
#else
return -1;
#endif
}
or it can happen that someone copies a gcov file after the function to the
destination
folder (that's ugly).
Anyhow, I've got patch which validates a destination file does not exist.
Can you please test it?
>
> in gcov-tool.c, unlink_profile_dir:
> return nftw(path, unlink_gcda_file, 64, FTW_DEPTH | FTW_PHYS);
>
> then later when call dump_one_gcov:
> tag = gcov_read_unsigned ();
> if (tag) // <= here tag would be valid because some gcda files still
> exist in output dir
>
> nftw is in libc, and on machine1:
> ldd (GNU libc) 2.12, Linux 2.6.32-220.el6.x86_64, RedHat Enterprise Linux 6.2
> nftw can't remove all gcda files, but if I call nftw the 2nd time, then the
> left gcda files will be removed, so it's not a permission issue.
>
> but on machine2:
> ldd (GNU libc) 2.5, Linux 2.6.18-371.9.1.el5 x86_64, RedHat Enterprise Linux
> 5.7
> nftw works without any problems.
>
> We have to workaround the 2nd issue by output to a new dir, instead of reuse
> an existing dir.
More information about the Gcc-bugs
mailing list