我正在关注'学习C艰难之路',特别是关于Valgrind的章节.本章给出了一个故意错误的程序来展示Valgrind的工作原理.
当我在Valgrind下运行练习时,我没有在我的堆栈跟踪中获得行号,只是'(在主要下面)'的错误.
我肯定用-g标志编译.
我的Valgrind输出如下:
djb@twin:~/projects/Learning/C$ valgrind ./ex4
==5190== Memcheck, a memory error detector
==5190== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==5190== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==5190== Command: ./ex4
==5190== 
==5190== Use of uninitialised value of size 4
==5190==    at 0x4078B2B: _itoa_word (_itoa.c:195)
==5190==    by 0x407CE55: vfprintf (vfprintf.c:1619)
==5190==    by 0x40831DE: printf (printf.c:35)
==5190==    by 0x4052112: (below main) (libc-start.c:226)
==5190== 
==5190== Conditional jump or move depends …我有libstdc ++和libc等的调试版本,并且想链接它们。它们位于/ usr / lib / debug而不是/ usr / lib。有任何想法吗?