Retrieving the function name from an address in .debug_info
Posted: Mon Feb 01, 2016 9:20 pm
All,
As many of you, I want to get a more meaningful stack trace when I experience a crash. So I embarked on understanding the DWARF format.
I was able to successfully decode the .debug_line section, so my stack traces now display the source code directory/filename/line number. Yay! (don't hesitate to ask me questions if you're stuck in that step)
For the next step I would like to display the function name as well. However, going through the .debug_info doesn't seem straightforward as each type of Debugging Information Entry (DIE) has a different size, and this size changes for each compilation unit. So yes, I can look at the .debug_abbrev section to find the schema for each DIE in each compilation unit, handle special cases for variable-length attributes, but this seems overly complicated when all I want is the address ranges each function covers.
Has anybody come up with a faster way?
Thanks
As many of you, I want to get a more meaningful stack trace when I experience a crash. So I embarked on understanding the DWARF format.
I was able to successfully decode the .debug_line section, so my stack traces now display the source code directory/filename/line number. Yay! (don't hesitate to ask me questions if you're stuck in that step)
For the next step I would like to display the function name as well. However, going through the .debug_info doesn't seem straightforward as each type of Debugging Information Entry (DIE) has a different size, and this size changes for each compilation unit. So yes, I can look at the .debug_abbrev section to find the schema for each DIE in each compilation unit, handle special cases for variable-length attributes, but this seems overly complicated when all I want is the address ranges each function covers.
Has anybody come up with a faster way?
Thanks