Redirect GDB stdout to another terminal
In gdb I often want stdout of the program I'm debugging to go to another terminal. To do this I open a terminal where the output will go and run 'tty' to get its path. Then I set this in my gdb with 'tty /dev/pts/17'. Now stdout appears in the other location.
This is annoying to redo every time when restarting gdb. Save your tty in an environmental variable. Then something like this in .gdbinit.
python
import os
if 'OUTTY' in os.environ:
gdb.execute('tty ' + os.environ['OUTTY'])
end
Written by Marin
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Linux
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#