Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I know what type of debug info is in an ELF object file?

I have an ELF object file. I want to know which type of debugging info it contains. It was compiled with the Diab compiler (C source) for the PPC architecture. I'm pretty sure it was built with debugging symbols.

I have tried extracting the debugging info with dwarfdump but I doesn't work so I guess the debugging information is not of type DWARF.

$ dwarfdump file.elf
No DWARF information present in file.elf

Using objdump to show debugging information comes up empty.

$ objdump -g file.elf 
file.elf:     file format elf32-powerpc

Can it be that this ELF file does not contain debugging info even though the ELF file has sections called .debug_sfnames, .debug_srcinfo and .debug.srcinfo? Or is the debugging info stored in a format that objdump can't handle?

like image 702
johnj33 Avatar asked Aug 17 '11 19:08

johnj33


People also ask

How do I view the contents of an ELF file?

you can use readelf and objdump to read parts of an elf file. You can also use 'hexdump filename' to get a hexdump of the contents of a binary file (this is likely only useful if you like reading machine code or you are writing an assembler).

What ELF file contains?

In computing, the Executable and Linkable Format (ELF, formerly named Extensible Linking Format), is a common standard file format for executable files, object code, shared libraries, and core dumps.

How can I tell if a program was compiled with debug symbols?

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.


1 Answers

You should probably use the nm

The nm utility shall display symbolic information appearing in the object file, executable file, or object-file library named by file. If no symbolic information is available for a valid input file, the nm utility shall report that fact, but not consider it an error condition.

Alternatively you can use tools like ldd to see what libraries are required by a binary.

like image 163
Lelouch Lamperouge Avatar answered Oct 04 '22 23:10

Lelouch Lamperouge