objdump is a
command-line
A command-line interface (CLI) is a means of interacting with software via commands each formatted as a line of text. Command-line interfaces emerged in the mid-1960s, on computer terminals, as an interactive and more user-friendly alternativ ...
program for displaying various information about
object file
An object file is a file that contains machine code or bytecode, as well as other data and metadata, generated by a compiler or assembler from source code during the compilation or assembly process. The machine code that is generated is kno ...
s on
Unix-like
A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
s. For instance, it can be used as a
disassembler
A disassembler is a computer program that translates machine language into assembly languageāthe inverse operation to that of an assembler. The output of disassembly is typically formatted for human-readability rather than for input to an asse ...
to view an
executable
In computer science, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instruction (computer science), in ...
in assembly form. It is part of the
GNU Binutils for fine-grained control over executables and other binary data. objdump uses the
BFD library to read the contents of object files. Similar utilities are
Borland TDUMP,
Microsoft DUMPBIN and
readelf.
On certain platforms (e.g.
macOS
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
), the objdump binary may actually be a link to
LLVM
LLVM, also called LLVM Core, is a target-independent optimizer and code generator. It can be used to develop a Compiler#Front end, frontend for any programming language and a Compiler#Back end, backend for any instruction set architecture. LLVM i ...
's objdump, with different command-line options and behavior. otool and
nm perform analogous functions for
Mach-O files.
Example
For example,
$ objdump -D -M intel file.bin
This disassembles the file
file.bin
, showing its
assembly code
In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
in
Intel syntax
x86 assembly language is a family of low-level programming languages that are used to produce object code for the x86 class of processors. These languages provide backward compatibility with CPUs dating back to the Intel 8008 microprocessor, in ...
.
Example output:
4004ed :
4004ed: 55 push rbp
4004ee: 48 89 e5 mov rbp,rsp
4004f1: c7 45 ec 00 00 00 00 mov DWORD PTR bp-0x140x0
4004f8: c7 45 f0 01 00 00 00 mov DWORD PTR bp-0x100x1
4004ff: c7 45 f4 02 00 00 00 mov DWORD PTR bp-0xc0x2
400506: c7 45 f8 03 00 00 00 mov DWORD PTR bp-0x80x3
40050d: c7 45 fc 04 00 00 00 mov DWORD PTR bp-0x40x4
400514: c7 45 ec 00 00 00 00 mov DWORD PTR bp-0x140x0
40051b: eb 13 jmp 400530
40051d: 8b 05 15 0b 20 00 mov eax,DWORD PTR ip+0x200b15 # 601038
400523: 83 e8 01 sub eax,0x1
400526: 89 05 0c 0b 20 00 mov DWORD PTR ip+0x200b0ceax # 601038
40052c: 83 45 ec 01 add DWORD PTR bp-0x140x1
400530: 8b 05 02 0b 20 00 mov eax,DWORD PTR ip+0x200b02 # 601038
400536: 39 45 ec cmp DWORD PTR bp-0x14eax
400539: 7c e2 jl 40051d
40053b: 5d pop rbp
40053c: c3 ret
See also
*
GNU Binutils
References
External links
*
*
Binutils::Objdump-
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language".
Perl was developed ...
interface to objdump
Unix programming tools
Disassemblers
{{foss-stub