objdump 分析

objdump -H 显示如下:

一般常用的是

objdump -x 显示文件头信息

objdump -d 反汇编代码段代码

objdump -D 反汇编所有代码

  

用法:objdump <选项> <文件>
 显示来自目标 <文件> 的信息。
 至少必须给出以下选项之一:
  -a, --archive-headers    Display archive header information
  -f, --file-headers       Display the contents of the overall file header
  -p, --private-headers    Display object format specific file header contents
  -P, --private=OPT,OPT... Display object format specific contents
  -h, --[section-]headers  Display the contents of the section headers
  -x, --all-headers        Display the contents of all headers          显示头信息
  -d, --disassemble        Display assembler contents of executable sections  显示代码段代码
  -D, --disassemble-all    Display assembler contents of all sections      显示所有段代码
  -S, --source             Intermix source code with disassembly        
  -s, --full-contents      Display the full contents of all sections requested   
  -g, --debugging          Display debug information in object file
  -e, --debugging-tags     Display debug information using ctags style
  -G, --stabs              Display (in raw form) any STABS info in the file
  -W[lLiaprmfFsoRt] or
  --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,
          =frames-interp,=str,=loc,=Ranges,=pubtypes,
          =gdb_index,=trace_info,=trace_abbrev,=trace_aranges,
          =addr,=cu_index]
                           Display DWARF info in the file
  -t, --syms               Display the contents of the symbol table(s)
  -T, --dynamic-syms       Display the contents of the dynamic symbol table
  -r, --reloc              Display the relocation entries in the file
  -R, --dynamic-reloc      Display the dynamic relocation entries in the file
  @<file>                  Read options from <file>
  -v, --version            Display this program‘s version number
  -i, --info               List object formats and architectures supported
  -H, --help               Display this information

 以下选项是可选的:
  -b, --target=BFDNAME           将标的目标文件格式指定为 BFDNAME
  -m, --architecture=MACHINE     将标的体系结构指定为 MACHINE
  -j, --section=NAME             只显示 NAME 节的信息
  -M, --disassembler-options=OPT 将文本传递到 OPT 反汇编程序
  -EB --endian=big               反汇编时假定高位字节在前
  -EL --endian=little            反汇编时假定低位字节在前
      --file-start-context       从文件的起点引入上下文 (带有 -S)
  -l, --line-numbers             在输出中给出行号和文件名
  -C, --demangle[=STYLE]         对修饰过的 (mangled) 符号名进行解码
                                  如果给出了 STYLE,STYLE 可能为“auto”、“gnu”、
                                 “lucid”、“arm”、“hp”、“edg”或“gnu-new-abi”
  -w, --wide                     以多于 80 列的宽度对输出进行格式化
  -z, --disassemble-zeroes       反汇编时不要跳过为零的块
      --start-address=ADDR       只有进程数据的地址 >= ADDR
      --stop-address=ADDR        只有进程数据的地址 <= ADDR
      --prefix-addresses         同反汇编代码并列显示完整的地址
      --[no-]show-raw-insn       同符号反汇编并列显示十六进制值
      --adjust-vma=OFFSET        为所有显示的节地址增加 OFFSET

      --dwarf-depth=N        Do not display DIEs at depth N or greater
      --dwarf-start=N        Display DIEs starting with N, at the same depth
                             or deeper
      --dwarf-check          Make additional dwarf internal consistency checks.      

objdump:支持的目标: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
objdump:支持的体系结构: i386 i386:x86-64 i386:x64-32 i8086 i386:intel i386:x86-64:intel i386:x64-32:intel i386:nacl i386:x86-64:nacl i386:x64-32:nacl iamcu iamcu:intel l1om l1om:intel k1om k1om:intel plugin

下列 i386/x86-64 特定的反汇编器选项在使用 -M 开关时可用(使用逗号分隔多个选项):
  x86-64      Disassemble in 64bit mode
  i386        Disassemble in 32bit mode
  i8086       在 16 位模式下反汇编
  att         用 AT&T 语法显示指令
  intel       用 Intel 语法显示指令
  att-mnemonic
              Display instruction in AT&T mnemonic
  intel-mnemonic
              Display instruction in Intel mnemonic
  addr64      假定 64 位地址大小
  addr32      假定 32 位地址大小
  addr16      假定 16 位地址大小
  data32      假定 32 位数据大小
  data16      假定 16 位数据大小
  suffix      在 AT&T 语法中始终显示指令后缀
  amd64       Display instruction in AMD64 ISA
  intel64     Display instruction in Intel64 ISA
时间: 2024-08-26 23:52:34

objdump 分析的相关文章

Linux/Windows 实用工具简记

