This is an archive of the discontinued LLVM Phabricator instance.

Support for separate debug info files in asan symbolize script
Needs RevisionPublic

Authored by m.guseva on Aug 14 2014, 4:23 AM.

Details

Summary

The patch allows asan symbolize script to use separate debug info files on Linux system using ELF debug link or build ID for debug info files locating. These are methods provided currently by GNU Binutils. Added functionality replicates the GDB algorithm https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html

Diff Detail

Event Timeline

m.guseva updated this revision to Diff 12494.Aug 14 2014, 4:23 AM
m.guseva retitled this revision from to Support for separate debug info files in asan symbolize script.
m.guseva updated this object.
m.guseva edited the test plan for this revision. (Show Details)
m.guseva added reviewers: glider, samsonov, kcc.
m.guseva added subscribers: Unknown Object (MLST), ygribov.
samsonov edited edge metadata.Aug 14 2014, 11:00 AM

Why can't you use llvm-symbolizer? This tool implements searching for separate debug info files (looking at /usr/lib/debug, calculating crc32 hashes and so on). I was sure that addr2line does this as well. This should be the responsibility of the tools we invoke through asan_symbolize.py script, not the script itself.

In D4902#4, @samsonov wrote:

Why can't you use llvm-symbolizer? This tool implements searching for separate debug info files (looking at /usr/lib/debug, calculating crc32 hashes and so on). I was sure that addr2line does this as well. This should be the responsibility of the tools we invoke through asan_symbolize.py script, not the script itself.

I am using gcc and GNU binutils, not llvm. You are right, the separate debug info is supported by addr2line tool. But I need it to work with sysroot defined also. The other way could be to add such functionality to addr2line instead of patching the script.
So if you don't find the patch generally useful I agree it must be rejected.

emaste added a subscriber: emaste.Aug 18 2014, 11:31 AM

I think the functionality is generally useful, but it's the responsibility of the individual tools (binutils and LLVM equivalents) to handle standalone debug, not every script or tool that invokes them.

lib/asan/scripts/asan_symbolize.py
596

Standalone debug works the same way on FreeBSD too, so == 'Linux' is too restrictive.

I think that adding support for standalone debug info to asan_symbolize.py is not an option. This logic is already implemented in the symbolization tools, if you want them to work with custom sysroot (so that debug versions of binaries could be found at /path/to/my/sysroot/usr/lib/debug), just add the --sysroot flag to the tools. I can review and submit this kind of patch to llvm-symbolizer tool.

samsonov requested changes to this revision.Aug 18 2014, 12:53 PM
samsonov edited edge metadata.
This revision now requires changes to proceed.Aug 18 2014, 12:53 PM