Dec 21, 2016 $ objdump -dj.text mysteryprogram grep getopt 401acf: e8 3c fc ff ff callq 401710 The second is that a string composed of all valid command line options is passed to getopt when it is called, as we see in its function prototypes. From the synopsis in its man page. ObjDump, a small Java framework that dumps any Java object to a string. Linux objdump command The objdump command in Linux, as the name suggests, displays information from object files. Following is the tool's syntax: objdump OPTIONS objfile.
What is objdump?
5 objdump examples
Syntax and Options
Related Commands
What is objdump?
The Linux objdump command is used to display various types of information stored in object files. This command is mostly used while debugging or by the developers who are working on compilation tools.
5 objdump Examples
1. Display file header using -f option
Output consisting of only the file header (ELF header) can be displayed using -f option with this command.
Consider the following example :
So we see that the file header was produced in the output.
2. Display information related to all the sections using -s option
Objdump Command
An object file may consist of various sections. To retrieve information related to all the sections, supply the -s option along with this command.
Consider the following example :
So we see that information related to all the sections was produced in the output.
3. Display a particular section using -j option
If we want that the output should consist only of a particular section. Then this can be done using the -j option along with this command.
Consider the following example :
So we see that details related to the section .interp was produced in the output.
4. Accept the options from file by using @ option
Rather than supplying options through command line, a file can be used to supply options to the objdump command.
Consider the following example :
So we see that objdump command successfully accepted the options from a file and produced a relevant output.
5. Display all the header information using -x option
Information related to all the headers can be retrieved using -x option along with this command.
Consider the following example :
So we see that a detailed information was produced in the output.
Syntax and Options
Short Option | Long Option | Option Description |
---|---|---|
-a | –archive-header | If any of the objfile files are archives, display the archive header information (in a format similar to ls -l). Besides the information you could list with ar tv, objdump -a shows the object file format of each archive member. |
–adjust-vma=offset | When dumping information, first add offset to all the section addresses. This is useful if the section addresses do not correspond to the symbol table, which can happen when putting sections at particular addresses when using a format which can not represent section addresses, such as a.out. | |
-C | –demangle[=style] | Decode (demangle) low-level symbol names into user-level names. Besides removing any initial underscore perpended by the system, this makes C++ function names readable. Different compilers have different mangling styles. The optional demangling style argument can be used to choose an appropriate demangling style for your compiler. |
-e | –debugging-tags | Like -g, but the information is generated in a format compatible with ctags tool. |
-D | –disassemble-all | Like -d, but disassemble the contents of all sections, not just those expected to contain instructions. If the target is an ARM architecture this switch also has the effect of forcing the disassembler to decode pieces of data found in code sections as if they were instructions. |
-EB, -EL | –endian={big|little} | Specify the endianness of the object files. This only affects disassembly. This can be useful when disassembling a file format which does not describe endianness information, such as S-records. |
-F | –file-offsets | When disassembling sections, whenever a symbol is displayed, also display the file offset of the region of data that is about to be dumped. If zeros are being skipped, then when disassembly resumes, tell the user how many zeros were skipped and the file offset of the location from where the disassembly resumes. When dumping sections, display the file offset of the location from where the dump starts. |
-j name | –section=name | Display information only for section name. |
Related Commands
nm
readelf
COMMANDS¶
At least one of the following commands are required, and some commands can becombined with other commands:
-a
,
--archive-headers
¶Display the information contained within an archive’s headers.
-d
,
--disassemble
¶Disassemble all text sections found in the input files.
-D
,
--disassemble-all
¶Disassemble all sections found in the input files.
--disassemble-functions
=<symbol1[,symbol2,...]>
¶Disassemble only the specified symbols. Takes demangled symbol names when--demangle
is specified, otherwise takes mangled symbol names.Implies --disassemble
.
--dwarf
=<value>
¶Dump the specified DWARF debug sections. The supported values are:
frames - .debug_frame
-f
,
--file-headers
¶Display the contents of the overall file header.
--fault-map-section
¶Display the content of the fault map section.
-h
,
--headers
,
--section-headers
¶Display summaries of the headers for each section.
--help
¶Display usage information and exit. Does not stack with other commands.
-p
,
--private-headers
¶Display format-specific file headers.
-r
,
--reloc
¶Display the relocation entries in the file.
-R
,
--dynamic-reloc
¶Display the dynamic relocation entries in the file.
Objdump Disassemble
--raw-clang-ast
¶Dump the raw binary contents of the clang AST section.
-s
,
--full-contents
¶Display the contents of each section.
-t
,
--syms
¶Display the symbol table.
-u
,
--unwind-info
¶Display the unwind info of the input(s).
--version
¶
Display the version of this program. Does not stack with other commands.
Objdump Example
-x
,
--all-headers
¶Objdump Function Dependencies
Display all available header information. Equivalent to specifying--archive-headers
, --file-headers
,--private-headers
, --reloc
, --section-headers
,and --syms
.