c - Valgrind,有可能得到行数吗?

标签 c valgrind

我有 C 语言项目,但是如果我开始检查 valgrind,我会出错

Conditional jump or move depends on uninitialised value(s)
at 0x804B2C3: nameOfMethodC (in ...ap.exe)
by 0x804A62E: nameOfMethodB (in ...ap.exe)
by 0x80493A2: nameOfMethodA (in ...ap.exe)

如何找到这个未初始化的变量?

是否可以获取行号?例如:

Conditional jump or move depends on uninitialised value(s)
at  at 0x804B2C3: nameOfMethodC (in ...file.c on 123 line)
. . . .

对于启动 valgrind 我使用:

valgrind --tool=memcheck ./ap.exe param1 param2

最佳答案

确保 ap.exe 是在启用调试信息并禁用优化的情况下编译的。

关于c - Valgrind,有可能得到行数吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20901065/

相关文章:

c - 按降序输出数组的索引

c++ - 从 std::set 复制到 std::deque- 内存问题

c++ - Valgrind 显示问号

c - 如何在 C/C++ 中的 SWITCH-CASE 结构中使用 do-while 循环从头开始重新启动程序?

c++ - 为什么在使用 MinGW-w64 时 printf 会生成一个额外的函数?

c - 没有 float 或 double 变量的浮点异常

c++ - 抛出异常时 valgrind 出错

linux - Valgrind:无法加载可执行程序的共享库

c - 我在哪里泄漏内存? (Valgrind) 一个 block 中丢失了 24 个字节

c - 这段 C 代码有漏洞吗?