问题描述
在Linux和Mac OS X,我可以使用STEPI和nexti无调试信息的调试应用程序。
in Linux and Mac OS X I can use stepi and nexti to debug an application without debugging information.
在Mac OS X上的gdb显示,被称为库中的函数,虽然有时前进中的每个指令STEPI几个汇编指令。
On Mac OS X gdb shows the functions that are called inside the library, although sometimes advancing several assembler instructions in each stepi instruction.
在Linux上,当我步入一个动态库GDB丢失。例如,与看跌期权()里面有看跌期权()三个汇编指令,一旦达到GDB在0x080482bf跳跃时,出现消息无功能包含程序计数器选择框。
On Linux, when I step into a dynamic library gdb gets lost. For instance, with puts() there are three assembler instructions inside puts(), once gdb reaches the jump at 0x080482bf, it fails with the message "No function contains program counter for selected frame".
0x080482ba in puts@plt ()
(gdb) disassemble
Dump of assembler code for function puts@plt:
0x080482b4 <puts@plt+0>: jmp *0x8049580
0x080482ba <puts@plt+6>: push $0x10
0x080482bf <puts@plt+11>: jmp 0x8048284 <_init+48>
End of assembler dump.
(gdb) stepi
0x080482bf in puts@plt ()
(gdb) stepi
0x08048284 in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
你知道如何调试这些库调用使用gdb。
Do you know how to debug these library calls with gdb.
推荐答案
如果GDB没有为您试图调试功能调试符号,GDB将不能够确定的内存地址范围拆卸。要解决这个问题,你可以通过范围到拆卸
命令。例如:
If GDB does not have debug symbols for the function you are trying to debug, GDB will not be able to determine the range of memory addresses to disassemble. To work around this, you can pass the range into the disassemble
command. For example:
(gdb) p $pc
$4 = (void (*)()) 0x70c72d <_IO_puts+29>
(gdb) disassemble 0x70c72d 0x70c740
Dump of assembler code from 0x70c72d to 0x70c740:
0x0070c72d <_IO_puts+29>: mov %eax,(%esp)
0x0070c730 <_IO_puts+32>: call 0x721f10 <strlen>
0x0070c735 <_IO_puts+37>: mov 0x84c(%ebx),%edx
0x0070c73b <_IO_puts+43>: cmpw $0x0,(%edx)
0x0070c73f <_IO_puts+47>: mov %edx,-0x10(%ebp)
End of assembler dump.
有可能安装调试符号的方法。在我的Ubuntu系统,我装包的libc6-DBG
,这让我步入函数的标准库。
There may be a way to install debug symbols. On my Ubuntu system, I installed the package libc6-dbg
, which allows me to step into functions in the standard library.
这篇关于用GDB进行调试拆解库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!