objdump与readelf的区别

objdumpreadelf功能相似,都可以从二进制文件中读取相应的信息并显示,它们的区别在readelf.c中有相关的说明:

/* The difference between readelf and objdump:

 

  Both programs are capable of displaying the contents of ELF format files,

  so why does the binutils project have two file dumpers ?

 

  The reason is that objdump sees an ELF file through a BFD filter of the

  world; if BFD has a bug where, say, it disagrees about a machine constant

  in e_flags, then the odds are good that it will remain internally

  consistent.  The linker sees it the BFD way, objdump sees it the BFD way,

  GAS sees it the BFD way.  There was need for a tool to go find out what

  the file actually says.

 

  This is why the readelf program does not link against the BFD library - it

  exists as an independent program to help verify the correct working of BFD.

 

  There is also the case that readelf can provide more information about an

  ELF file than is provided by objdump.  In particular it can display DWARF

  debugging information which (at the moment) objdump cannot.  */

第一个区别,objdump使用了bfd库进行文件读取,而readelf则没有,另外写的一套代码,且对一些条件的判断并不是很严格。比如对于没有指定处理方式的CPU类型,BFD库将拒绝往下执行,readelf还是可以显示其内容。

第二个区别,readelf可以显示调试信息,而objdump则没有。但是实际上bfd库支持DWARF的处理,通过简单处理objdump也可以显示调试信息,就如同nm做的那样。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值