Hi Paul, On Thu, Jan 28, 2021 at 08:25:20PM -0600, Paul A. Clarke wrote: > The subject commit, 3804e937b0e252a7e42632fe6d9f898f1851a49c, causes a > failure in the test suite for the IBM Advance Toolchain. The test in > question uses "perf probe" to set a tracepoint at "main" in a newly built > (with GCC 11) binary of "/bin/ld". With the patch applied, the command > enters an infinte loop, calling libdw1 functions but making no progress. > > The infinite loop can be found in the Linux kernel > tools/perf/utils/probe-finder.c: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/util/probe-finder.c?h=v5.11-rc5#n1190 >
The infinite loop is because off isn't updated to noff before calling continue in the while loop. Moving the last line of the loop off = noff; to the start of the loop should fix that. Why the call to dwarf_offdie fails is unclear. Try printing the error using dwarf_errmsg (-1) when it returns NULL. If you also print out off (in hex) and the filename the dbg was created from you can inspect the file using [eu-]readelf --debug-dump=info to see how the DIEs look at that offset. BTW. Make sure you have elfutils libdw version 0.172 or newer when dealing with DWARF5. Latest elfutils release is 0.182. Cheers, Mark