gdb能否调试第三方提供的动态链接库(.so文件),对方没有提供任何源码,仅仅提供了so文件

lgmsyy 2014-04-08 02:28:37
gdb能否调试第三方提供的动态链接库(.so文件),对方没有提供任何源码,仅仅提供了so文件
...全文
568 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2014-04-09
  • 打赏
  • 举报
回复
引用 14 楼 zhao4zhong1 的回复:
不知道使用objdump能否反汇编.so中的汇编指令
Usage: objdump <option(s)> <file(s)> Display information from object <file(s)>. At least one of the following switches must be given: -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 -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[lLiaprmfFsoR] or --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=str,=loc,=Ranges] 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
www_adintr_com 2014-04-09
  • 打赏
  • 举报
回复
在编译你的测试程序的时候加 -lpthread 选项试试呢, 能否把你的 .so 文件传上来看看
赵4老师 2014-04-09
  • 打赏
  • 举报
回复
不知道使用objdump能否反汇编.so中的汇编指令
lgmsyy 2014-04-09
  • 打赏
  • 举报
回复
还有能提供线索的没
lgmsyy 2014-04-08
  • 打赏
  • 举报
回复
set step-mode on gdb file c.out b 15 r layout asm 然后进行了以下si动作,得出: 0x0000000000400760 in dlopen@plt () (gdb) si 0x0000000000400766 in dlopen@plt () (gdb) si 0x000000000040076b in dlopen@plt () (gdb) si 0x00000000004006d0 in ?? () (gdb) si 0x00000000004006d6 in ?? () (gdb) 这些信息怎么看啊????
引用 11 楼 zhao4zhong1 的回复:
set step-mode on 打开step-mode模式。在进行单步跟踪时,程序不会因为没有debug信息而不停住。这个参数有很利于查看机器码。 还有一个命令(disassemble)可以查看源程序的当前执行时的机器码,这个命令会把目前内存中的指令dump出来。如下面的示例表示查看函数func的汇编代码:
赵4老师 2014-04-08
  • 打赏
  • 举报
回复 1
set step-mode on 打开step-mode模式。在进行单步跟踪时,程序不会因为没有debug信息而不停住。这个参数有很利于查看机器码。 还有一个命令(disassemble)可以查看源程序的当前执行时的机器码,这个命令会把目前内存中的指令dump出来。如下面的示例表示查看函数func的汇编代码:
lgmsyy 2014-04-08
  • 打赏
  • 举报
回复
引用 9 楼 zhao4zhong1 的回复:
[quote=引用 6 楼 zhao4zhong1 的回复:] layout asm:显示反汇编窗口
在反汇编窗口中单步执行下条汇编指令。[/quote] 类似些: (gdb) si si 0x0000000000400766 in dlopen@plt () (gdb) si si 0x000000000040076b in dlopen@plt () (gdb) si si 0x00000000004006d0 in ?? () (gdb) 这也看不明白啊。
赵4老师 2014-04-08
  • 打赏
  • 举报
回复
引用 6 楼 zhao4zhong1 的回复:
layout asm:显示反汇编窗口
在反汇编窗口中单步执行下条汇编指令。
lgmsyy 2014-04-08
  • 打赏
  • 举报
回复
引用 6 楼 zhao4zhong1 的回复:
layout asm:显示反汇编窗口
void *imglib = dlopen("./libLGM.so", RTLD_LAZY);//第三方提供的动态链接库 一到调用第三方库的时候就提示以下: Breakpoint 1 at 0x4008af: file c.c, line 9. (gdb) r Starting program: /home/pcd/workspace/myjava/jni/c Breakpoint 1, main (argc=1, argv=0x7fffffffe1a8) at c.c:13 (gdb) s [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Cannot find new threads: generic error (gdb)
lgmsyy 2014-04-08
  • 打赏
  • 举报
回复
void *imglib = dlopen("./libLGM.so", RTLD_LAZY);//第三方提供的动态链接库 一到调用第三方库的时候就提示以下: Breakpoint 1 at 0x4008af: file c.c, line 9. (gdb) r Starting program: /home/pcd/workspace/myjava/jni/c Breakpoint 1, main (argc=1, argv=0x7fffffffe1a8) at c.c:13 (gdb) s [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Cannot find new threads: generic error (gdb)
赵4老师 2014-04-08
  • 打赏
  • 举报
回复
layout asm:显示反汇编窗口
赵4老师 2014-04-08
  • 打赏
  • 举报
回复
layout regs:显示源代码/反汇编和CPU寄存器窗口
赵4老师 2014-04-08
  • 打赏
  • 举报
回复
调试对应汇编指令。
lgmsyy 2014-04-08
  • 打赏
  • 举报
回复
引用 1 楼 buyong 的回复:
readelf能看函数名 可以反汇编
readelf libTest.so???具体怎么查看?
max_min_ 2014-04-08
  • 打赏
  • 举报
回复
这个需要看看编译的时候没有加 -g选项了,没有话,只是一些地址吧!
buyong 2014-04-08
  • 打赏
  • 举报
回复
readelf能看函数名 可以反汇编

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