2012-09-12 6 views
9
valgrind --leak-check=full ./CH02_HelloTriangle 
==11404== Memcheck, a memory error detector 
==11404== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. 
==11404== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info 
==11404== Command: ./CH02_HelloTriangle 
==11404== 
==11404== Jump to the invalid address stated on the next line 
==11404== at 0x0: ??? 
==11404== by 0x6F9271A: ??? (in /usr/lib/fglrx/dri/fglrx_dri.so) 
==11404== Address 0x0 is not stack'd, malloc'd or (recently) free'd 
==11404== 
==11404== 
==11404== Process terminating with default action of signal 11 (SIGSEGV) 
==11404== Bad permissions for mapped region at address 0x0 
==11404== at 0x0: ??? 
==11404== by 0x6F9271A: ??? (in /usr/lib/fglrx/dri/fglrx_dri.so) 
==11404== 
==11404== HEAP SUMMARY: 
==11404==  in use at exit: 144,423 bytes in 407 blocks 
==11404== total heap usage: 1,009 allocs, 602 frees, 189,993 bytes allocated 
==11404== 
==11404== LEAK SUMMARY: 
==11404== definitely lost: 0 bytes in 0 blocks 
==11404== indirectly lost: 0 bytes in 0 blocks 
==11404==  possibly lost: 0 bytes in 0 blocks 
==11404== still reachable: 144,423 bytes in 407 blocks 
==11404==   suppressed: 0 bytes in 0 blocks 
==11404== Reachable blocks (those to which a pointer was found) are not shown. 
==11404== To see them, rerun with: --leak-check=full --show-reachable=yes 
==11404== 
==11404== For counts of detected and suppressed errors, rerun with: -v 
==11404== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2) 
Segmentation fault (core dumped) 

정확히 무엇이 문제입니까?valgrind는 "잘못된 주소로 이동"하여 무슨 뜻입니까?

이 응용 프로그램을 실행하면 세그먼트 화 오류 오류로 종료됩니다. 데스크톱 용 AMD GLES SDK로 컴파일 된 OpenGL ES 2.0 응용 프로그램입니다.

This the source

+0

일반적인 디버거에서만 실행 해 보셨습니까? 이것은 메모리 누수처럼 보이지 않지만, 어떤 종류의 널 포인터 예외와 같이, Valgrind가 NPE 디버깅에 적합한 도구인지 확실하지 않습니다. – Tim

+0

@Tim이 OpenGL ES 라이브러리의 디버그 버전이 없으며 디버그 라이브러리없이 사용할 수있는 다른 도구에 대해 잘 모릅니다. – Ken

+0

OGLES 라이브러리를 디버깅 할 필요가 있다고 생각하지 않지만, 호출하는 응용 프로그램이 API 호출에 Null 값을 전달하지 않는지 확인하십시오. 특정 언어에서 사용하는 IDE에 관계없이 코드를 단계별로 실행할 수 있습니다. – Tim

답변

9

/usr/lib/fglrx/dri/fglrx_dri.so의 코드가 null 함수 포인터를 통해 점프하고 있습니다.

물론 진짜 질문은 이유가 있지만, 독점적 인 폐쇄 형 소스 코드이므로 쉽게 찾을 방법이 없습니다. 함수 포인터를 콜백으로 사용하는 코드에서 함수를 호출하는 경우 null 포인터를 전달하지 않았는지 확인하는 것이 좋습니다.

기본적으로 valgrind가 내가 두려워한다는 것을 알게 될 것 같은 문제는 아니지만 확실히 메모리 누출과 관련이 없습니다.

관련 문제