-
Notifications
You must be signed in to change notification settings - Fork 284
How can I tell if a binary was compiled with debug symbols?
vadimcn edited this page Oct 13, 2020
·
3 revisions
Check whether it contains the .debug... sections:
$ readelf -S <binary> | grep .debug
[30] .debug_info PROGBITS 0000000000000000 0001404c
[31] .debug_abbrev PROGBITS 0000000000000000 0003ddbe
[32] .debug_aranges PROGBITS 0000000000000000 0003f81f
[33] .debug_ranges PROGBITS 0000000000000000 00041c0f
[34] .debug_line PROGBITS 0000000000000000 000440af
[35] .debug_str PROGBITS 0000000000000000 00048e3bdsymutil -s <binary> | grep N_OSO... should produce non-empty output.
- When compiling with MS Visual C++, or targeting
-msvcwith Rust, check whether a<binary>.pdbfile exists next to the binary. You may also use thesymchkutility to locate/validate debug symbols. - When compiling with MinGW, or targeting
-gnuwith Rust, the debugging symbols will be stored in.debug...sections, just like in the Linux case. Use tools likedumpbin /headers <binary>orobjdump -P sections <binary>to confirm that these sections exist.