gdb.info: The Ctrl-C message

Go forward to Console I/O
Go backward to Memory transfer
Go up to File-I/O remote protocol extension
Go to the top op gdb

The Ctrl-C message

A special case is, if the CTRL-C FLAG is set in the GDB reply packet.
In this case the target should behave, as if it had gotten a break
message.  The meaning for the target is "system call interupted by
`SIGINT'".  Consequentially, the target should actually stop (as with a
break message) and return to GDB with a `T02' packet.  In this case,
it's important for the target to know, in which state the system call
was interrupted.  Since this action is by design not an atomic
operation, we have to differ between two cases:
   * The system call hasn't been performed on the host yet.
   * The system call on the host has been finished.
   These two states can be distinguished by the target by the value of
the returned `errno'.  If it's the protocol representation of `EINTR',
the system call hasn't been performed.  This is equivalent to the
`EINTR' handling on POSIX systems.  In any other case, the target may
presume that the system call has been finished -- successful or not --
and should behave as if the break message arrived right after the
system call.
   GDB must behave reliable.  If the system call has not been called
yet, GDB may send the `F' reply immediately, setting `EINTR' as `errno'
in the packet.  If the system call on the host has been finished before
the user requests a break, the full action must be finshed by GDB.
This requires sending `M' or `X' packets as they fit.  The `F' packet
may only be send when either nothing has happened or the full action
has been completed.