Reputation: 316
So I'm trying to debug a program that takes user input through the terminal. I'm using the GNU Debugger (gdb) to do so. When I reach the point where the program is waiting for user input it no longer allows me to control gdb and instead forces me to give input to the program.
The difficulty is, I want to debug the program at this exact point, but before there is any input given. So how do I switch between giving input to the program and controlling gdb? I've tried googling and searching through the manual for gdb but can't seem to find anything on switching between input to the program and input to gdb.
Upvotes: 3
Views: 2674
Reputation: 213606
When I reach the point where the program is waiting for user input it no longer allows me to control gdb and instead forces me to give input to the program.
If you hit Control-C
at that point, the inferior (being debugged) program should get interrupted, you should get a (gdb)
prompt, and you should be able to control GDB all you want.
Once you are done, use continue
GDB command to go back and resume the inferior reading its input.
Upvotes: 7