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


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. – 46_and_2 Nov 5 '18 at 3:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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