以下只是开发中可能用的比较多的工具,另外还有其他很多未曾提及的实用工具.Linux篇: 1.链接过程的调试:主要用于查看构建过程:如链接时加载的动态库以及运行时加载动态库过程的调试 支持LD_DEBUG环境变量(glibc下提供给加载器便于调试的一个环境变量): 常用的使用方法: LD_DEBUG=help XXX XXX可为任意字符串,即可调出帮助信息: LD_DEBUG=libs xxx xxx为可执行二进制文件,显示所依赖库的文件路径: 此外还可以显示重定位.符号表.依赖库版本匹配信息等:

在 Windows 下用 TDM-GCC(MinGW)开发 DLL 涉及到数据同步锁及 DLL 初始化终止化函数的问题

在 Windows 下用 TDM-GCC(MinGW)开发 DLL 如果要用到数据同步锁,理论上可以采用 Windows API 提供的临界区实现(需要用到的函数有 InitializeCriticalSection.DeleteCriticalSection.EnterCriticalSection.LeaveCriticalSection),也可以采用 GCC 的 pthread 库中的 pthread mutex lock 互斥锁来实现(需要用到的函数有 pthread_mutex_ini

OBJ文件格式分析工具: objdump, nm,ar

首先简要阐述关于gcc.glibc和 binutils模块之间的关系 一.关于gcc.glibc和binutils模块之间的关系 1.gcc(gnu collect compiler)是一组编译工具的总称.它主要完成的工作任务是"预处理"和"编译",以及提供了与编译器紧密相关的运行库的支持,如 libgcc_s.so.libstdc++.so等. 2.binutils提供了一系列用来创建.管理和维护二进制目标文件的工具程序,如汇编(as).连接(ld).静态库归档(

U-Boot移植之前期分析(上)

老是看别人移植uboot,用别人移植好的uboot,今天终于下定决心自己移植一个uboot来玩玩,好歹我也是个软件开发人员啊. 第一步:去ftp://ftp.denx.de/pub/u-boot/网站下载个uboot工程源码,为了防止环境出问题,我决定用个老一点的,于是就下了:u-boot-1.1.6.tar.bz2. 第二步:解压源码:tar  jxvf  u-boot-1.1.6.tar.bz2. 第三步:建立source insight工程 好了完成以上三步之后,我们需要的前提条件都准备好

libjohn hook系统函数导致的NE问题分析

一段时间,发现某个机型上一些系统级APP高概率出现NE,现场如下: pid: 20335, tid: 20335, name: m.xxx.market >>> com.xxx.market <<< signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000140 r0 75bf67f8 r1 bec44e10 r2 41526558 r3 00000000 r4 41524fa8 r5 00000000 r6

ELF文件格式分析

一般的 ELF 文件包括三个索引表:ELF  header,Program  header  table,Section header table. 1)ELF  header:在文件的开始,保存了路线图,描述了该文件的组织情况. 2)Program  header  table:告诉系统如何创建进程映像.用来构造进程映像的目标文件必须具有程序头部表,可重定位文件不需要这个表. 3)Section  header  table :包含了描述文件节区的信息,每个节区在表中都有一项,每一项给出诸如节

分析函数调用关系图(call graph)的几种方法

分析函数调用关系图(call graph)的几种方法 绘制函数调用关系图对理解大型程序大有帮助.我想大家都有过一边读源码(并在头脑中维护一个调用栈),一边在纸上画函数调用关系,然后整理成图的经历.如果运气好一点,借助调试器的单步跟踪功能和call stack窗口,能节约一些脑力.不过如果要分析的是脚本语言的代码,那多半只好老老实实用第一种方法了.如果在读代码之前,手边就有一份调用图,岂不妙哉?下面举出我知道的几种免费的分析C/C++函数调用关系的工具. 函数调用关系图(call graph)是图

MIT OS lab Makefile 分析

lab1 中的Makefile主要是根目录下的GNUMakefile, kern/Makefrag, boot/Makefrag, 后两者通过include直接包含到GNUMakefile中. 1 # 2 # This makefile system follows the structuring conventions 3 # recommended by Peter Miller in his excellent paper: 4 # 5 # Recursive Make Considere

ELF格式的重定位原理分析

前面有篇文章分析了ELF格式,也只是让我们对目标文件有了一个大概的了解,并没有说明一个十分重要的问题:重定位,今天重新看了下重定位的资料,终于弄懂了重定位的过程,下面来做一个分析. 我们将使用下面两个源代码中的文件a.c和b.c展开分析: //a.c extern int shared; int main() { int a=100; swap(&a,&shared); } //b.c int shared=1; void swap(int *a,int *b) { *a^=*b^=*a^