Search code examples
cgdbtty

Unable to input data to C program while debugging in separate terminal with gdb & tty command


I am debugging a C program with gdb. I have used the tty command to send the output to a new terminal window but am unable to enter input while the program is running.

If I debug in the same window it works fine, but when using a separate terminal window, input doesn't do anything.

I can still kill the process with ctr-c but once I hit the input line, it waits for input and doesn't do anything when I press return.

I have looked around but am haven't found the same problem online. Any ideas?


Solution

  • Start your program in one window. While your program is waiting for input, start gdb in another window. Use the gdb attach command to attach to and debug your program.