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
To check if there's debug info inside the kernel object, you can add the following at the end of the objdump command: | grep debug . If this string is found, you know the kernel object contains debug information. If not, then it's a "clean" kernel object.
Debug symbols typically include not only the name of a function or global variable, but also the name of the source code file in which the symbol occurs, as well as the line number at which it is defined.
A Debugging Symbol Table maps instructions in the compiled binary program to their corresponding variable, function, or line in the source code. This mapping could be something like: Program instruction ⇒ item name, item type, original file, line number defined.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With