我正在使用 GDB 来调试使用 libpthread 的程序。pthread_create 中发生错误,需要单步执行该函数。不幸的是,当我调试程序时,它没有正确加载共享库符号,因此我无法跳过源代码并有意义地检查程序行为。这是我启动 gdb 后的输出。
Remote debugging using 127.0.0.1:21293
warning: limiting remote suggested packet size (206696 bytes) to 16384
Failed to read a valid object file image from memory.
Run Code Online (Sandbox Code Playgroud)
所以我相信最后一条消息与读取调试符号失败有关。尽管安装了 libc6-dbg 软件包,还是出现这种情况。这是遇到 SIGSEGV 之前的“where”的截断输出(在 pthread_create 中,我想在调试器中检查的函数)
#0 0x68200ce2 in ?? ()
#1 0x68403cbf in ?? ()
#2 0x687571b0 in ?? ()
#3 0x6874c638 in ?? ()
#4 0x68867a72 in ?? ()
....
Run Code Online (Sandbox Code Playgroud)
进程的 /proc/.../maps 显示了 libpthread 映射到内存的位置。
683f8000-68410000 r-xp 00000000 08:01 3017052 /lib/i386-linux-gnu/i686/cmov/libpthread-2.19.so
68410000-68411000 r--p 00017000 08:01 …Run Code Online (Sandbox Code Playgroud)