Gdb: tstart error value "You cannot do this when your target is" exec ""

I would like to write the value of the local variable t , every time the program reaches a certain line. Accordingly, I tried:

  (gdb) trace stoer_wagner_min_cut.hpp: 197
 Tracepoint 1 at 0x4123a0: file ./boost/graph/stoer_wagner_min_cut.hpp, line 197.
 (gdb) actions
 Enter actions for tracepoint 1, one per line.
 End with a line saying just "end".
 > collect t
 > end
 (gdb) tstart
 You can't do that when your target is `exec '
 (gdb) break main
 Breakpoint 2 at 0x401448: file time_stoer_wagner.cpp, line 50.
 (gdb) run
 Starting 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: 50
 50 std :: ifstream ifs ("prgen_500_50_2.txt");
 (gdb) tstart
 You can't do that when your target is `child '

but the error messages "You cannot do this when your goal is" exec "and" you cannot do this when your goal is "child" do not help me. What do these errors mean?

+6
c ++ debugging gdb trace
source share
2 answers

The trace object is currently only available for remote purposes.

You can run the trace experiment you want using gdbserver. Example:

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

In another window:

 $ 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 tc, line 3. (gdb) actions > collect x > end (gdb) c 

The trace experiment now collects data ...

+14
source share

The best I could find is

http://sources.redhat.com/gdb/current/onlinedocs/gdb.html

upload file name Depending on what remote debugging options are configured on gdb, a download command may be available. Where it exists, it should have a filename (executable file) available for debugging on a remote boot system or dynamic link for example. the download also writes a table of symbol characters to names in gdb, for example add-symbol-file.

 If your gdb does not have a load command, attempting to execute it gets 

the error message "You cannot do this when your goal ..."

 The file is loaded at whatever address is specified in the 

executable file. For some object file formats, you can specify the load address when linking the program; for other formats, such as a.out, the file format object indicates a fixed address.

 Depending on the remote side capabilities, gdb may be able to load 

to flash memory.

 load does not repeat if you press <RET> again after using it. 
0
source share

All Articles