GCC documentation says that the -g
option produces debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2).
So, what is Linux native debugging symbols format? What is it called?
Update: I've just found a 15-year old gcc mailing list discussion where it was said that the native format at that point was stabs and then they were considering to switch to DWARF2. But it was 15 years ago… Any updates? =)
Best Answer
On Linux the default is now Dwarf 2 and/or 4. To see this, run
readelf --debug-dump=info
on a binary containing debug symbols (or stripped symbols); for example, on Fedora, withglibc-debuginfo
installed, runningreadelf --debug-dump=info /usr/lib/debug/bin/gencat.debug
will give you something likeThis is a set of Dwarf 2 information (see the
Version:
header for version information; the same binary includes Dwarf 2 and Dwarf 4 sections).