Hello I am novice programmer and I am trying to debug a simple C program, using getline (from the K&R book at the beginning) - input ends on newline.

I have a problem with gdb on Emacs. When I debug from the shell the program works normally. When it reaches the input line and asks for input I type my input, press enter and proceed with debugging steps. However when I debug with the command M-x gdb (run with default settings) the program reaches the input line and asks for input. I type my input and then cannot proceed debugging: RET doesn't get me out of the input stage and the program seems to wait for more input.

Update: works fine with M-x gud-gdb

1 Answer 1


Type your input in the "input/output" window. Not in the "gud" window.

In the layout shown in GDB User Interface Layout it is the one labled "I/O buffer for debugged pgm"

  • Just to add a bit more context, you will need to switch to the *I/O* buffer to type your input. Then you will need to switch back to the *gdb* buffer to continue to execute your gdb commands. Commented Nov 5, 2018 at 3:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.