https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110827
--- Comment #8 from Michael Duggan <mwd at md5i dot com> ---
Using the better test case, I have determined that the coroutine _is_ being
instrumented with gcov counters. When disassembled, the output contains the
following in the bar() actor function:
Dump of assembler code for function bar(_Z3barv.Frame *):
...
0x00005555555567a3 <+527>: mov 0x5286(%rip),%rax #
0x55555555ba30 <__gcov0._Z3barPZ3barvE13_Z3barv.Frame.actor+112>
0x00005555555567aa <+534>: add $0x1,%rax
0x00005555555567ae <+538>: mov %rax,0x527b(%rip) #
0x55555555ba30 <__gcov0._Z3barPZ3barvE13_Z3barv.Frame.actor+112>
=> 0x00005555555567b5 <+545>: call 0x555555556359 <_Z5emptyv>
0x00005555555567ba <+550>: mov 0x5277(%rip),%rax #
0x55555555ba38 <__gcov0._Z3barPZ3barvE13_Z3barv.Frame.actor+120>
0x00005555555567c1 <+557>: add $0x1,%rax
0x00005555555567c5 <+561>: mov %rax,0x526c(%rip) #
0x55555555ba38 <__gcov0._Z3barPZ3barvE13_Z3barv.Frame.actor+120>
0x00005555555567cc <+568>: call 0x555555556359 <_Z5emptyv>
0x00005555555567d1 <+573>: mov 0x5268(%rip),%rax #
0x55555555ba40 <__gcov0._Z3barPZ3barvE13_Z3barv.Frame.actor+128>
0x00005555555567d8 <+580>: add $0x1,%rax
0x00005555555567dc <+584>: mov %rax,0x525d(%rip) #
0x55555555ba40 <__gcov0._Z3barPZ3barvE13_Z3barv.Frame.actor+128>
0x00005555555567e3 <+591>: call 0x555555556359 <_Z5emptyv>
Therefore, the problem probably lies in either in the mapping from the counters
to the line numbers or in gcov itself, possibly by missing the "actor" version
of bar in favor of the ramp function.
I'll note the following entries in the symbol table, from readelf:
36: 0000000000007aa0 96 OBJECT LOCAL DEFAULT 27 __gcov0._Z3barv
37: 0000000000002594 943 FUNC LOCAL DEFAULT 15
bar(bar()::_Z3barv.Frame*) [clone .actor]
38: 0000000000002943 83 FUNC LOCAL DEFAULT 15
bar(bar()::_Z3barv.Frame*) [clone .destroy]
39: 00000000000079c0 216 OBJECT LOCAL DEFAULT 27
__gcov0._Z3barPZ3barvE13_Z3barv.Frame.actor
40: 00000000000079b0 16 OBJECT LOCAL DEFAULT 27
__gcov0._Z3barPZ3barvE13_Z3barv.Frame.destroy
107: 00000000000023e2 434 FUNC GLOBAL DEFAULT 15 bar()