gpt4 book ai didi

c++ - gdb:tstart 错误 "You can' 的含义 t 当你的目标是 `exec' 时执行此操作“

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:10:25 28 4
gpt4 key购买 nike

我想记录一个局部变量的值,t,每次程序到达某一行时。因此,我尝试了:

(gdb) trace stoer_wagner_min_cut.hpp :197Tracepoint 1 at 0x4123a0: file ./boost/graph/stoer_wagner_min_cut.hpp, line 197.(gdb) actionsEnter actions for tracepoint 1, one per line.End with a line saying just "end".> collect t> end(gdb) tstartYou can't do that when your target is `exec'(gdb) break mainBreakpoint 2 at 0x401448: file time_stoer_wagner.cpp, line 50.(gdb) runStarting program: C:\Users\Daniel\Documents\projects\stoer_wagner_min_cut/time_stoer_wagner.exe[New Thread 3908.0x39c]Breakpoint 2, main () at time_stoer_wagner.cpp:5050        std::ifstream ifs("prgen_500_50_2.txt");(gdb) tstartYou can't do that when your target is `child'

但是错误消息“当你的目标是‘exec’时你不能这样做”和“当你的目标是‘ child ’时你不能那样做”对我没有帮助。这些错误是什么意思?

最佳答案

The tracepoint facility is currently available only for remote targets.

您应该能够使用 gdbserver 执行您想要的跟踪实验。示例:

$ gdbserver :0 ./a.out 
Process ./a.out created; pid = 21838
Listening on port 51596

在另一个窗口中:

$ gdb -q ./a.out 
Reading symbols from /tmp/a.out...done.
(gdb) target remote :51596

0x00007fa76ec3fa60 in _start () from /lib64/ld-linux-x86-64.so.2
(gdb) list foo
1 int foo(int x)
2 {
3 return x;
4 }
5
6 int main()
7 {
8 for(int i = 0; i < 10; ++i)
9 foo(i);
10 return 0;
11 }
(gdb) trace 3
Tracepoint 1 at 0x40053f: file t.c, line 3.
(gdb) actions
> collect x
> end
(gdb) c

跟踪实验现在收集数据......

关于c++ - gdb:tstart 错误 "You can' 的含义 t 当你的目标是 `exec' 时执行此操作“,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3691394/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com