huiming
huiming

Reputation: 23

gdb tracepoint's action does not work

trace point can be traced, but trace actions does not work normally. at the last of gdb side below shows trace point is traced. but "collect $regs" does not work as expected.

my platform is RH6.4.

1. gdbserver side.

gdbserver :10000 ./a.out
Process ./a.out created; pid = 10466
Listening on port 10000
Remote debugging from host 127.0.0.1

2. gdb side.

gdb a.out
(gdb) target remote :10000
Remote debugging using :10000
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. 

Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00000033b7000b00 in _start () from /lib64/ld-linux-x86-64.so.2
Created trace state variable $trace_timestamp for target's variable 1.
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.x86_64


(gdb) trace main
Tracepoint 1 at 0x400541: file a.c, line 12.

(gdb) actions 1
collect $regs
end

(gdb) tstart

(gdb) break 15
Breakpoint 2 at 0x40055f: file a.c, line 15.
Breakpoint 2, main (argc=1, argv=0x7fffca819f08) at a.c:18
18              sleep (1);

(gdb) cont
Continuing.

(gdb) tstop
(gdb) tfind
Found trace frame 0, tracepoint 1
12          c    = 2;

Upvotes: 2

Views: 552

Answers (1)

jcm
jcm

Reputation: 2578

I suppose you expected tracepoint to be in actual main declaration line in the source file, am I wrong?

The important part is that it is placed in function's entry point, this is, actually, first function's code line that, looking at the information you provided, it should be c = 2;

On the other hand, this is just a stupid detail, please note that you have no code at line 15 and breakpoint has been set at line 18.

Edit:

According to your comments, you expected tfind to dump all collected registers but you would need an extra step for this: by using tfind with no argument you selected next tracepoint (first one in this case) and, to dump this tracepoint's action collected info, you should call tdump

Upvotes: 1

Related Questions