I'm using GDB to debug some of my C applications. What I currently do is load the target application, set a breakpoint on line 30 and run it.
I would like to make GDB display the output of my own application in a new terminal window while I'm still able to control the breakpoint handling via the GDB terminal window, but I couldn't seem to find a proper switch. Is there any way making GDB display my program's output in its own window?
When you have finished debugging the attached process, you can use the detach command to release it from GDB control. Detaching the process continues its execution. After the detach command, that process and GDB become completely independent once more, and you are ready to attach another process or start one with run .
The operating system's lightweight process (LWP) ID value for the thread. This ID is used in part for the OS to keep track of this thread for scheduling purposes. The GDB ID for the thread. This is the ID to use when specifying a specific thread in GDB commands.
With GDB it is always possible to debug a running process by attaching to it. It is possible to debug a DLL this way. The limitation of this approach is that the DLL must run long enough to perform the attach operation.
You can find it at path\\to\\MinGW\\bin\\gdb.exe `. So now you have a C/C++ compiler and a debugger. You compile your target.
For people wondering how to use the GDB tty command here is a short description...
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.
You can use set new-console on
to accomplish this as shown here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With