2013-04-28 3 views
0

편집 : gdbsudo apt-get autoremove gdb으로 다시 설치하고 sudo apt-get install gdb으로 다시 설치하려고했습니다. 그래도 문제가 해결되지 않습니다.GDB 재설정 설정

원래 문제 :

그래서 최근 약 1 시간 전 즉, 나는 메모리 누수를 확인하기 위해 valgrind을 설치하고 지금은 모든 것을 나는, 모든 malloc/calloc 뭔가를 컴파일하고 GDB를 (터미널 또는 Eclipse에서) 실행하려고 명령도 단계별로 디버깅되고 있습니다.

테스트 파일 :

Can't find a source file at "malloc.c" 
Locate the file or edit the source lookup path to include its location. 




을 사용하여 컴파일 : cc -g -o asd a.c
사용 디버깅 된 : gdb asd

#include<stdio.h> 
#include<stdlib.h> 

typedef struct tem{ 
    int i; 
} name; 

int main() { 
    name *t; 
    printf("EASD"); 
    t = malloc(sizeof(name)); 
    return 0; 
} 

이클립스 디버거 오류 (정지의 malloc 등 함수의 변수를 나타낸다)

터미널 : 브레이크 포인트없이

(gdb) run 
Starting program: /home/userName/workspace/as/asd 

Breakpoint 2, main() at a.c:10 
10  t = malloc(sizeof(name)); 
(gdb) step 18442 
Single stepping until exit from function _fini, 
which has no line number information. 
Single stepping until exit from function __do_global_dtors_aux, 
which has no line number information. 
Single stepping until exit from function _fini, 
which has no line number information. 
EASD33 ../sysdeps/unix/sysv/linux/_exit.c: No such file or directory. 
(gdb) step 
[Inferior 1 (process 6621) exited normally] 

GDB :

(gdb) run 
Starting program: /home/userName/workspace/as/asd 
EASD[Inferior 1 (process 6631) exited normally] 

내 질문은, 내가-구성을 다시하는 방법/GDB이가 예전처럼 표준 라이브러리 함수를 통해 건너 뛸 재설정? 다른 컴퓨터에서

:

(gdb) run 
The program being debugged has been started already. 
Start it from the beginning? (y or n) y 
Starting program: /home/userName/a.out a.out 
warning: Could not load shared library symbols for linux-gate.so.1. 
Do you need "set solib-search-path" or "set sysroot"? 
Breakpoint 1, main() at a.c:10 
10  printf("EASD"); 
(gdb) step 
11  t = malloc(sizeof(name)); 
(gdb) step 
12  return 0; 
(gdb) step 
13 } 
(gdb) step 
0xb7e067c3 in __libc_start_main() from /usr/lib/libc.so.6 
+0

당신이 확신 (그냥 알고 싶어하는 사람들을 위해 (gdb) skip file stdlib.h 시도) valgrind와 관련이 있습니까? http://stackoverflow.com/questions/8424211/ignoring-standard-and-boost-library-while-debugging-with-gdb를 참조하십시오. – dbrank0

+0

@ dbrank0 비슷한, 링크 주셔서 감사하지만 거기에 그것이 사용하는 방식으로 작동하는 데 대한 방법이 궁금 해서요. 글자 그대로'valgrind'를 설치했는데 다음으로'GDB'가 작동하기 시작합니다. 나는 'valgrind'를 미리 사용하지 않았지만, 지금부터는 아무런 문제가 보이지 않습니다. 주로 메모리 누수를 확인하는 데 사용하고 있습니다. – SGM1

답변

0

지금은, 내가 GDB 7.4 (gdb) skip file malloc.c 감사를 사용해야합니다.

내가 GDB가해야 할 무엇을 사용 복원 할 수있는 대안을 평가할 것입니다, 그래서 수동으로 수동으로 모든 표준 라이브러리 소스 파일을 추가 할 필요 없다