1

編集: で再インストールしようとしgdbましsudo apt-get autoremove gdbsudo 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
4

1 に答える 1