simark
simark

Reputation: 510

GDB tracing: No current trace frame

I am trying GDB tracepoints, but I can't get any data. I start gdbserver as following:

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

I then use the following commands on my client:

$ 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)

According to the examples I saw on the web, I should have one event, because control passed over my tracepoint. Any ideas why I get no data?

Upvotes: 5

Views: 442

Answers (1)

Employed Russian
Employed Russian

Reputation: 213829

According to the examples I saw on the web, I should have one event, because control passed over my tracepoint.

You forgot to do tfind start before doing tdump. From help tdump:

Print everything collected at the current tracepoint.

But you are not stopped at any tracepoint, you are stopped at breakpoint#2.

The tfind start selects the first trace frame in the trace buffer.

Upvotes: 1

Related Questions