libbacktrace: Handle MOREDATA correctly without debug info
Improves libbacktrace's symbol lookup in stripped binaries when debug info is absent.
This commit enhances libbacktrace’s ability to correctly handle the MOREDATA state when retrieving symbol information from binaries that have been stripped of debug information. It introduces a new function backtrace_syminfo_to_full_callback_moredata and ensures that the elf.c module correctly processes this state, along with adding tests for stripped binaries.
In Details
The libbacktrace library provides stack unwinding capabilities. When dealing with stripped binaries (lacking debug symbols), it sometimes needs to fetch additional data related to symbols. This patch, based on work by Andi Kleen, correctly implements the handling of state->moredata within the elf_nodebug function in elf.c. A new callback backtrace_syminfo_to_full_callback_moredata is introduced, and a new test case strippedtest.c is added to verify functionality on stripped executables.
- libbacktrace
- A library used for generating stack traces, typically invoked after a program crash or error to provide information about the call sequence.
- stripped binary
- An executable file or library from which debugging symbols and other non-essential information have been removed, making the file smaller but harder to debug.
- MOREDATA
- A state indicator used within
libbacktraceto signify that additional data needs to be fetched or processed during symbol lookup, particularly when debug information is limited or absent. - symbol lookup
- The process of finding the names and addresses of functions and variables within an executable or object file, often using symbol tables.