Your program's input and output
By default, the program you run under GDB does input and output to the same terminal that GDB uses. GDB switches the terminal to its own terminal modes to interact with you, but it records the terminal modes your program was using and switches back to them when you continue running your program.
You can redirect your program's input and/or output using shell redirection with the run command. For example,
run > outfile
starts your program, diverting its output to the file outfile.