By default and if not explicitly closed by the target system, the file
descriptors 0, 1 and 2 are connected to the gdb console. Output
on the gdb console is handled as any other file output operation
write(1, ...) or
write(2, ...)). Console input is handled
by gdb so that after the target read request from file descriptor
0 all following typing is buffered until either one of the following
conditions is met:
readsystem call is treated as finished.
If the user has typed more characters than fit in the buffer given to
read call, the trailing characters are buffered in gdb until
read(0, ...) is requested by the target, or debugging
is stopped at the user's request.