2013-04-28 83 views
0

編輯: 我試圖重新安裝gdbsudo apt-get autoremove gdb然後sudo apt-get install gdb。仍然不能解決問題。GDB重置配置

原來的問題:

所以最近,這意味着約3小時前,我安裝了valgrind檢查內存泄漏和現在的一切,我嘗試編譯的東西和運行GDB(終端或在Eclipse),所有malloc/calloc命令也逐步被調試。

測試文件:

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

typedef struct tem{ 
    int i; 
} name; 

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

Eclipse調試器錯誤(仍顯示在malloc和等功能變量):

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

終端:

(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

你確定這與valgrind有關?請參閱http://stackoverflow.com/questions/8424211/ignoring-standard-and-boost-libraries-while-debugging-with-gdb。 – dbrank0 2013-04-29 07:33:58

+0

@ dbrank0類似的,感謝您的鏈接,但我想知道是否有一種方式讓它像過去那樣工作。從字面上我安裝了'valgrind',接下來我知道'GDB'開始工作了。我沒有事先使用'valgrind',但是我沒有看到任何問題(現在)。我使用它來主要檢查內存泄漏。 – SGM1 2013-04-29 17:04:17

回答

0

現在,我不得不使用(gdb) skip file malloc.c感謝GDB 7.4。

我將不勝感激任何替代恢復一下GDB用來做什麼,所以我不必手動手動添加所有的標準庫的源文件(我試過(gdb) skip file stdlib.h只是對於那些誰想要知道)