objdump
   HOME

TheInfoList



OR:

objdump is a
command-line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
program for displaying various information about
object file An object file is a computer file containing object code, that is, machine code output of an assembler or compiler. The object code is usually relocatable, and not usually directly executable. There are various formats for object files, and the ...
s on
Unix-like A Unix-like (sometimes referred to as UN*X 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 Unix-li ...
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
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. A disassembler differs from a decompiler, which targets a high-level language rather than an assembly lan ...
to view an
executable In computing, 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), instructi ...
in assembly form. It is part of the
GNU Binutils The GNU Binary Utilities, or , are a set of programming tools for creating and managing binary programs, object files, libraries, profile data, and assembly source code. Tools They were originally written by programmers at Cygnus Solutions. ...
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 Borland Software Corporation was a computer technology company founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn. Its main business was the development and sale of software development and software deployment product ...
TDUMP,
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
DUMPBIN and
readelf readelf is a program for displaying various information about object files on Unix-like systems such as objdump. It is part of the GNU binutils. readelf and objdump objdump has a similar function but with different features like disassembling. ...
. Note that on certain platforms (e.g.
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and lapt ...
), the objdump binary may actually be a link to llvm's objdump, with different command-line options and behavior.


Example

For example, $ objdump -D -M intel file.bin , grep main.: -A20 This performs disassembly on the file «file.bin», with the
assembly code In computer programming, assembly language (or 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 b ...
shown in
Intel syntax x86 assembly language is the name for the family of assembly languages which provide some level of backward compatibility with CPUs back to the Intel 8008 microprocessor, which was launched in April 1972. It is used to produce object code for t ...
. We then redirect it to
grep grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. Its name comes from the ed command ''g/re/p'' (''globally search for a regular expression and print matching lines''), which has the sam ...
, which searches the main function and displays 20 lines of its code. Example output: 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 40053d: 0f 1f 00 nop DWORD PTR ax


See also

*
GNU Binutils The GNU Binary Utilities, or , are a set of programming tools for creating and managing binary programs, object files, libraries, profile data, and assembly source code. Tools They were originally written by programmers at Cygnus Solutions. ...


External links

* *
Binutils::Objdump
-
Perl Perl is a family of two high-level, general-purpose, interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it also referred to its redesigned "sister language", Perl 6, before the latter's name was offici ...
interface to objdump Unix programming tools Disassemblers {{unix-stub