Remote-Non_002dStop.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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-2019 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.2, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: Remote Non-Stop</title>
  16. <meta name="description" content="Debugging with GDB: Remote Non-Stop">
  17. <meta name="keywords" content="Debugging with GDB: Remote Non-Stop">
  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="Packet-Acknowledgment.html#Packet-Acknowledgment" rel="next" title="Packet Acknowledgment">
  27. <link href="Notification-Packets.html#Notification-Packets" rel="prev" title="Notification Packets">
  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="Remote-Non_002dStop"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Packet-Acknowledgment.html#Packet-Acknowledgment" accesskey="n" rel="next">Packet Acknowledgment</a>, Previous: <a href="Notification-Packets.html#Notification-Packets" accesskey="p" rel="prev">Notification Packets</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="Remote-Protocol-Support-for-Non_002dStop-Mode"></a>
  65. <h3 class="section">E.10 Remote Protocol Support for Non-Stop Mode</h3>
  66. <p><small>GDB</small>&rsquo;s remote protocol supports non-stop debugging of
  67. multi-threaded programs, as described in <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>. If the stub
  68. supports non-stop mode, it should report that to <small>GDB</small> by including
  69. &lsquo;<samp>QNonStop+</samp>&rsquo; in its &lsquo;<samp>qSupported</samp>&rsquo; response (see <a href="General-Query-Packets.html#qSupported">qSupported</a>).
  70. </p>
  71. <p><small>GDB</small> typically sends a &lsquo;<samp>QNonStop</samp>&rsquo; packet only when
  72. establishing a new connection with the stub. Entering non-stop mode
  73. does not alter the state of any currently-running threads, but targets
  74. must stop all threads in any already-attached processes when entering
  75. all-stop mode. <small>GDB</small> uses the &lsquo;<samp>?</samp>&rsquo; packet as necessary to
  76. probe the target state after a mode change.
  77. </p>
  78. <p>In non-stop mode, when an attached process encounters an event that
  79. would otherwise be reported with a stop reply, it uses the
  80. asynchronous notification mechanism (see <a href="Notification-Packets.html#Notification-Packets">Notification Packets</a>) to
  81. inform <small>GDB</small>. In contrast to all-stop mode, where all threads
  82. in all processes are stopped when a stop reply is sent, in non-stop
  83. mode only the thread reporting the stop event is stopped. That is,
  84. when reporting a &lsquo;<samp>S</samp>&rsquo; or &lsquo;<samp>T</samp>&rsquo; response to indicate completion
  85. of a step operation, hitting a breakpoint, or a fault, only the
  86. affected thread is stopped; any other still-running threads continue
  87. to run. When reporting a &lsquo;<samp>W</samp>&rsquo; or &lsquo;<samp>X</samp>&rsquo; response, all running
  88. threads belonging to other attached processes continue to run.
  89. </p>
  90. <p>In non-stop mode, the target shall respond to the &lsquo;<samp>?</samp>&rsquo; packet as
  91. follows. First, any incomplete stop reply notification/&lsquo;<samp>vStopped</samp>&rsquo;
  92. sequence in progress is abandoned. The target must begin a new
  93. sequence reporting stop events for all stopped threads, whether or not
  94. it has previously reported those events to <small>GDB</small>. The first
  95. stop reply is sent as a synchronous reply to the &lsquo;<samp>?</samp>&rsquo; packet, and
  96. subsequent stop replies are sent as responses to &lsquo;<samp>vStopped</samp>&rsquo; packets
  97. using the mechanism described above. The target must not send
  98. asynchronous stop reply notifications until the sequence is complete.
  99. If all threads are running when the target receives the &lsquo;<samp>?</samp>&rsquo; packet,
  100. or if the target is not attached to any process, it shall respond
  101. &lsquo;<samp>OK</samp>&rsquo;.
  102. </p>
  103. <p>If the stub supports non-stop mode, it should also support the
  104. &lsquo;<samp>swbreak</samp>&rsquo; stop reason if software breakpoints are supported, and
  105. the &lsquo;<samp>hwbreak</samp>&rsquo; stop reason if hardware breakpoints are supported
  106. (see <a href="Stop-Reply-Packets.html#swbreak-stop-reason">swbreak stop reason</a>). This is because given the asynchronous
  107. nature of non-stop mode, between the time a thread hits a breakpoint
  108. and the time the event is finally processed by <small>GDB</small>, the
  109. breakpoint may have already been removed from the target. Due to
  110. this, <small>GDB</small> needs to be able to tell whether a trap stop was
  111. caused by a delayed breakpoint event, which should be ignored, as
  112. opposed to a random trap signal, which should be reported to the user.
  113. Note the &lsquo;<samp>swbreak</samp>&rsquo; feature implies that the target is responsible
  114. for adjusting the PC when a software breakpoint triggers, if
  115. necessary, such as on the x86 architecture.
  116. </p>
  117. <hr>
  118. <div class="header">
  119. <p>
  120. Next: <a href="Packet-Acknowledgment.html#Packet-Acknowledgment" accesskey="n" rel="next">Packet Acknowledgment</a>, Previous: <a href="Notification-Packets.html#Notification-Packets" accesskey="p" rel="prev">Notification Packets</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>
  121. </div>
  122. </body>
  123. </html>