首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GDB重置配置

GDB重置配置
EN

Stack Overflow用户
提问于 2013-04-29 07:10:09
回答 1查看 1.5K关注 0票数 1

编辑:我先尝试用sudo apt-get autoremove gdb重新安装gdb,然后再用sudo apt-get install gdb重新安装。仍然不能解决问题。

原始问题:

所以最近,也就是大约3个小时前,我安装了valgrind来检查内存泄漏,现在我尝试编译一些东西并运行GDB (终端或在Eclipse中),所有的malloc/calloc命令也都在一步一步地进行调试。

测试文件:

代码语言:javascript
复制
#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函数中的变量):

代码语言:javascript
复制
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进行调试

终端:

代码语言:javascript
复制
(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:

代码语言:javascript
复制
(gdb) run
Starting program: /home/userName/workspace/as/asd 
EASD[Inferior 1 (process 6631) exited normally]

我的问题是,如何重新配置/重置GDB,以便像以前那样跳过标准库函数?

从另一台计算机:

代码语言:javascript
复制
(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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-30 08:43:44

现在,多亏了gdb7.4,我不得不使用(gdb) skip file malloc.c

我希望能有其他方法来恢复GDB的功能,这样我就不必手动添加所有标准库的源文件(我尝试过(gdb) skip file stdlib.h只是为了让那些想知道的人知道)。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16269016

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档