Tracepoint 在 gdb 中不起作用,并且显示“Trace 只能在远程目标上运行”

发布于 2025-01-02 05:04:14 字数 532 浏览 0 评论 0原文

我想使用跟踪点在我拥有完全访问权限的本地计算机上调试程序。我能够设置跟踪点及其passcount,并使用 info tr 给我

(gdb) info tr

Num Enb Address PassC StepC What

1 y 0x080b7529 2 0 in search_tcp at tcp_pkt.c:412

跟踪点 1 的操作: 收集流量 然后

我运行 prog,它照常运行,最后当我给 tfind 或 tdump 来收集所需的数据时,它显示:

(gdb) tfind 1

Trace 只能在远程目标上运行。

(gdb) tdump

Trace 只能在远程目标上运行。

即使我尝试使用“tstart”,但它再次显示“跟踪只能在远程目标上运行”。

知道这条消息的含义吗?目前不支持tracepoing 使用吗?或者是为了通过 LAN 或其他网络调试某些远程计算机? 任何帮助将不胜感激。

谢谢 维卡斯

I want to use tracepoints to debug a prog on a local machine where i have full access. I am able to set the tracepoint and its passcount and using info tr gives me

(gdb) info tr

Num Enb Address PassC StepC What

1 y 0x080b7529 2 0 in search_tcp at tcp_pkt.c:412

Actions for tracepoint 1:
collect flow
end

Then i run the prog, it runs as usual and in the end when i give tfind or tdump to collect the required data it shows:

(gdb) tfind 1

Trace can only be run on remote targets.

(gdb) tdump

Trace can only be run on remote targets.

Even i tried using "tstart" but it shows again "Trace can only be run on remote targets."

Any idea on what is the meaning of this message ? Is tracepoing usage not supported currently ? OR is it for debugging some remote machine over LAN or some other network ?
Any help would be greatly appreciated.

thanks
vikas

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

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

发布评论

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

评论(1

玻璃人 2025-01-09 05:04:14

知道这条消息的含义吗?

其含义正是消息所说的:跟踪点工具gdbserver中实现,而不是在GDB本身中实现,所以你不能在本机调试时(当 GDB 直接控制下级(正在调试的)进程时)使用 tstart。

相反,您需要设置一个远程调试会话(仍然可以在单台计算机上完成):

gdbserver :10000 ./a.out  # start gdbserver listening on port 10000

在另一个窗口中:

gdb -ex 'target remote :10000' ./a.out

现在您将拥有带有远程目标(即正在运行的 gdbserver)的 GDB在同一主机上),并且 tstart 等将起作用。

更新:

但现在我看到以下消息:
(gdb) tstart
目标不支持此命令。
(gdb) r
“远程”目标不支持“运行”。

在使用tstart之前,您需要设置跟踪和操作,如文档此处

并且您无法运行,因为劣等进程已经正在运行。请改用继续

更新 2:

(gdb) trace testprog.c:273
Tracepoint 1 at 0x4578f7: file testprog.c, line 273.
(gdb) passcount 2 1
Setting tracepoint 1's passcount to 2
(gdb) actions 1
Enter actions for tracepoint 1, one per line.
End with a line saying just "end".
> collect id1
> end
(gdb) tstart
Target does not support this command

听起来您的 gdbserver 很旧,并且实际上支持跟踪。

生产什么

gdb --version
gdbserver --version

更新 3:

显然您的 gdbserver 太旧了。

尽管 GDB 本身从 4.17 版开始就支持跟踪点,但 gdbserver 直到版本 7.2

Update 4 才开始支持跟踪点:

在哪里给出我的程序作为输入的选项“-f filename”

简单。您可以阅读 gdbserver 的 文档,但我相信您正在寻找这个调用:

gdbserver :10000 ./a.out -f filename

Any idea on what is the meaning of this message ?

The meaning is exactly what the message says: the tracepoint facility is implemented only in gdbserver, and not in GDB itself, so you can't use tstart when debugging natively (when GDB controls the inferior (being debugged) process directly).

Instead, you need to set up a remote debugging session (which can still be done on a single machine):

gdbserver :10000 ./a.out  # start gdbserver listening on port 10000

In another window:

gdb -ex 'target remote :10000' ./a.out

Now you'll have GDB with a remote target (which is the gdbserver running on the same host), and tstart etc. will work.

Update:

But now i see the following msg:
(gdb) tstart
Target does not support this command.
(gdb) r
The "remote" target does not support "run".

Before you can use tstart, you need to set trace and actions, as documented here.

And you can't run because the inferior process is already running. Use continue instead.

Update 2:

(gdb) trace testprog.c:273
Tracepoint 1 at 0x4578f7: file testprog.c, line 273.
(gdb) passcount 2 1
Setting tracepoint 1's passcount to 2
(gdb) actions 1
Enter actions for tracepoint 1, one per line.
End with a line saying just "end".
> collect id1
> end
(gdb) tstart
Target does not support this command

It sounds like your gdbserver is old, and does in fact not support tracing.

What do

gdb --version
gdbserver --version

produce?

Update 3:

Apparently your gdbserver is too old.

Even though GDB itself supported tracepoints since version 4.17, gdbserver only started supporting the tracepoints with version 7.2

Update 4:

where to give this option "-f filename" that my program takes as input

Simple. You can read the documentation for gdbserver, but I believe you are looking for this invocation:

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