folly: symbolizer: slow address->{file+line-number} lookup if `.debug_aranges` is...
authorLucian Grijincu <lucian@fb.com>
Fri, 19 Feb 2016 02:46:44 +0000 (18:46 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Fri, 19 Feb 2016 03:20:27 +0000 (19:20 -0800)
commit4d4ca9ecafc9d4ce62b9ce84e6a6bb20607ded32
tree84f92947c493e7e6b2f32f01e069aae418ce65a6
parentad925ffabc3a5d452927242efdff0ba70f34626d
folly: symbolizer: slow address->{file+line-number} lookup if `.debug_aranges` is missing (e.g. --strip-debug-non-line)

Summary:Binaries linked with `gold` and `--strip-debug-non-line` don't have an `.debug_aranges` section

We still want to map `address->{file+line-number}` to get nice stack
traces even though this might be slower (linear search all compilation unit entries in `.debug_info`).

Before:
```
$ # link with gold + --strip-debug-non-line
$ folly/experimental/exception_tracer/exception_tracer_test
E0217 15:02:13.694947 1321814 ExceptionTracer.cpp:179] Exception type: std::runtime_error (9 frames)
    @ 000000000040ad2d __cxa_throw
    @ 0000000000409df3 bar()
    @ 0000000000409eab baz()
    @ 0000000000407c77 main
    @ 00007f00dd9860f5 __libc_start_main
    @ 000000000040991b (unknown)
```

After (similar to the output without `--strip-debug-non-line`):
```
E0217 18:37:37.579596 1583124 ExceptionTracer.cpp:179] Exception type: std::runtime_error (9 frames)
    @ 000000000040ad6d __cxa_throw
                       ./folly/experimental/exception_tracer/ExceptionTracerLib.cpp:57
    @ 0000000000409e33 bar()
                       ./folly/experimental/exception_tracer/ExceptionTracerTest.cpp:24
    @ 0000000000409eeb baz()
                       ./folly/experimental/exception_tracer/ExceptionTracerTest.cpp:51
    @ 0000000000407c87 main
                       ./folly/experimental/exception_tracer/ExceptionTracerTest.cpp:96
    @ 00007f1d16ff80f5 __libc_start_main
    @ 000000000040995b (unknown)
```

Differential Revision: D2947965

fb-gh-sync-id: e517bab324b1dcb70cadc9a5211ce794e35c83a5
shipit-source-id: e517bab324b1dcb70cadc9a5211ce794e35c83a5
folly/experimental/symbolizer/Dwarf.cpp
folly/experimental/symbolizer/Dwarf.h
folly/experimental/symbolizer/test/DwarfBenchmark.cpp [new file with mode: 0644]