Objdump
Jump to navigation
Jump to search
objdump is a tool to work with binary object files. It is part of the GNU binutils.
objdump can be used for disassembly, with the -d flag, eg.
objdump -d executable
If the executable has been compiled with debugging information, the -S flag will intermix source and disassembled code.
The --syms flag shows symbol information.
Example
- Have a file main.cpp:
#include <iostream> int main() { std::cout << "hello world" << std::endl; }
- Build it:
g++ main.cpp
- disassemble it:
objdump -d a.out
- show only the first lines:
objdump -d a.out | head [...] 0000000000400718 <_init>: 400718: 48 83 ec 08 sub $0x8,%rsp 40071c: e8 cb 00 00 00 callq 4007ec <call_gmon_start> [...]
- use another debugger format:
objdump -M intel -d a.out | head [...] 0000000000400718 <_init>: 400718: 48 83 ec 08 sub rsp,0x8 40071c: e8 cb 00 00 00 call 4007ec <call_gmon_start> [...]