我想使用跟踪点在我有完全访问权限的本地机器上调试程序。我能够设置跟踪点及其通行证并使用 info tr 给我
(gdb) 信息 tr
Num Enb 地址 PassC StepC 什么
1 y 0x080b7529 2 0 in search_tcp at tcp_pkt.c:412
跟踪点 1 的操作:
收集流量
结尾
然后我运行 prog,它照常运行,最后当我给 tfind 或 tdump 收集它显示的所需数据时:
(gdb) tfind 1
跟踪只能在远程目标上运行。
(gdb) tdump
跟踪只能在远程目标上运行。
即使我尝试使用“tstart”,但它再次显示“跟踪只能在远程目标上运行”。
知道这条消息的含义是什么吗?当前不支持跟踪使用吗?还是用于通过 LAN 或其他网络调试某些远程机器?
任何帮助将不胜感激。
谢谢
维卡斯
最佳答案
Any idea on what is the meaning of this message ?
意思就是消息所说的:tracepoint 工具仅在
gdbserver
中实现,而不是在 GDB 本身中实现,因此在本地调试时(当 GDB 直接控制下级(被调试)进程时)不能使用 tstart
。相反,您需要设置远程调试 session (仍然可以在单台机器上完成):
gdbserver :10000 ./a.out # start gdbserver listening on port 10000
在另一个窗口中:
gdb -ex 'target remote :10000' ./a.out
现在您将拥有带有远程目标的 GDB(即运行在同一主机上的
gdbserver
),并且 tstart
等将起作用。更新:
But now i see the following msg:
(gdb) tstart
Target does not support this command.
(gdb) r
The "remote" target does not support "run".
在您可以使用
tstart
之前,您需要设置跟踪和操作,如 here 所述。你不能
run
因为劣等进程已经在运行。请改用 continue
。更新 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 版开始支持跟踪点更新 4:
where to give this option "-f filename" that my program takes as input
简单的。您可以阅读 gdbserver 的 documentation,但我相信您正在寻找此调用:
gdbserver :10000 ./a.out -f filename
关于gdb - 跟踪点在 gdb 中不起作用,它显示 "Trace can only be run on remote targets",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9096321/