设置跟踪点但无法找到跟踪数据,因为tfind显示“目标无法找到请求的跟踪帧”。

时间:2012-02-17 14:00:20

标签: gdb

我在下面写了一个非常小的编程来添加两个整数来检查跟踪点的使用情况。

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 }       

在一个终端上,我运行gdbserver:

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

在其他终端上,我将gdb运行为:

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

然后执行以下步骤:

(gdb) trace chk.c:6
Tracepoint 1 at 0x80483fd: file chk.c, line 6.

(gdb) passcount 1 1
Setting tracepoint 1's 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.

任何人都可以让我知道为什么tstatus,tfind和tdump给我这样的输出?这是什么问题?我怎样才能检查我的跟踪值(我在这里给出了$ regs)?

1 个答案:

答案 0 :(得分:1)

  

为什么tstatus,tfind和tdump给我这样的输出

当您附加GDB时,劣等(正在调试)的进程在_start中停止(即尚未到达main)。

使用tstart开始跟踪实验后,您需要继续执行下级,因此它会到达您的跟踪点,并自动停止跟踪(使用{{1} } GDB命令)。

相反,您正在立即停止实验(使用continue),这会导致空迹。

相关问题