Korcan Karaokçu
Korcan Karaokçu

Reputation: 547

Is it possible to give commands to gdb without stopping the debuggee?

Gameconqueror can update the variables it found continuously without stopping the program it's tracing. But as I know you have to use ptrace() to gain access of the specified program and when you do that it automatically stops the debuggee. But somehow Gameconqueror manages to do it's job without interrupting the debuggee(and it updates itself like every half second).

I think if Gameconqueror can do it, also gdb should be able to do it. I tried to enter some commands after continuing the debuggee, gdb doesn't give any error but also doesn't display anything. I'm very confused.

Upvotes: 3

Views: 1161

Answers (1)

Andrew
Andrew

Reputation: 4751

You need to make use of asynchronous mode within gdb. This is documented here: https://sourceware.org/gdb/onlinedocs/gdb/Background-Execution.html#Background-Execution

For example:

(gdb) continue &

Will continue your program and then immediately return to the command prompt, allowing you to issue further commands while your program is still running.

If you want to stop your program you need to use the interrupt command, as the usual Ctrl+c will not work.

Upvotes: 3

Related Questions