c++ - 调试c++ : . ./nptl/sysdeps/unix/sysv/linux/raise.c:没有这样的文件或目录

标签 c++ gdb

我正在使用 gdb 来调试 C++ 程序。在行中

assert(prevId ==  GetTagIdFromState(maxState));
  • 参数prevId值为0
  • 方法GetTagIdFromState(maxState) returns 50;

调试时出现以下错误。

Assertion `prevId == GetTagIdFromState(maxState)' failed.
Program received signal SIGABRT, Aborted.
0x00007ffff6ecbba5 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64    ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
      in ../nptl/sysdeps/unix/sysv/linux/raise.c

最佳答案

您的应用程序按预期工作。断言失败(因为您传递给它的值不相等,assert 宏接收 0),因此您的程序被中止。这就是断言的工作原理:

If NDEBUG is not defined, then assert checks if its argument (which must have scalar type) compares equal to zero. If it does, assert outputs implementation-specific diagnostic information on the standard error output and calls std::abort.

强调我的。

检查 this assert reference了解更多信息。

关于c++ - 调试c++ : . ./nptl/sysdeps/unix/sysv/linux/raise.c:没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13152775/

相关文章:

C++ 用单个值填充空缓冲区

c++ - linux:有没有办法找出哪个进程生成了核心文件?

c++ - gdb (armv7) 中的无效转换

c++ - 在 std::move 之后重用 std 容器是否安全?

c++ - 我需要一个框架来使用依赖注入(inject)吗?

c++ - 四元数旋转opengl

linux - 如何让 gdb 从已安装的库中加载符号?

创建编译时变量偏移映射

xcode - 内存地址上的监视点

c++ - unique_ptr 用法 - 类图