addr2line && objdump 命令记录

addr2line和objdump都是在Linux分析C/C++问题的利器,Android本质上基于Linux开发,所以自然而然的也能够使用这两个命令来分析一些so的问题。下面对两个命令做个记录,方便日后查询。

addr2line

直接通过man命令来查看addr2line的介绍,介绍如下:

addr2line translates addresses into file names and line numbers. Given an address in an executable or an offset in a section of a relocatable object, it uses the debugging information to figure out which file name and line number are associated with it.

直译过来就是addr2line作用在于将地址转换成文件名字以及代码行数,通过该命令,可以将寄存器的地址转换成对应的行数,方便发现以及改正Native的一些问题,具体使用可以查看该文章。 Android使用需要到ndk寻找对应的cpu架构寻找,如下图:

objdump

man出来描述如下:

objdump displays information about one or more object files. The options control what particular information to display. This information is mostly useful to programmers who are working on the compilation tools, as opposed to programmers who just want their program to compile and work.

objdump主要用于获取对应so的汇编代码,通过该方式能获取到如下效果:

熟悉汇编的可以了解下。

ndk提供的调试工具还有ndk-stack,有兴趣的可以研究下。


总结

转载于:https://my.oschina.net/u/3863980/blog/3001327

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值