For people wondering how to use the GDB tty command here is a short description…
- Open a new console window. We will redirect output from the program running under GDB here. This is our output window.
-
Run the
tty
command in the output window. This will show the name of the tty being used by the underlying console.$ tty
/dev/pts/4
-
Open another console window and start GDB here. Let us call this the GDB window.
-
Now run the tty command in GDB using the tty file name obtained above and then start the debugging process.
(gdb) tty /dev/pts/4
(gdb) run
Now you should be able to see the program output separately in the output window.
Note: The GDB set new-console on
command does not work on Linux! It is meant to be run on windows only. Use the tty method described above on Linux.