the objdump of the GCC command---------------Objdump is a GCC tool that is composed of viewing the target file or the executable target file----------The following 3 commands are enough for those friends who like to explore the relationship between the target file and the wire in the source code. Objdump-X obj organizes the data of the target file (divided into chunks) in the form of some sort of information < All dynamic libraries that can be traced to the file >Objdump-t obj output target file symbol table () Objdump-all segments of the H obj Output destination file are summarized () Objdump-j. Text/.data-S obj Outputs the information for the specified segment, which is probably the disassembly source code that objdump-The S-obj C language and assembly language also show the following online excerpt articles. About NM-s display Please yourself man nm view the Man Handbook of the Objdump command objdump-Displays binary file information objdump [-A] [-B bfdname | --target=bfdname] [-c] [--Debugging] [-d] [-D] [--disassemble-Zeroes] [-eb|-el|--endian={big|little}] [-F] [-h] [-i|--Info] [-j section | --section=Section ] [-l] [-M machine] [--prefix-Addresses] [-R] [-R] [-s|--full-contents] [-s|--Source] [--[NO-]SHOW-RAW-INSN] [--stabs] [-T] [-T] [-x] [--start-address=address] [--stop-address=Address] [--adjust-vma=offset] [--version] [--Help ] objfile ...--archive-Headers-a displays the member information of the archive, similar to AR TV objdump-a libpcap.a and AR-TV LIBPCAP.A Display results compared obviously this option does not mean anything. --adjust-vma=offset when dumping information, first add offset to all of the section addresses. this isUsefulifThe sec-tion addresses DoNot correspond to the symbol table, which can happen if putting sections at particular addresses whenusinga format which can not represent section addresses, such asA. out.-b bfdname--target=bfdname Specifies the destination code format. This is not necessary, Objdump can automatically identify many formats, such as: Objdump-B oasys-m VAX-h FU.O Displays FU.O's header summary information, which clearly indicates that the file is a target file generated by the Oasys compiler under the VAX system. Objdump-I will give you a list of target code formats that can be specified here--Demangle-C decodes the underlying symbol name into a user-level name, in addition to removing all the opening underscores, and makes C++The function name is displayed in an understandable way. --debugging displays debug information. Attempts to parse the debug information stored in the file and display it in the C language syntax. Only certain types of debugging information are supported. --disassemble-D disassembly of sections that should have the instruction machine code--disassemble- All-D and-d similar, but disassembly all sections--prefix-addresses displays the full address of each line when disassembled. This is a relatively old disassembly format. The display is not ideal, but some of the displays may be used and can be compared. --disassemble-Zeroes general disassembly output will omit chunks of 0, and this option makes these 0 blocks also disassembled. -EB-EL--endian={big|Little} This option will affect the disassembly instructions. Little-endian is that we used to play in the DOS when the assembly is often said high-level address, x86 is this. --file-Headers-F Displays the overall header summary information for each file in the objfile. --section-Headers--Headers-h Displays header summary information for each section of the target file. --Help for short information. --Info-I display for-B or-a list of schema and destination formats available for the M option. --section=name-J Name displays only the information for the specified section--line-numbers-l labels the corresponding target code with the file name and line number, only with-D,-D, or-R used together with-ld and use-d The difference is not very large, in the source-level debugging when useful, required to compile the use of-Debug compilation options such as G. --architecture= Machine-m machine specifies the schema to be used when disassembling the target file, when the disassembly file itself does not describe the schema information (such as S-records), this option is useful. can be used-The i option lists the schemas that can be specified here--reloc-r Displays the file's relocation entry. If and-D or-d is used together, the relocation section is displayed in the disassembled format. --dynamic-reloc-R Displays the file's dynamic relocation entry, which is only meaningful for dynamic target files, such as some shared libraries. --full-Contents-s Displays the full contents of the specified section. Objdump--section=.text-s INET.O | More--Source-S disassemble the source code as much as possible, especially if it is specified when compiling-g This kind of debugging parameters, the effect is more obvious. implies a-d parameter. --show-raw-INSN Disassembly, display the machine code corresponding to each assembly instruction, unless specified--prefix-addresses, this will be the default option. --no-show-raw-INSN Disassembly, the machine code for assembly instructions is not displayed, which is specified--prefix-the default setting when the Addresses option is selected. --stabs Display the contents of the. Stab,. Stab.index, and. STAB.EXCL Sections fromAn ELF file. This isOnly useful on systems (such asSolaris2.0)inchwhich. Stab Debugging symbol-table entries is carriedinchAn ELF section. In the most other file formats, debug-ging Symbol-table entries is interleaved with linkage symbols, and is visibleinchThe--syms output.--start-address=address displays data starting at the specified location, which affects-D,-R, and-the output of the S option. --stop-address=address displays the data until the location is specified, which affects-D,-R, and-the output of the S option. --Syms-T displays the symbol table entry for the file. Similar to NM-information provided by S--dynamic-Syms-T Displays the file's dynamic symbol table entry, which is only meaningful for dynamic target files, such as some shared libraries. It displays information similar to NM-d|--the information displayed by dynamic. --Version Information Objdump--version--all-Headers-X displays all available header information, including the symbol table, reposition entry. -x is equivalent to-a-f-h-r-T is specified at the same time. Objdump-x INET.O See NM (1) ★objdump Application example (to be added)/*g++-g-wstrict-prototypes-wall-wunused-o objtest objtest.c*/#include #includeintMain (intargcChar*argv[]) {Execl ("/bin/sh","/bin/sh","- I.",0 ); return 0;} G+ +-g-wstrict-prototypes-wall-wunused-o objtest objtest.cobjdump-j. TEXT-SL Objtest | More/Main (Find)08048750: Main ():/HOME/SCZ/SRC/OBJTEST.C:7*/#include #includeintMain (intargcChar*argv[]) {8048750: -Pushl%EBP8048751: theE5 movl%esp,%EBP/HOME/SCZ/SRC/OBJTEST.C:8Execl ("/bin/sh","/bin/sh","- I.",0 );8048753: 6axxPUSHL $0x08048755: theD0 the Geneva ,PUSHL $0x80487d0804875a: theD3 the Geneva ,PUSHL $0x80487d3804875f: theD3 the Geneva ,PUSHL $0x80487d38048764: E8 DB FE FF FF call8048644<_init+0x40>8048769: theC4TenAddl $0x10,%ESP/HOME/SCZ/SRC/OBJTEST.C:9 return 0; 804876c: toC0 Xorl%eax,%Eax804876e:ebGenevajmp8048774 8048770: toC0 Xorl%eax,%eax8048772: EBxxjmp8048774/HOME/SCZ/SRC/OBJTEST.C:Ten}8048774: C9 Leave8048775: C3 ret8048776: -NOP If the above is not clear enough, you can use the following command to help: Objdump-j. TEXT-SL objtest--prefix-addresses |Moreobjdump-j. TEXT-DL Objtest |more with the above different commands to try will get surprise!
Usage of the Objdump command