block output of debugged program (gdb)

gdb

Solution

You can redirect output from within gdb:

(gdb) run > somefile.txt

will redirect standard output to somefile.txt. You can also specify a terminal to send output to:

(gdb) tty /dev/ttyb

Problem

I have a program and want to debug it in gdb. Will I see usual program output? How can I enable/disable this output, leaving only gdb messages.

Original source