2

我正在尝试 GDB 跟踪点,但我无法获得任何数据。我按以下方式启动 gdbserver:

$ gdbserver :1234 ./a.out 
Process ./a.out created; pid = 13610
Listening on port 1234

然后我在我的客户端上使用以下命令:

$ gdb ./a.out
...
Reading symbols from /home/simark/src/test/a.out...done.
(gdb) target remote :1234
Remote debugging using :1234
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Reading symbols from /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.15.so...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00007ffff7ddb6c0 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) l
1   #include <stdio.h>
2   int foo(int a, int b) {
3       return a + b + b;
4   }
5   
6   int main() {
7       int n = foo(33, 4);
8       printf("%d\n", n);
9       return 0;
10  }
(gdb) trace 3
Tracepoint 1 at 0x400526: file test.c, line 3.
(gdb) b 9
Breakpoint 2 at 0x400563: file test.c, line 9.
(gdb) actions 1
Enter actions for tracepoint 1, one per line.
End with a line saying just "end".
>collect $regs,$args
>end
(gdb) tstart
(gdb) c
Continuing.

Breakpoint 2, main () at test.c:9
9       return 0;
(gdb) tstop
(gdb) tdump
warning: No current trace frame.
(gdb)

根据我在网上看到的例子,我应该有一个事件,因为控制通过了我的跟踪点。任何想法为什么我没有得到数据?

4

1 回答 1

1

根据我在网上看到的例子,我应该有一个事件,因为控制通过了我的跟踪点。

你忘了做tfind start之前做tdump。来自help tdump

Print everything collected at the current tracepoint.

但是您不会在任何跟踪点处停止,而是在断点#2 处停止。

选择跟踪缓冲区中的tfind start第一个跟踪帧。

于 2013-05-02T22:51:16.660 回答