-
Hello everyone, I am doing some experiments to see if I can use cpptrace on RHEL8. That env does have a dwarf library as part of the Red Hat repo but there are various issues with it so I am building cpptrace with the dwarf library from this project. There seem to be a few rough edges but with help from the cpptrace developer I have got the combination to build and work. Except for one small problem - the function names only come out when my program is compiled with -g. I suspect this might be an issue with the dwarf library. But I am very puzzled because the gdb debugger can see function names even when the code is compiled without -g. Furthermore, setting a breakpoint in a function and doing a stacktrace reveals that the function names are available even with the -g flag. I hope someone can shed some light on this, please. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Building from github davea42 libdwarf-code is the right way. I recently fixed some bugs related Building with -g tells the compiler to emit debugging symbols. These days the default kind Without -g there will normally be no DWARF. However, the compiler As shown by something like: gdb accumulates all the information it can, so it finds the Elf symbols and can do useful libdwarf, on the other hand, only looks for DWARF symbol information and without such |
Beta Was this translation helpful? Give feedback.
Building from github davea42 libdwarf-code is the right way. I recently fixed some bugs related
to .debug_rnglists and .debug.loclists sections (they could return incomplete or incorrect
address ranges and locations in come cases).
Building with -g tells the compiler to emit debugging symbols. These days the default kind
of symbol table is (usually) DWARF, and often specifically DWARF5.
Without -g there will normally be no DWARF. However, the compiler
will emit (assuming Elf here) Elf symbols.
As shown by something like:
readelf --syms a.out
gdb accumulates all the information it can, so it finds the Elf symbols and can do useful
things with that knowledge.
libdwarf, on the other hand, on…