gdb.info: Console I/O

Go forward to The isatty call
Go backward to The Ctrl-C message
Go up to File-I/O remote protocol extension
Go to the top op gdb

Console I/O

By default and if not explicitely 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:
   * The user presses `Ctrl-C'.  The behaviour is as explained above,
     the `read' system call is treated as finished.
   * The user presses `Enter'.  This is treated as end of input with a
     trailing line feed.
   * The user presses `Ctrl-D'.  This is treated as end of input.  No
     trailing character, especially no Ctrl-D is appended to the input.
   If the user has typed more characters as fit in the buffer given to
the read call, the trailing characters are buffered in GDB until either
another `read(0, ...)' is requested by the target or debugging is
stopped on users request.