When it comes to ELF, two accompanying debugging formats are overwhelmingly popular to others, namely STAB and DWARF. I'd like an easy way to ascertain whether a given binary contains debug information of one form or the other, preferably without having to inspect section names (.stab, etc.).
What are good ways of accomplishing this?
The
STABS
format has not been used by default by any current compilers onELF
platforms for the last 10 years. It's definitely not "overwhelmingly popular".The way to tell:
You will see
.stab
section if the binary hasSTABS
. You will see.debug_info
,.debug_line
, etc. if you haveDWARF
. You'll see nothing if you don't have debug info at all.Can't be done without looking at sections: it's the presence or absence of these sections that makes the binary contain or not contain debug info.