Bug 387264 - Use debugging symbols from separate file
Summary: Use debugging symbols from separate file
Status: RESOLVED FIXED
Alias: None
Product: Heaptrack
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Milian Wolff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-24 15:31 UTC by Daniel Saier
Modified: 2017-11-27 14:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Saier 2017-11-24 15:31:31 UTC
I put the debugging symbols for a library into a separate file with

    objcopy --only-keep-debug x.so x.so.dbg
    strip --strip-unneeded x.so
    objcopy --add-gnu-debuglink="x.so.dbg" x.so

This is recognized by GDB without any problems, but Heaptrack does not use the debugging symbols for such a library. If I keep them directly in the .so file everything works as expected.
Comment 1 Milian Wolff 2017-11-25 22:14:41 UTC
Yep, the debug link support is pretty much non-existing. But if you rename the file(s) to *.debug instead of *.dbg it should work. Adding your postfix as another fallback could be added quite simply, too, as a stop-gap measure.
Comment 2 Daniel Saier 2017-11-27 07:34:39 UTC
It actually looks like support for debug links was recently added to libbacktrace: https://github.com/gcc-mirror/gcc/commit/b919941efc58035debbcf69b645c072b7dd6ba4e

I don't know what it takes to update it in Heaptrack, though.
Comment 3 Milian Wolff 2017-11-27 08:48:12 UTC
oh, excellent - thanks for the pointer! I'll try to look at that soon and update the copy of libbacktrace. Alternatively, I still contemplate porting the code to elfutils/libdw(fl), which supports this nicely too.
Comment 4 Milian Wolff 2017-11-27 10:31:46 UTC
Can you please try https://transfer.sh/152WHJ/heaptrack-git.3605a93-x86_64.AppImage or the wip/debuglink branch and see if it works for you? This is a build with the latest libbacktrace (and some custom patches to make it work for me).
Comment 5 Daniel Saier 2017-11-27 13:10:25 UTC
Wow, that was a quick fix. It works perfectly for me, thank you.
Comment 6 Milian Wolff 2017-11-27 14:12:33 UTC
Well, thanks to you to point me to the important updates in libbacktrace :)
Comment 7 Milian Wolff 2017-11-27 14:15:44 UTC
fix landed in master now:

commit 040fbf357248beb56a3cad39c512d42fd6f9ebb2
Author: Milian Wolff <milian.wolff@kdab.com>
Date:   Mon Nov 27 10:17:40 2017 +0100

    Update libbacktrace to support compressed and separate debug info
    
    This updates the source code to libbacktrace rev trunk@255161.
    
    Additional changes on top:
    
    - keep elf_add and elf_syminfo public for use in heaptrack_interpret
    - check for lstat and readlink from CMake
    - patch the debug info code to make it work for my common use-case:
      * don't compare crc when not available
      * also get symbols from debug file
    
    BUG: 387264