how to know if a binary contains debugging symbols or not without file, objdump or gdb?
c, c++, debugging, linux
Solution
probably you are looking for a tool like objdump
Lets say we have a small program like this
#include <stdio.h>
int main()
{
printf("Hello ");
return 0;
}
compile normally now
gcc example.c -o example
now lets check presence of debugging symbols using objdump tool
objdump -h example | grep debug
we won't find any of course
now lets try again by compiling with debug options
gcc -g example.c -o example
objdump -h example | grep debug
26 .debug_aranges 00000030 0000000000000000 0000000000000000 000008b0 2**0
27 .debug_pubnames 0000001b 0000000000000000 0000000000000000 000008e0 2**0
28 .debug_info 0000008b 0000000000000000 0000000000000000 000008fb 2**0
29 .debug_abbrev 0000003f 0000000000000000 0000000000000000 00000986 2**0
30 .debug_line 0000003f 0000000000000000 0000000000000000 000009c5 2**0
31 .debug_str 00000087 0000000000000000 0000000000000000 00000a04 2**0
32 .debug_pubtypes 00000012 0000000000000000 0000000000000000 00000a8b 2**0
man -a objdump might help a lot more
Problem
I need to know whether a binary has debugging symbols in it or not. Its a production system and so doesnt have commands like `file` or `objdump` or `gdb`. Can provide more info when needed. OS: Debian