Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to know if a binary contains debugging symbols or not without file, objdump or gdb?

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

like image 291
VoidPointer Avatar asked Jul 03 '13 16:07

VoidPointer


People also ask

How do you know if a binary symbol is debugging?

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.

What are debugging symbols as found in some binaries?

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.

What are debugging symbols in GDB?

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.


1 Answers

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

like image 171
asio_guy Avatar answered Oct 20 '22 01:10

asio_guy