Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upminidebuginfo support for elf #38
Conversation
|
Thanks, but libbacktrace must be async-signal-safe. It's hard to be confident that that is true of an external library. On my system, liblzma is compiled with |
|
liblzma uses user's provided allocators for memory allocation (I used wrappers for backtrace_alloc/free). In case NULL was passed it goes back to malloc & free, so i think it is the reason why does it have references to malloc. Also libunwind uses lzma like this, but maybe they dont care that much about async-safety. Anyway will consider including lzma decoder into. Maybe it will be easy to port it directly from liblzma. |
|
@ianlancetaylor what do you think about using XZ Embedded which is used directly in the Linux kernel? It is relatively small implementation with only decompression support. It could be included as a subdirectory to libbacktrace. edit:
edit2: |
|
Honestly my inclination is to just add a LZMA decoder like the existing zlib decoder. |
|
@ianlancetaylor hello. Has it become better? I used the xz embedded source code and mentioned both authors. Dropped redundant macroes, fixed codestyle (I hope I did), dropped single-call & preallocated modes, used backtrace_alloc for dictionary allocation. Everything now lives in elf.c file, so no external dependencies.I would like to believe that what you wanted? |
|
This is now in conflict due to 7206f5b. I suspect the conflict can be resolved if the xz sources are put at the end of |
|
Thanks for sending this. I went in a different direction by writing a simpler and smaller version of the LZMA decoder that knows that all the data is in memory. It also doesn't use the BCJ decompressors, which should never be needed in minidebug info. The new code is in 77bcaa9. Thanks again. |
|
Thank you, @ianlancetaylor. Sounds great, I'll try it at work, where we did use this branch for a while. |
Hello, I added a minidebuginfo support for elf. Please take a look.
Here is a small example of usage with boost/stacktrace that used library as backend ( 6mb version of boost included ;) )
Also I had to create few wrappers for functions like backtrace_get_view, backtrace_release_view to accept not only filedescriptors but also already mapped to memory elf. Could go with memfd_create and just open uncompressed elf file but seems like it appered in linux 3.17.
For now the wrappers just copy any part that was asked to be viewed from uncompressed to memory elf file.