Skip to content
  • Peter Hutterer's avatar
    test: extract file:line from backtrace with addr2line · b8af89f1
    Peter Hutterer authored
    
    
    libunwind gives us a file and an address and usually a function name. Beyond
    that, it's mostly guessing.
    Fork off addr2line to resolve the addresses that libunwind gives us, if we
    succeed we get a backtrace like this:
    
    	Backtrace:
    	0: litest_fail_comparison_int() (./test/litest.c:268)
    	1: disable_button_scrolling() (./test/pointer.c:115)
    	2: middlebutton_doubleclick() (./test/pointer.c:991)
    	3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f6c12d8c025]
    	4: litest_run() (./test/litest.c:689)
    	5: main() (./test/pointer.c:1280)
    	6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f6c11a73790]
    	7: ./test/test-pointer (_start+0x29) [0x403d99]
    	8: ? (?+0x29) [0x29]
    
    Note: I intentionally swapped function/file name in the output to make it
    easier to spot which one is fully resolved and which one is the basic
    libunwind output.
    
    Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
    b8af89f1