2013-01-03 4 views
4

결과 실행에 Valgrind의 실행하려고 할 때 실제로 실행하기 전에 8 번 실행 나타나는 예상대로 작동하지 않는, automake는 함께 프로젝트를 컴파일 만하고있어 내가 확인하고 싶은 코드 및 코드의 조각을위한 힙 요약이 전혀 표시되지 않습니다 : 표준 메이크 파일로 컴파일 할 때실행 Valgrind의 여러 힙 요약을 출력

==4601== Memcheck, a memory error detector 
==4601== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.                        
==4601== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info                       
==4601== Command: ./launcher -g ../data/params.txt                             
==4601==                                        
==4605==                                        
==4605== HEAP SUMMARY:                                    
==4605==  in use at exit: 0 bytes in 0 blocks                              
==4605== total heap usage: 0 allocs, 0 frees, 0 bytes allocated                         
==4605==                                        
==4605== All heap blocks were freed -- no leaks are possible                           
==4605==                                        
==4605== For counts of detected and suppressed errors, rerun with: -v                        
==4605== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)                        
==4604==                                        
==4604== HEAP SUMMARY:                                    
==4604==  in use at exit: 0 bytes in 0 blocks                              
==4604== total heap usage: 0 allocs, 0 frees, 0 bytes allocated                         
==4604==                                        
==4604== All heap blocks were freed -- no leaks are possible                           
==4604==                                        
==4604== For counts of detected and suppressed errors, rerun with: -v                        
==4604== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)                        
==4606==                                        
==4606== HEAP SUMMARY:                                    
==4606==  in use at exit: 0 bytes in 0 blocks                              
==4606== total heap usage: 0 allocs, 0 frees, 0 bytes allocated                         
==4606==                                        
==4606== All heap blocks were freed -- no leaks are possible                           
==4606==                                        
==4606== For counts of detected and suppressed errors, rerun with: -v                        
==4606== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)                        
==4608==                                        
==4608== HEAP SUMMARY:                                    
==4608==  in use at exit: 0 bytes in 0 blocks                              
==4608== total heap usage: 0 allocs, 0 frees, 0 bytes allocated                         
==4608==                                        
==4608== All heap blocks were freed -- no leaks are possible                           
==4608==                                        
==4608== For counts of detected and suppressed errors, rerun with: -v                        
==4608== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)                        
==4607==                                        
==4607== HEAP SUMMARY:                                    
==4607==  in use at exit: 0 bytes in 0 blocks                              
==4607== total heap usage: 0 allocs, 0 frees, 0 bytes allocated                         
==4607==                                        
==4607== All heap blocks were freed -- no leaks are possible                           
==4607==                                        
==4607== For counts of detected and suppressed errors, rerun with: -v                        
==4607== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)                        
==4610==                                        
==4610== HEAP SUMMARY:                                    
==4610==  in use at exit: 0 bytes in 0 blocks                              
==4610== total heap usage: 0 allocs, 0 frees, 0 bytes allocated                         
==4610==                                        
==4610== All heap blocks were freed -- no leaks are possible                           
==4610==                                        
==4610== For counts of detected and suppressed errors, rerun with: -v                        
==4610== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)                        
==4613==                                        
==4613== HEAP SUMMARY:                                    
==4613==  in use at exit: 0 bytes in 0 blocks                              
==4613== total heap usage: 0 allocs, 0 frees, 0 bytes allocated                         
==4613==                                        
==4613== All heap blocks were freed -- no leaks are possible                           
==4613==                                        
==4613== For counts of detected and suppressed errors, rerun with: -v                        
==4613== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)                        
==4614==                                        
==4614== HEAP SUMMARY:                                    
==4614==  in use at exit: 0 bytes in 0 blocks                              
==4614== total heap usage: 0 allocs, 0 frees, 0 bytes allocated                         
==4614==                                        
==4614== All heap blocks were freed -- no leaks are possible                           
==4614==                                        
==4614== For counts of detected and suppressed errors, rerun with: -v                        
==4614== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)                        
[Program output appears here, nothing appears afterwards] 

이전이 그런 문제 없었다 및 Valgrind의 내가 예상 정확히 표시 할 것 . 내가 디렉토리를 컴파일에 사용하고있어 makefile.am은 다음과 같습니다

lib_LTLIBRARIES = libfile_util.la libmath_util.la libgeneral_util.la libparamlist.la 
libfile_util_la_SOURCES = file_util.c file_util.h 
libmath_util_la_SOURCES = math_util.c math_util.h 
libgeneral_util_la_SOURCES = general_util.c general_util.h 
libparamlist_la_SOURCES = paramlist.c paramlist.h 

bin_PROGRAMS = launcher 
generator_CFLAGS = -I/usr/include/muParser 
generator_SOURCES = generator.c generator.h 
estimator_SOURCES = estimator.c estimator.h 
estimator_iwls_SOURCES = estimator_IWLS.c estimator.h 
estimator_piecewise_SOURCES = estimator_IWLS.c estimator_piecewise.c estimator.h 
estimator_baseline_SOURCES = estimator_IWLS.c estimator_piecewise.c estimator_baseline.c estimator.h 
launcher_CFLAGS = -I/usr/include/muParser 
launcher_SOURCES = launcher.c generator.c estimator.c estimator.h generator.h 
generator_LDADD = libfile_util.la libmath_util.la libgeneral_util.la libparamlist.la 
launcher_LDADD = libfile_util.la libmath_util.la libgeneral_util.la libparamlist.la 
estimator_iwls_LDADD = libfile_util.la libmath_util.la libgeneral_util.la libparamlist.la 
estimator_piecewise_LDADD = libfile_util.la libmath_util.la libgeneral_util.la libparamlist.la 
estimator_baseline_LDADD = libfile_util.la libmath_util.la libgeneral_util.la libparamlist.la 

가 automake는이 파일을 컴파일하는 방식과는이 문제에 무언가인가? 그렇다면 메이크 파일에서 내가 뭘 잘못하고 있니?

+3

나는 당신이 확인되면, 당신이 만들어 진은 실제로 당신이 처음부터 만들고 싶어 바이너리를 실행하는 쉘 스크립트입니다 "런처"생각합니다. libtool이이 작업을 중단하게 만드는 마법의 주문을 기억할 수 없습니다. 그것은 바이너리 "uninstalled"실행과 관련이 있습니다. 바라기를 이것은 바라는 방향으로 당신을 지시한다! –

답변

8

launcher은 libtool 라이브러리를 사용하기 때문에 빌드 디렉토리에있는 파일은 실제 바이너리 (보통은 .libs/에 숨김)를 실행하는 데 필요한 환경 변수를 설정하는 쉘 스크립트입니다. 해당 스크립트에서 valgrind를 실행하면 실제 바이너리가 아니라 스크립트를 실행하는 쉘이 디버깅됩니다.

libtool e valgrind ./launcher -g ../data/params.txt 

이에 상관없이 작동합니다

libtool --mode=execute valgrind ./launcher -g ../data/params.txt 

당신은 심지어로 축약 할 수있다 :

libtool이 바이너리에 valgrind 또는 gdb 같은 어떤 명령을 실행하는 적절한 방법은 libtool 명령을 통해입니다 launcher의 컴파일 방법에 대해 설명합니다.

관련 libtool 설명서는 here입니다.

+0

다른 옵션보다 훨씬 좋은 해결책입니다. – Flexo