By setting trace points, but could not find the trace data, because tfind indicates that "Target could not find the requested trace trace."

I wrote a very small program below to add two integers to test the use of breakpoints.

1 #include<stdio.h> 2 main(){ 3 int x,y,sum; 4 x = 3; 5 y = 4; 6 sum = x + y; 7 printf("sum = %d\n",sum); 8 } 

on one terminal, I ran gdbserver as:

 $ gdbserver :10000 ./chk Process ./chk created; pid = 13956 Listening on port 10000 Remote debugging from host 127.0.0.1 

On another terminal, I ran gdb as:

 $ gdb -ex 'target remote :10000' ./chk 

and then the following steps as shown below:

 (gdb) trace chk.c:6 Tracepoint 1 at 0x80483fd: file chk.c, line 6. (gdb) passcount 1 1 Setting tracepoint 1 passcount to 1 (gdb) actions 1 Enter actions for tracepoint 1, one per line. End with a line saying just "end". >collect $regs >end (gdb) tstart (gdb) tstatus Trace is running on the target. Collected 0 trace frames. Trace buffer has 5242880 bytes of 5242880 bytes free (0% full). Trace will stop if GDB disconnects. Not looking at any trace frame. (gdb) tstop (gdb) tfind Target failed to find requested trace frame. (gdb) tdump warning: No current trace frame. 

Can someone please let me know why tstatus, tfind and tdump give me such a way out? What is the problem? How can I check the value of my trace (which I gave here as $ regs)?

+1
source share
1 answer

why tstatus, tfind and tdump give me such a conclusion

When you attach GDB, the lower (debugged) process stops at _start (i.e. has not yet reached main ).

After starting the tracing experiment with tstart you need to continue executing the lower level so that it reaches your trace point and automatically stops tracing (using the continue GDB command).

Instead, you immediately terminate the experiment (with tstop ), which results in an empty trace.

+1
source

Source: https://habr.com/ru/post/1394179/


All Articles