-
Notifications
You must be signed in to change notification settings - Fork 246
How can I tell if a binary was compiled with debug symbols?
vadimcn edited this page Jun 7, 2021
·
3 revisions
LLDB's Troubleshooting page suggests using the image list
command to
check which modules have debugging information available.
Here are also OS-specific methods:
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 00048e3b
dsymutil -s <binary> | grep N_OSO
... should produce non-empty output.
- When compiling with MS Visual C++, or targeting
-msvc
with Rust, check whether a<binary>.pdb
file exists next to the binary. You may also use thesymchk
utility to locate/validate debug symbols. - When compiling with MinGW, or targeting
-gnu
with 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.