debugging - 在 gdb 中的 errno 上设置观察点

标签 debugging gdb libc errno watchpoint

我试图找出 errno 何时更改。

一开始我在gdb中尝试了“watch errno”,导致报错

Cannot find thread-local variables on this target

我能够通过编译“-pthread”来解决这个问题。但是,它仍然不起作用,我现在收到错误
Cannot find shared library `/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.13.so' in dynamic linker's load module list

当我输入“watch errno”时。我需要做什么才能在 errno 上设置观察点?

最佳答案

errno不再只是一个静态变量。以下是 Linux 上用户级应用程序的显示方式(来自我的本地 /usr/include/x86_64-linux-gnu/bits/errno.h):

#   define errno (*__errno_location ())

这是为了获取每个线程的错误状态。

关于debugging - 在 gdb 中的 errno 上设置观察点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10657936/

相关文章:

iOS swift : write print and debug prints into a file

visual-studio - 调试不适用于 docker compose with Visual Studio

c - 使用 gdb 调试 C 预处理器宏中的崩溃

c - 如何找到 RB 树中的最大值

linux - 尽管与存档有直接链接,但对任何 libc 符号的 undefined reference

c - 有时执行外部命令会失败(迟早)

javascript - 我可以在 VS 2012 的 webbrowser 控件中调试 javascript 代码吗

android - 无法将 ndk-gdb 附加到 android 应用程序

GDB 跟踪 : No current trace frame

linux - 我需要来自 glibc 的异步信号安全函数列表