https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123891

            Bug ID: 123891
           Summary: Some functions entirely missing from gcov results
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tromey at gcc dot gnu.org
  Target Milestone: ---

I'm using the Fedora 41 system gcc, though this problem
has affected the last few Fedora releases at least.

bapiya. gcc --version
gcc (GCC) 14.3.1 20251022 (Red Hat 14.3.1-4)

I used to regularly run gcov on gdb but now I find the results
are unreliable.  Some functions -- which I am absolutely sure
are being called -- are recorded as having no execution.

I do not have a smaller test case but it is very easy to reproduce
if you have gdb.

Configure like so:

bapiya. ./config.status --version
config.status
configured by ../binutils-gdb/configure, generated by GNU Autoconf 2.69,
  with options "'--disable-binutils' '--disable-gas' '--disable-gold'
'--disable-gprof' '--disable-gprofng' '--disable-ld' '--disable-sim'
'CFLAGS=-fprofile-arcs -ftest-coverage -g -O0' 'CXXFLAGS=-fprofile-arcs
-ftest-coverage -g -O0'"


This configures a relatively minimal gdb.

Then build: "make -j10" or whatever.

Then, run just the rust tests:

cd $build/gdb/testsuite
make site.exp
runtest --directory gdb.rust


After this, examine rust-lang.c:

cd $build/gdb
gcov -m rust-lang.c
less rust-lang.c.gcov

I see many functions marked with "#####".
However I know most of these are called when the Rust tests are
run, and in the past I've debugged gdb to be 100% certain.

E.g.:

        -:   70:static bool
    #####:   71:rust_enum_p (struct type *type)
        -:   72:{
        -:   73:  /* is_dynamic_type will return true if any field has a
dynamic
        -:   74:     attribute -- but we only want to check the top level.  */
    #####:   75:  return TYPE_HAS_VARIANT_PARTS (type);
        -:   76:}

Reply via email to