libbacktrace icon indicating copy to clipboard operation
libbacktrace copied to clipboard

[PATCH] fix symbol search loop at debuglink mode

Open pavel-orekhov opened this issue 3 years ago • 5 comments

Some distribs like ubuntu'18 creatively name files with debug symbols. (same name without .debug suffix). And give no build-id way.

$dpkg -L libc6-dbg | grep -v gconv /usr/lib/debug/.build-id/68/f36706eb2e6eee4046c4fdca2a19540b2f6113.debug /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.27.so

$ dpkg -L libc6 /lib/x86_64-linux-gnu/libc-2.27.so /lib/x86_64-linux-gnu/libc.so.6

$ objdump -s -j .gnu_debuglink -j .note.gnu.build-id
/lib/x86_64-linux-gnu/libc-2.27.so

Contents of section .gnu_debuglink: 0000 6c696263 2d322e32 372e736f 00000000 libc-2.27.so.... 0010 5ac51387 Z... Contents of section .note.gnu.build-id: 0270 04000000 14000000 03000000 474e5500 ............GNU. 0280 ce450eb0 1a5e5acc 7ce7b8c2 633b02cc .E...^Z.|...c;.. 0290 1093339e ..3.

So elf_find_debugfile_by_debuglink("libc") loops back to /lib/x86_64-linux-gnu/libc-2.27.so and can't lookup symbols for libc and another standard libs. This patch breaks this loop and allows to lookup for symbols at other places.

pavel-orekhov avatar Mar 03 '21 07:03 pavel-orekhov

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

googlebot avatar Mar 03 '21 07:03 googlebot

@googlebot I signed it!

pavel-orekhov avatar Mar 03 '21 07:03 pavel-orekhov

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

googlebot avatar Mar 03 '21 07:03 googlebot

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

googlebot avatar Mar 03 '21 08:03 googlebot

FYA @ianlancetaylor

pavel-orekhov avatar Mar 03 '21 08:03 pavel-orekhov