用xx-objdump来查看binary的信息,尤其是调试信息
这几天,一直在研究mips仿真器为什么不能源码级别调试汇编代码,
一直再看 vmlinux的debug symbol的相关的东西 ,特此做一些备忘录。
尤其是 一些objdump的选项。
又深入研究了下ELF的东西。
ELF太重要了。
以下都是vmlinux和head.o为例的。
1,看起来,每个版本的objdump的支持都不一样的。
至少输出的选项也是不一样的。
当然最有用就是:
-D :反汇编所有的sections
-d :反汇编executable sections
-S :混合显示汇编代码和原始代码,太有用了******
-t :显示调试信息,尤其是可以显示出行号和文件名和路径(配合-l)
-l, --line-numbersInclude line numbers and filenames in output
下面就是endian的选择了
-EB --endian=bigAssume big endian format when disassembling
-EL --endian=littleAssume little endian format when disassembling
下面输出的elf32-tradbigmips是支持的平台
[bob@localhost linux-2.6.20.9]$ /home/bob/gcc-3.2.2-uClibc-0.9.19/mips-linux/bin/mips-linux-objdump
-b
/home/bob/gcc-3.2.2-uClibc-0.9.19/mips-linux/bin/mips-linux-objdump: option requires an argument --
b
Usage: /home/bob/gcc-3.2.2-uClibc-0.9.19/mips-linux/bin/mips-linux-objdump
Display information from object .
At least one of the following switches must be given:
-a, --archive-headersDisplay archive header information
-f, --file-headersDisplay the contents of the overall file header
-p, --private-headersDisplay object format specific file header contents
-h, --[section-]headersDisplay the contents of the section headers
-x, --all-headersDisplay the contents of all headers
-d, --disassembleDisplay assembler contents of executable sections
-D, --disassemble-allDisplay assembler contents of all sections
-S, --sourceIntermix source code with disassembly
-s, --full-contentsDisplay the full contents of all sections requested
-g, --debuggingDisplay debug information in object file
-G, --stabsDisplay (in raw form) any STABS info in the file
-t, --symsDisplay the contents of the symbol table(s)
-T, --dynamic-symsDisplay the contents of the dynamic symbol table
-r, --relocDisplay the relocation entries in the file
-R, --dynamic-relocDisplay the dynamic relocation entries in the file
-v, --versionDisplay this program's version number
-i, --infoList object formats and architectures supported
-H, --helpDisplay this information
The following switches are optional:
-b, --target=BFDNAMESpecify the target object format as BFDNAME
-m, --architecture=MACHINESpecify the target architecture as MACHINE
-j, --section=NAMEOnly display information for section NAME
-M, --disassembler-options=OPT Pass text OPT on to the disassembler<