Not supported on windows
Supported on linux
Not supported on android
tty command
Specifies the terminal device to be used for the debugged process.
Syntax
tty [Device]
set inferior-tty [Device]
show inferior-tty
set inferior-tty [Device]
show inferior-tty
Parameters
- Device
- Specifies the full path of the terminal device that GDB will connect to the debugged program when you launch it with the start or run command.
Remarks
This command is only supported on Linux. A similar command under Windows is set new-console.
Examples
In this example we will debug a simple "Hello, World" program:
(gdb) run
Starting program: /home/testuser/hello
Hello, World
[Inferior 1 (process 8442) exited normally]
(gdb) tty /dev/pts/11
(gdb) show inferior-tty
Terminal for future runs of program being debugged is "/dev/pts/11".
(gdb) run
Starting program: /home/testuser/hello
[Inferior 1 (process 8448) exited normally]
Starting program: /home/testuser/hello
Hello, World
[Inferior 1 (process 8442) exited normally]
(gdb) tty /dev/pts/11
(gdb) show inferior-tty
Terminal for future runs of program being debugged is "/dev/pts/11".
(gdb) run
Starting program: /home/testuser/hello
[Inferior 1 (process 8448) exited normally]
After we have issued the tty command, the output from the "Hello, World" program has been redirected to /dev/pts/11 (the device name was obtained by running the tty command inside another xterm window).
Compatibility with VisualGDB
Do not issue the tty command under Visual Studio. VisualGDB issues this command automatically to redirect the output to the Remote Console window: