【问题标题】:Valgrind not showing line numbersValgrind 不显示行号
【发布时间】:2015-04-06 23:53:17
【问题描述】:

我已经阅读了无数关于此的问题,但没有一个答案有帮助。

由于代码太多,我无法发布我的代码,但我会提供我的 makefile 行和 valgrind 信息。

我正在使用gcc -std=c99 -Wall src/main.c src/filein.c src/make_game.c -g -O0 -Iinclude -o bin/rogue -lncurses进行编译。

我用这个运行 valgrind:valgrind --leak-check=full /home/pi/rogue/rogue/bin/rogue assets/room.txt

我的输出:

==2939== Memcheck, a memory error detector
==2939== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==2939== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==2939== Command: /home/pi/rogue/rogue/bin/rogue assets/room.txt
==2939== 
==2939== 
==2939== HEAP SUMMARY:
==2939==     in use at exit: 117,855 bytes in 197 blocks
==2939==   total heap usage: 306 allocs, 109 frees, 121,129 bytes allocated
==2939== 
==2939== 900 bytes in 6 blocks are definitely lost in loss record 1 of 4
==2939==    at 0x4835978: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==2939== 
==2939== LEAK SUMMARY:
==2939==    definitely lost: 900 bytes in 6 blocks
==2939==    indirectly lost: 0 bytes in 0 blocks
==2939==      possibly lost: 0 bytes in 0 blocks
==2939==    still reachable: 116,955 bytes in 191 blocks
==2939==         suppressed: 0 bytes in 0 blocks
==2939== Reachable blocks (those to which a pointer was found) are not shown.
==2939== To see them, rerun with: --leak-check=full --show-reachable=yes
==2939== 
==2939== For counts of detected and suppressed errors, rerun with: -v
==2939== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 19 from 6)

这个输出对我没有任何帮助,如果有人可以提供帮助,我将不胜感激。

【问题讨论】:

    标签: c line valgrind


    【解决方案1】:

    您的输出并没有显示行号的问题,而是整个回溯太短了,因为它只显示malloc()函数而不是调用者.

    您可以尝试使用更新的 Valgrind 版本。您的版本 (3.7.0) 已经有几年的历史了,同时在 ARM 系统上的回溯也有所改进。

    【讨论】:

    • 我在我的 pi 上运行这个 Valgrind,我该如何更新它?当我尝试用apt-get 升级它时,我被告知我有最新版本。
    • 针对上述情况,我尝试通过从源代码安装来安装 valgrind,但显然不支持我的架构。我不能在我的 Pi 和我的 Mac 上使用 Valgrind...太好了。
    猜你喜欢
    • 2013-04-09
    • 2018-05-22
    • 2015-08-30
    • 1970-01-01
    • 1970-01-01
    • 2012-11-17
    • 2023-03-10
    相关资源
    最近更新 更多