2013-11-24 1 views
0

줄 번호가 표시되지 않습니다 :Valgrind의 내가 같이 메이크에 -g 옵션을 추가 한

CFLAGS=-Wall -g 

all: 
     cc hello.c -o hello 
     cc badprog.c -o badprog 

것은 내가 만들어 사용하여 컴파일 할 때 :

cc hello.c -o hello 
cc badprog.c -o badprog 

내가 여기 -g 옵션이 표시 해달라고.

==14412== Conditional jump or move depends on uninitialised value(s) 
==14412== at 0x4E7D665: _itoa_word (_itoa.c:179) 
==14412== by 0x4E81B91: vfprintf (vfprintf.c:1654) 
==14412== by 0x4E880A8: printf (printf.c:34) 
==14412== by 0x400564: main (in /home/anr/Desktop/c programming/badprog) 
==14412== Uninitialised value was created by a stack allocation 
==14412== at 0x40052C: main (in /home/anr/Desktop/c programming/badprog) 
+0

이것은 쓸모없는 "makefile"입니다. 왜 쉘 스크립트를 사용하지 않으시겠습니까? – MadScientist

답변

3

CFLAGS 때문에이 참조되지 않은 : 같은 valgrind --track-origins=yes ./badprog에 대한 결과는 보인다 컴파일 명령에 적용됩니다. Makefile을 다음으로 수정하십시오 :

CFLAGS=-Wall -g 

all: 
     cc hello.c $(CFLAGS) -o hello 
     cc badprog.c $(CFLAGS) -o badprog