3

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.

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.