Jos*_*vin 2 ubuntu gdb errno shared-libraries libc
在调试我的应用程序时,如果我在GDB中断并尝试打印errno,甚至从检查errno的函数内部,我从GDB获得以下错误:
(gdb) print errno
Cannot find shared library `/usr/lib/debug/lib/libc-2.11.1.so' in dynamic linker's load module list
Run Code Online (Sandbox Code Playgroud)
我试过的事情:
该应用程序似乎运行正常,所以我无法想象libc本身搞砸了.有任何想法吗?
Emp*_*ian 10
该文件/usr/lib/debug/lib/libc-2.11.1.so
并没有包含的glibc的调试版本.它包含了只有 libc中的调试部分,但没有实际的可执行代码.付诸LD_PRELOAD
或者LD_LIBRARY_PATH
是错误的事情.不要那样做.
您可以在此处阅读单独的调试文件.
(gdb)print errno
在动态链接器的加载模块列表中找不到共享库`/usr/lib/debug/lib/libc-2.11.1.so'
这是GDB中的一个小问题.
您应该知道GDB将查找变量errno
,但您的应用程序不使用任何此类变量.相反,errno
是一个#define
d宏,它扩展为*(__errno_location())
,而GDB不知道这一点.
试试这个:
(gdb) p __errno_location()
$1 = (int *) 0x7ffff78396a8
(gdb) x/x $1
0x7ffff78396a8: 0x00000000
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3527 次 |
最近记录: |