编辑:我先尝试用sudo apt-get autoremove gdb重新安装gdb,然后再用sudo apt-get install 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和etc函数中的变量):
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发布于 2013-04-30 08:43:44
现在,多亏了gdb7.4,我不得不使用(gdb) skip file malloc.c。
我希望能有其他方法来恢复GDB的功能,这样我就不必手动添加所有标准库的源文件(我尝试过(gdb) skip file stdlib.h只是为了让那些想知道的人知道)。
https://stackoverflow.com/questions/16269016
复制相似问题