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

发布于 2025-01-07 04:02:38 字数 1224 浏览 0 评论 0原文

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

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 形式给出)?

i wrote a very small prog below to add two integers just to check the usage of tracepoints.

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 other 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'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.

Can anyone please let me know why tstatus,tfind and tdump are giving me such an output? What is the issue here? How can i check the value of my trace (which i have given here as $regs) ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最好是你 2025-01-14 04:02:38

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

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

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

相反,您会立即停止实验(使用 tstop),这会导致空跟踪。

why tstatus,tfind and tdump are giving me such an output

When you attach GDB, the inferior (being debugged) process is stopped in _start (i.e. has not reached main yet).

After you start the tracing experiment with tstart, you need to continue execution of the inferior, so it reaches your trace point, and automatically stops the trace (with continue GDB command).

Instead, you are stopping the experiment immediately (with tstop), which leads to empty trace.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文