How to check if program was compiled with debug symbols?

Lukasz Czerwinski picture Lukasz Czerwinski · Jul 19, 2010 · Viewed 70.4k times · Source

I'd like to trace some code in GIMP and therefore need GIMP with debug symbols enabled. I don't remember whether I have enabled them during compilation. How to check that without recompiling the program?

Answer

Matthew Flaschen picture Matthew Flaschen · Jul 19, 2010

You can use file and objdump on Linux. In particular, you can look at whether file says "stripped" or "not stripped" (under my Ubuntu 20.04.1 LTS, whether an executable is compiled with -g or not shows not stripped with file command. But the one with -g, shows with debug_info, in addition to that), and whether objdump --syms outputs anything useful (for me, it says "no symbols" for a regular build).