Supported on windows
Not supported on linux
Not supported on android
set new-console command
Specifies the terminal device to be used for the debugged process.
Syntax
set new-console off
set new-console on
set new-console on
Modes
- off
- In this mode GDB will start the debugged program in its own console. The output of the program will be mixed with the output of GDB. This is the default mode.
- on
- In this mode GDB will start the debugged program in a new console. The output of the program will be shown in a separate window that will be closed after the program exits.
Default mode
The default value for the new-console setting is 'off'.
Remarks
This command is only supported on Windows. A similar command under Linux is tty.
Examples
In this example we will debug a simple "Hello, World" program:
(gdb) show new-console
Creation of new console when creating child process is off.
(gdb) run
Starting program: C:\MinGW\bin\0.exe
[New Thread 10252.0x1804]
Hello, World
[Inferior 1 (process 10252) exited normally]
(gdb) set new-console on
(gdb) run
Starting program: C:\MinGW\bin\0.exe
[New Thread 10224.0x2834]
[Inferior 1 (process 10224) exited normally]
(gdb)
Creation of new console when creating child process is off.
(gdb) run
Starting program: C:\MinGW\bin\0.exe
[New Thread 10252.0x1804]
Hello, World
[Inferior 1 (process 10252) exited normally]
(gdb) set new-console on
(gdb) run
Starting program: C:\MinGW\bin\0.exe
[New Thread 10224.0x2834]
[Inferior 1 (process 10224) exited normally]
(gdb)
After we have issued the set new-console command, the next instance of the debugged program has been started in its own console window and its output was not mixed with the GDB output.
Compatibility with VisualGDB
Do not issue the set new-console command under Visual Studio. VisualGDB always issues this command automatically to distinguish your program output from the GDB output.