1
我正在尝试GDB跟踪点,但无法获取任何数据。我开始gdbserver的如下:GDB跟踪:无当前跟踪帧
$ 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)
根据我在网络上看到的例子,我应该有一个事件,因为控制越过我的追踪点。任何想法,为什么我没有数据?
按预期在gdbserver控制台上按预期显示printf。我在复制/粘贴中省略了它。 我强迫-O0,它似乎给出了相同的结果。 – simark 2013-05-03 01:53:26
@markys答案更新。 – 2013-05-03 04:15:34
谢谢。我不太了解tfind的含义,我以为你会使用tfind或tdump。不! – simark 2013-05-03 13:39:33