Valgrind Memcheck-获取???而不是方法名称

问题描述

我正在运行valgrind / memcheck,试图确定导致无法解释的分段错误的潜在内存泄漏。

日志显示???而不是方法名称,因此调用堆栈是无用的。所有代码(库和可执行文件)都使用调试信息进行编译。

示例:

==123100== Conditional jump or move depends on uninitialised value(s)
==123100==    at 0xA7DBD9E: ??? (in /proj/systemc/2.3.2/gcc9.1/lib64/libsystemc-2.3.2.so)
==123100==    by 0xE6E9BE: ??? (in /proj/users/ae/mxx/build/Debug/bin/mxx)
==123100==    by 0xE6DA8E: ??? (in /proj/users/ae/mxx/build/Debug/bin/mxx)
==123100==    by 0x187B22CF: ???
==123100==    by 0x7FEFD40CF: ???
==123100==    by 0xA802BBF: ??? (in /proj/systemc/2.3.2/gcc9.1/lib64/libsystemc-2.3.2.so)
==123100==    by 0xE6C649: ??? (in /proj/users/ae/mxx/build/Debug/bin/mxx)
==123100==    by 0x1893E1A7: ???
==123100==    by 0x187B1E5F: ???
==123100==    by 0x1101: ???
==123100==    by 0x2FBD: ???
==123100==    by 0x1E51001F: ???

valgrind命令为:

valgrind / 3.7.0 / bin / valgrind --tool = memcheck -q --log-file = / proj / users / ae / valgrind.txt --trace-children = no --child-silent-after- fork = yes --run-libc-freeres = yes --demangle = yes --num-callers = 12 --error-limit = no --show-below-main = no --max-stackframe = 2000000 --fullpath -after = --leak-check = yes --show-reachable = no --leak-resolution = high --freelist-vol = 10000000 --workaround-gcc296-bugs = no --partial-loads-ok = no- -undef-value-errors =是/ proj / users / ae / mxx / build / Debug / bin / mxx

谢谢

解决方法

  1. 获取Valgrind的最新版本。 3.7.0很老了。
  2. 严重修剪您正在使用的选项。让该工具正常工作,然后然后考虑添加选项。此外,以下内容
  • -tool = memcheck

  • -trace-children =否

  • -run-libc-freeres =是

  • -demangle =是

  • -show-below-main = no

  • -workaround-gcc296-bugs = no

  • -undef-value-errors = yes

    您正在多余地指定默认值。 (或者至少是当前[3.16.1在编写本文时] Valgrind的默认值)。