On Tue, Mar 29, 2011 at 8:51 AM, Lassi Tuura <[email protected]> wrote: > 1) The new slow_backtrace() does its own unw_getcontext(). Will this not > introduce one extra stack level if slow_backtrace() isn't inlined into > backtrace()? OTOH, if it's inlined, why split? In my builds it is always > inlined.
slow_backtrace() is marked ALWAYS_INLINE. I did it this way to keep the fast/slow unwind paths logically separate. > > 2) I still can't get our library to call into libunwind's backtrace() > function. If I read LD_DEBUG=symbols output correctly, libc.so is searched > for 'backtrace' always, before libunwind.so. I think we need a distinct > symbol. I checked this both with our library ($LD_PRELOAD'ed into > executables, depends on libunwind), and libunwind 'make check' test programs. > In all cases 'backtrace' comes from libc.so. I believe the history of backtrace() in libunwind is that on Itanium, libunwind was the main provider of the unwind/backtrace functionality including backtrace(). Someone more current with Itanium should be able to comment on this. Also, I'm not sure why you're not able to access libunwind's version of backtrace(). Ltest-trace seems to work fine for me. libunwind.test3/tests$ ../libtool --mode=execute gdb Ltest-trace .. Reading symbols from /home/arun/src/libunwind.test3/tests/.libs/lt-Ltest-trace...done. (gdb) b backtrace Breakpoint 1 at 0x400aa8 (gdb) r Starting program: /home/arun/src/libunwind.test3/tests/.libs/lt-Ltest-trace Breakpoint 1, backtrace (buffer=0x602ca0, size=128) at mi/backtrace.c:63 63 int n = size; (gdb) bt #0 backtrace (buffer=0x602ca0, size=128) at mi/backtrace.c:63 #1 0x0000000000400c9e in do_backtrace () at Gtest-trace.c:107 #2 0x00000000004012e0 in foo (v=1) at Gtest-trace.c:132 #3 bar (v=1) at Gtest-trace.c:145 #4 0x000000000040132b in main (argc=<value optimized out>, argv=0x80) at Gtest-trace.c:217 (gdb) info shared >From To Syms Read Shared Object Library 0x00007ffff7dddaf0 0x00007ffff7df66c4 Yes (*) /lib64/ld-linux-x86-64.so.2 0x00007ffff7bbf7d0 0x00007ffff7bca64f Yes /home/arun/src/libunwind.test3/src/.libs/libunwind.so.7 0x00007ffff78598c0 0x00007ffff796c5e0 Yes (*) /lib/libc.so.6 libc defines backtrace() as a weak symbol which should make it easy to override via LD_PRELOAD. $ nm -D /lib64/libc.so.6 | grep backtrace 00000000000ff330 T __backtrace 00000000000ff460 T __backtrace_symbols 00000000000ff6f0 T __backtrace_symbols_fd 00000000000ff330 W backtrace 00000000000ff460 W backtrace_symbols 00000000000ff6f0 W backtrace_symbols_fd > > 3) Unfortunately the introduction of unw_step() into backtrace() to drop the > first call level makes it ~15% slower than the version which just calls > unw_tdep_trace(). I suggest instead we make unw_tdep_trace() internal to > libunwind, and make it omit the first stack level. > I considered calling unw_tdep_trace() and then discarding one frame. But that'd involve a memcpy. Your suggestion sounds good to me. I'll take a look at your patches hopefully in the next couple of days. -Arun _______________________________________________ Libunwind-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/libunwind-devel
