Linux so库查看工具

代码运行过程中,难免因各种原因引起crash,如果crash 发生时恰好capture 当时的堆栈信息,对定位错误将是大功一件,然而有时候看到满满的堆栈信息,却不知从何开始入手, 本文介绍几个著名的Linux so 查看工具,掌握它们可能会有事半功倍的效果。

比如获取下列信息:
tm::TcpHandler::Open(tm::iohandler_paraset*)+300
这里已经比较明确指出在Open 函数地址偏移 300 的地方, 那么是否可以获得更详细的信息呢?

Linux so库查看工具:

  • objdump

objdump可用来反汇编so库,查看文件可能带有的附加信息。 详细使用时通过 –help 了解,常用参数有:

-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
  • nm

nm用来列出目标文件的符号清单。详细使用时通过 –help 了解,常用参数有:

-a, --debug-syms       Display debugger-only symbols
-l, --line-numbers     Use debugging information to find a filename and line number for each symbol
  • add2line

add2line 将指令的地址和可执行映像转换成文件名、函数名和源代码行数的工具。详细使用时通过 –help 了解。

-a --addresses         Show addresses
-b --target=<bfdname>  Set the binary file format
-e --exe=<executable>  Set the input file name (default is a.out)
-f --functions         Show function names
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值