Next: , Previous: Key User Interface, Up: Top


7 Sending I/O to the program being debugged

If the program being debugged takes input on the terminal it is recommended that the user start the program on one terminal, and attach to it with CGDB from another terminal. This is the easiest way to pass input to the debugged program.

However, if the user wishes to pass input to the program being debugged from within CGDB, there is a mechanism available for doing so. As of this writing, the technique described below does not work on windows, using a natively compiled GDB. It may work when using the GDB that comes with Cygwin.

This technique is similar to getting in and out of GDB mode. The tty window is not visible by default. This is because it is only needed if the user wishes to send data to the program being debugged. To display the tty window, hit T while in command mode. After hitting T you will notice that there is another window in the middle of the source window and the gdb window. This is called the tty window. You will also see a new status bar called the tty status bar. There will be a ‘*’ on the tty status bar after the T was hit. This is because when the window is opened with the T command, CGDB automatically puts the user into TTY mode. To get out of this window hit the cgdb mode key. This will put you back into command mode. To make the tty window appear and disappear hit the T key while in command mode. It is a toggle.

Once the tty window is already open, the user can then hit I in command mode to get into TTY mode. The user can then hit the cgdb mode key in the TTY mode to get back into command mode.

When the tty window is open, all data that comes from the program, goes there. Any data typed into the tty window will ONLY go to the program being debugged. It will not go to GDB. When the tty window is closed, all output from the debugged program will go to the GDB window AND to the tty window (for viewing later when the tty window is opened).

If the user wishes to get a new tty for the program being debugged then they can type Ctrl-T. This will delete all the buffered data waiting to be read into the debugged program. This might be useful when you rerun or start a new program.