2013-04-28 115 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只是对于那些谁想要知道)