2012-09-07 3 views
1

정의, 그래서 나는 이러한 기능을 구현하는 dylib를 만들었습니다, 나는 일반적인 시스템 바이너리에로드 아니에요. 그러나 버그가 있으며 디버깅하려고합니다.GDB/"malloc_error_break는"나는 malloc에 ​​& 무료에 대한 자세한 내용은 시도하고

  • malloc.dylib은 여기 내 동적 라이브러리

인 GDB 출력입니다 :

(gdb) set env DYLD_INSERT_LIBRARIES malloc.dylib 
(gdb) break malloc_error_break 
Function "malloc_error_break" not defined. 
Make breakpoint pending on future shared library load? (y or [n]) n 
(gdb) r 
Starting program: /bin/ls 
[+] init() 
[-] myMalloc requesting: 4096 bytes 
[-] memory address: 200000 
bash(2035) malloc: *** error for object 0x200000: pointer being freed was not allocated 
*** set a breakpoint in malloc_error_break to debug 

Program terminated with signal SIGABRT, Aborted. 
The program no longer exists. 
(gdb) 

내가 대한 혼란 스러워요하는 메시지

Function "malloc_error_break" not defined. 

내가 시도입니다 그것에 중단 점을 설정합니다. 분명히 알 수 없기 때문에 분명히 깨지는 않을 것입니다.

어떤 도움이 필요합니까? 미리 감사드립니다.

답변

2

malloc_error_break에 중단 점을 설정할 수없는 이유는이 라이브러리가 이 아니고이 아직로드되지 않은 공유 라이브러리에 정의되어 있기 때문입니다.

프로그램을 한 번 실행 한 후에 중단 점을 설정할 수 있어야합니다.

또는 대신 runstart 사용하고, 프로그램이 main에 정지 할 때, 당신은 malloc_error_break에 중단 점을 설정 할 수 있어야한다.

관련 문제