Taken in part from #4060: Sometimes when stepping into new functions on i386, the frame being stepped from may dissapear during the first instruction of that stack frame. The frame then reappears on subsequent steps. I'll attach the source of a test program and its assembly.
Created attachment 1570 [details] Test program. When instruction stepping into jump(), foo() will dissapear on jump()'s first instruction and then re-appear after more stepping.
Created attachment 1571 [details] gcc -g -S stepper.c
Downstream: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=229424
Problem is that -fasynchronous-unwind-tables is not default on i?86 and so .eh_frame is not present there. .eh_frame is the only unwind information currently supported by libunwind. GDB supports also .debug_frame (generated by -g) and so it handles the case without problem. libunwind supports heuristics for unwinding without .eh_frame in general cases (function bodies) but it fails in the prologue as was reported here. libunwind support for .debug_frame has been discussed at: http://lists.gnu.org/archive/html/libunwind-devel/2007-02/msg00000.html Considering this Bug as a tracker for libunwind based on elfutils unwinding method.
Created attachment 1597 [details] Implementation (v2). Currently it passes the testsuite (tested on x86) with some exceptions below. Performance looks as a bit lower but it was not investigated so far. Code could be cleaned up a bit but some David Mosberger-Tang internal API advices could be helpful.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230903 Bug 230903: FEAT: dwfl_module_addrname() should also return lowpc+highpc results in this current libunwind-using-elfutils testsuite regression: Backtrace does not match on level==7, want "_start+", got "_start" FAILURE: detected 1 errors FAIL: run-ptrace-stepper Backtrace does not match on level==5, want "_start+", got "_start" FAILURE: detected 1 errors Backtrace does not match on level==5, want "_start+", got "_start" FAILURE: detected 1 errors Backtrace does not match on level==5, want "_start+", got "_start" FAILURE: detected 1 errors Backtrace does not match on level==5, want "_start+", got "_start" FAILURE: detected 1 errors XFAIL: run-ptrace-signull
Implementation currently needs for VDSO symbols resolving a kernel workaround https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230850 Bug 230850: [kernel] /proc/PID/mem is not readable implemented to elfutils; needed on kernel-xen-2.6.19-1.2898.2.3.fc7.i686. Some unlisted libunwind-using-elfutils testsuite regressions apply otherwise.
Implementation currently recommends to rather use an elfutils bugfix https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230793 Bug 230793: File descriptors leakage Some unlisted libunwind-using-elfutils testsuite regressions apply otherwise (the regressions may no longer be true as elfutils caching is now implemented).
Created attachment 1599 [details] Implementation (v4). Tested/bugfixed now also on x86_64. It should be usable with elfutils-0.126-1 (only https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230793 fix is recommended).