Notification-Packets.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: Notification Packets</title>
  16. <meta name="description" content="Debugging with GDB: Notification Packets">
  17. <meta name="keywords" content="Debugging with GDB: Notification Packets">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Remote-Protocol.html#Remote-Protocol" rel="up" title="Remote Protocol">
  26. <link href="Remote-Non_002dStop.html#Remote-Non_002dStop" rel="next" title="Remote Non-Stop">
  27. <link href="Interrupts.html#Interrupts" rel="previous" title="Interrupts">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.indentedblock {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style:oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nocodebreak {white-space:nowrap}
  50. span.nolinebreak {white-space:nowrap}
  51. span.roman {font-family:serif; font-weight:normal}
  52. span.sansserif {font-family:sans-serif; font-weight:normal}
  53. ul.no-bullet {list-style: none}
  54. -->
  55. </style>
  56. </head>
  57. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  58. <a name="Notification-Packets"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Remote-Non_002dStop.html#Remote-Non_002dStop" accesskey="n" rel="next">Remote Non-Stop</a>, Previous: <a href="Interrupts.html#Interrupts" accesskey="p" rel="previous">Interrupts</a>, Up: <a href="Remote-Protocol.html#Remote-Protocol" accesskey="u" rel="up">Remote Protocol</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  62. </div>
  63. <hr>
  64. <a name="Notification-Packets-1"></a>
  65. <h3 class="section">E.9 Notification Packets</h3>
  66. <a name="index-notification-packets"></a>
  67. <a name="index-packets_002c-notification"></a>
  68. <p>The <small>GDB</small> remote serial protocol includes <em>notifications</em>,
  69. packets that require no acknowledgment. Both the GDB and the stub
  70. may send notifications (although the only notifications defined at
  71. present are sent by the stub). Notifications carry information
  72. without incurring the round-trip latency of an acknowledgment, and so
  73. are useful for low-impact communications where occasional packet loss
  74. is not a problem.
  75. </p>
  76. <p>A notification packet has the form &lsquo;<samp>% <var>data</var> #
  77. <var>checksum</var></samp>&rsquo;, where <var>data</var> is the content of the notification,
  78. and <var>checksum</var> is a checksum of <var>data</var>, computed and formatted
  79. as for ordinary <small>GDB</small> packets. A notification&rsquo;s <var>data</var>
  80. never contains &lsquo;<samp>$</samp>&rsquo;, &lsquo;<samp>%</samp>&rsquo; or &lsquo;<samp>#</samp>&rsquo; characters. Upon
  81. receiving a notification, the recipient sends no &lsquo;<samp>+</samp>&rsquo; or &lsquo;<samp>-</samp>&rsquo;
  82. to acknowledge the notification&rsquo;s receipt or to report its corruption.
  83. </p>
  84. <p>Every notification&rsquo;s <var>data</var> begins with a name, which contains no
  85. colon characters, followed by a colon character.
  86. </p>
  87. <p>Recipients should silently ignore corrupted notifications and
  88. notifications they do not understand. Recipients should restart
  89. timeout periods on receipt of a well-formed notification, whether or
  90. not they understand it.
  91. </p>
  92. <p>Senders should only send the notifications described here when this
  93. protocol description specifies that they are permitted. In the
  94. future, we may extend the protocol to permit existing notifications in
  95. new contexts; this rule helps older senders avoid confusing newer
  96. recipients.
  97. </p>
  98. <p>(Older versions of <small>GDB</small> ignore bytes received until they see
  99. the &lsquo;<samp>$</samp>&rsquo; byte that begins an ordinary packet, so new stubs may
  100. transmit notifications without fear of confusing older clients. There
  101. are no notifications defined for <small>GDB</small> to send at the moment, but we
  102. assume that most older stubs would ignore them, as well.)
  103. </p>
  104. <p>Each notification is comprised of three parts:
  105. </p><dl compact="compact">
  106. <dt>&lsquo;<samp><var>name</var>:<var>event</var></samp>&rsquo;</dt>
  107. <dd><p>The notification packet is sent by the side that initiates the
  108. exchange (currently, only the stub does that), with <var>event</var>
  109. carrying the specific information about the notification, and
  110. <var>name</var> specifying the name of the notification.
  111. </p></dd>
  112. <dt>&lsquo;<samp><var>ack</var></samp>&rsquo;</dt>
  113. <dd><p>The acknowledge sent by the other side, usually <small>GDB</small>, to
  114. acknowledge the exchange and request the event.
  115. </p></dd>
  116. </dl>
  117. <p>The purpose of an asynchronous notification mechanism is to report to
  118. <small>GDB</small> that something interesting happened in the remote stub.
  119. </p>
  120. <p>The remote stub may send notification <var>name</var>:<var>event</var>
  121. at any time, but <small>GDB</small> acknowledges the notification when
  122. appropriate. The notification event is pending before <small>GDB</small>
  123. acknowledges. Only one notification at a time may be pending; if
  124. additional events occur before <small>GDB</small> has acknowledged the
  125. previous notification, they must be queued by the stub for later
  126. synchronous transmission in response to <var>ack</var> packets from
  127. <small>GDB</small>. Because the notification mechanism is unreliable,
  128. the stub is permitted to resend a notification if it believes
  129. <small>GDB</small> may not have received it.
  130. </p>
  131. <p>Specifically, notifications may appear when <small>GDB</small> is not
  132. otherwise reading input from the stub, or when <small>GDB</small> is
  133. expecting to read a normal synchronous response or a
  134. &lsquo;<samp>+</samp>&rsquo;/&lsquo;<samp>-</samp>&rsquo; acknowledgment to a packet it has sent.
  135. Notification packets are distinct from any other communication from
  136. the stub so there is no ambiguity.
  137. </p>
  138. <p>After receiving a notification, <small>GDB</small> shall acknowledge it by
  139. sending a <var>ack</var> packet as a regular, synchronous request to the
  140. stub. Such acknowledgment is not required to happen immediately, as
  141. <small>GDB</small> is permitted to send other, unrelated packets to the
  142. stub first, which the stub should process normally.
  143. </p>
  144. <p>Upon receiving a <var>ack</var> packet, if the stub has other queued
  145. events to report to <small>GDB</small>, it shall respond by sending a
  146. normal <var>event</var>. <small>GDB</small> shall then send another <var>ack</var>
  147. packet to solicit further responses; again, it is permitted to send
  148. other, unrelated packets as well which the stub should process
  149. normally.
  150. </p>
  151. <p>If the stub receives a <var>ack</var> packet and there are no additional
  152. <var>event</var> to report, the stub shall return an &lsquo;<samp>OK</samp>&rsquo; response.
  153. At this point, <small>GDB</small> has finished processing a notification
  154. and the stub has completed sending any queued events. <small>GDB</small>
  155. won&rsquo;t accept any new notifications until the final &lsquo;<samp>OK</samp>&rsquo; is
  156. received . If further notification events occur, the stub shall send
  157. a new notification, <small>GDB</small> shall accept the notification, and
  158. the process shall be repeated.
  159. </p>
  160. <p>The process of asynchronous notification can be illustrated by the
  161. following example:
  162. </p><div class="smallexample">
  163. <pre class="smallexample">&lt;- <code>%Stop:T0505:98e7ffbf;04:4ce6ffbf;08:b1b6e54c;thread:p7526.7526;core:0;</code>
  164. <code>...</code>
  165. -&gt; <code>vStopped</code>
  166. &lt;- <code>T0505:68f37db7;04:40f37db7;08:63850408;thread:p7526.7528;core:0;</code>
  167. -&gt; <code>vStopped</code>
  168. &lt;- <code>T0505:68e3fdb6;04:40e3fdb6;08:63850408;thread:p7526.7529;core:0;</code>
  169. -&gt; <code>vStopped</code>
  170. &lt;- <code>OK</code>
  171. </pre></div>
  172. <p>The following notifications are defined:
  173. </p><table>
  174. <tr><td width="12%">Notification</td><td width="12%">Ack</td><td width="38%">Event</td><td width="38%">Description</td></tr>
  175. <tr><td width="12%">Stop</td><td width="12%">vStopped</td><td width="38%"><var>reply</var>. The <var>reply</var> has the form of a stop reply, as
  176. described in <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>. Refer to <a href="Remote-Non_002dStop.html#Remote-Non_002dStop">Remote Non-Stop</a>,
  177. for information on how these notifications are acknowledged by
  178. <small>GDB</small>.</td><td width="38%">Report an asynchronous stop event in non-stop mode.</td></tr>
  179. </table>
  180. <hr>
  181. <div class="header">
  182. <p>
  183. Next: <a href="Remote-Non_002dStop.html#Remote-Non_002dStop" accesskey="n" rel="next">Remote Non-Stop</a>, Previous: <a href="Interrupts.html#Interrupts" accesskey="p" rel="previous">Interrupts</a>, Up: <a href="Remote-Protocol.html#Remote-Protocol" accesskey="u" rel="up">Remote Protocol</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  184. </div>
  185. </body>
  186. </html>