| <html lang="en"> |
| <head> |
| <title>The Ctrl-C Message - Debugging with GDB</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Debugging with GDB"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension" title="File-I/O Remote Protocol Extension"> |
| <link rel="prev" href="The-F-Reply-Packet.html#The-F-Reply-Packet" title="The F Reply Packet"> |
| <link rel="next" href="Console-I_002fO.html#Console-I_002fO" title="Console I/O"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| Copyright (C) 1988-2019 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 or |
| any later version published by the Free Software Foundation; with the |
| Invariant Sections being ``Free Software'' and ``Free Software Needs |
| Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' |
| and with the Back-Cover Texts as in (a) below. |
| |
| (a) The FSF's Back-Cover Text is: ``You are free to copy and modify |
| this GNU Manual. Buying copies from GNU Press supports the FSF in |
| developing GNU and promoting software freedom.'' |
| --> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="The-Ctrl-C-Message"></a> |
| <a name="The-Ctrl_002dC-Message"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="Console-I_002fO.html#Console-I_002fO">Console I/O</a>, |
| Previous: <a rel="previous" accesskey="p" href="The-F-Reply-Packet.html#The-F-Reply-Packet">The F Reply Packet</a>, |
| Up: <a rel="up" accesskey="u" href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a> |
| <hr> |
| </div> |
| |
| <h4 class="subsection">E.13.5 The ‘<samp><span class="samp">Ctrl-C</span></samp>’ Message</h4> |
| |
| <p><a name="index-ctrl_002dc-message_002c-in-file_002di_002fo-protocol-3601"></a> |
| If the ‘<samp><span class="samp">Ctrl-C</span></samp>’ flag is set in the <span class="sc">gdb</span> |
| reply packet (see <a href="The-F-Reply-Packet.html#The-F-Reply-Packet">The F Reply Packet</a>), |
| the target should behave as if it had |
| gotten a break message. The meaning for the target is “system call |
| interrupted by <code>SIGINT</code>”. Consequentially, the target should actually stop |
| (as with a break message) and return to <span class="sc">gdb</span> with a <code>T02</code> |
| packet. |
| |
| <p>It's important for the target to know in which |
| state the system call was interrupted. There are two possible cases: |
| |
| <ul> |
| <li>The system call hasn't been performed on the host yet. |
| |
| <li>The system call on the host has been finished. |
| |
| </ul> |
| |
| <p>These two states can be distinguished by the target by the value of the |
| returned <code>errno</code>. If it's the protocol representation of <code>EINTR</code>, the system |
| call hasn't been performed. This is equivalent to the <code>EINTR</code> handling |
| on POSIX systems. In any other case, the target may presume that the |
| system call has been finished — successfully or not — and should behave |
| as if the break message arrived right after the system call. |
| |
| <p><span class="sc">gdb</span> must behave reliably. If the system call has not been called |
| yet, <span class="sc">gdb</span> may send the <code>F</code> reply immediately, setting <code>EINTR</code> as |
| <code>errno</code> in the packet. If the system call on the host has been finished |
| before the user requests a break, the full action must be finished by |
| <span class="sc">gdb</span>. This requires sending <code>M</code> or <code>X</code> packets as necessary. |
| The <code>F</code> packet may only be sent when either nothing has happened |
| or the full action has been completed. |
| |
| </body></html> |
| |