Debugging disassembled libraries with gdb

后端 未结 1 1665
慢半拍i
慢半拍i 2021-02-08 09:37

in Linux and Mac OS X I can use stepi and nexti to debug an application without debugging information.

On Mac OS X gdb shows the functions that are called inside the li

相关标签:
1条回答
  • 2021-02-08 10:23

    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.
    

    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.

    0 讨论(0)
提交回复
热议问题