Is there a simple way for a Linux process to access its own DWARF debug information? I have a process that wants to dump the DWARF information for one specific compilation unit into a log file.
This is to simplify some logistics. I have binary log files that contain raw C structs and I need to use DWARF information to decode these files. I would prefer to include the DWARF data at the start of the log files to make them "stand-alone" instead of having to make it available separately.
read the dwarf info from /proc/self/exe such as ..
shows the idea .. what you want might then be queryable with existing tools
if you are wanting to get at the dwarf info yourself then libdwarf has helpful examples .. dwarfexample/simplereader.c