You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

342 satır
18KB

  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 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Stop Reply Packets (Debugging with GDB)</title>
  17. <meta name="description" content="Stop Reply Packets (Debugging with GDB)">
  18. <meta name="keywords" content="Stop Reply Packets (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  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="General-Query-Packets.html#General-Query-Packets" rel="next" title="General Query Packets">
  27. <link href="Packets.html#Packets" rel="prev" title="Packets">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Stop-Reply-Packets"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="General-Query-Packets.html#General-Query-Packets" accesskey="n" rel="next">General Query Packets</a>, Previous: <a href="Packets.html#Packets" accesskey="p" rel="prev">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>
  61. </div>
  62. <hr>
  63. <a name="Stop-Reply-Packets-1"></a>
  64. <h3 class="section">E.3 Stop Reply Packets</h3>
  65. <a name="index-stop-reply-packets"></a>
  66. <p>The &lsquo;<samp>C</samp>&rsquo;, &lsquo;<samp>c</samp>&rsquo;, &lsquo;<samp>S</samp>&rsquo;, &lsquo;<samp>s</samp>&rsquo;, &lsquo;<samp>vCont</samp>&rsquo;,
  67. &lsquo;<samp>vAttach</samp>&rsquo;, &lsquo;<samp>vRun</samp>&rsquo;, &lsquo;<samp>vStopped</samp>&rsquo;, and &lsquo;<samp>?</samp>&rsquo; packets can
  68. receive any of the below as a reply. Except for &lsquo;<samp>?</samp>&rsquo;
  69. and &lsquo;<samp>vStopped</samp>&rsquo;, that reply is only returned
  70. when the target halts. In the below the exact meaning of <em>signal
  71. number</em> is defined by the header <samp>include/gdb/signals.h</samp> in the
  72. <small>GDB</small> source code.
  73. </p>
  74. <p>In non-stop mode, the server will simply reply &lsquo;<samp>OK</samp>&rsquo; to commands
  75. such as &lsquo;<samp>vCont</samp>&rsquo;; any stop will be the subject of a future
  76. notification. See <a href="Remote-Non_002dStop.html#Remote-Non_002dStop">Remote Non-Stop</a>.
  77. </p>
  78. <p>As in the description of request packets, we include spaces in the
  79. reply templates for clarity; these are not part of the reply packet&rsquo;s
  80. syntax. No <small>GDB</small> stop reply packet uses spaces to separate its
  81. components.
  82. </p>
  83. <dl compact="compact">
  84. <dt>&lsquo;<samp>S <var>AA</var></samp>&rsquo;</dt>
  85. <dd><p>The program received signal number <var>AA</var> (a two-digit hexadecimal
  86. number). This is equivalent to a &lsquo;<samp>T</samp>&rsquo; response with no
  87. <var>n</var>:<var>r</var> pairs.
  88. </p>
  89. </dd>
  90. <dt>&lsquo;<samp>T <var>AA</var> <var>n1</var>:<var>r1</var>;<var>n2</var>:<var>r2</var>;&hellip;</samp>&rsquo;</dt>
  91. <dd><a name="index-T-packet-reply"></a>
  92. <p>The program received signal number <var>AA</var> (a two-digit hexadecimal
  93. number). This is equivalent to an &lsquo;<samp>S</samp>&rsquo; response, except that the
  94. &lsquo;<samp><var>n</var>:<var>r</var></samp>&rsquo; pairs can carry values of important registers
  95. and other information directly in the stop reply packet, reducing
  96. round-trip latency. Single-step and breakpoint traps are reported
  97. this way. Each &lsquo;<samp><var>n</var>:<var>r</var></samp>&rsquo; pair is interpreted as follows:
  98. </p>
  99. <ul>
  100. <li> If <var>n</var> is a hexadecimal number, it is a register number, and the
  101. corresponding <var>r</var> gives that register&rsquo;s value. The data <var>r</var> is a
  102. series of bytes in target byte order, with each byte given by a
  103. two-digit hex number.
  104. </li><li> If <var>n</var> is &lsquo;<samp>thread</samp>&rsquo;, then <var>r</var> is the <var>thread-id</var> of
  105. the stopped thread, as specified in <a href="Packets.html#thread_002did-syntax">thread-id syntax</a>.
  106. </li><li> If <var>n</var> is &lsquo;<samp>core</samp>&rsquo;, then <var>r</var> is the hexadecimal number of
  107. the core on which the stop event was detected.
  108. </li><li> If <var>n</var> is a recognized <em>stop reason</em>, it describes a more
  109. specific event that stopped the target. The currently defined stop
  110. reasons are listed below. The <var>aa</var> should be &lsquo;<samp>05</samp>&rsquo;, the trap
  111. signal. At most one stop reason should be present.
  112. </li><li> Otherwise, <small>GDB</small> should ignore this &lsquo;<samp><var>n</var>:<var>r</var></samp>&rsquo; pair
  113. and go on to the next; this allows us to extend the protocol in the
  114. future.
  115. </li></ul>
  116. <p>The currently defined stop reasons are:
  117. </p>
  118. <dl compact="compact">
  119. <dt>&lsquo;<samp>watch</samp>&rsquo;</dt>
  120. <dt>&lsquo;<samp>rwatch</samp>&rsquo;</dt>
  121. <dt>&lsquo;<samp>awatch</samp>&rsquo;</dt>
  122. <dd><p>The packet indicates a watchpoint hit, and <var>r</var> is the data address, in
  123. hex.
  124. </p>
  125. </dd>
  126. <dt>&lsquo;<samp>syscall_entry</samp>&rsquo;</dt>
  127. <dt>&lsquo;<samp>syscall_return</samp>&rsquo;</dt>
  128. <dd><p>The packet indicates a syscall entry or return, and <var>r</var> is the
  129. syscall number, in hex.
  130. </p>
  131. <a name="index-shared-library-events_002c-remote-reply"></a>
  132. </dd>
  133. <dt>&lsquo;<samp>library</samp>&rsquo;</dt>
  134. <dd><p>The packet indicates that the loaded libraries have changed.
  135. <small>GDB</small> should use &lsquo;<samp>qXfer:libraries:read</samp>&rsquo; to fetch a new
  136. list of loaded libraries. The <var>r</var> part is ignored.
  137. </p>
  138. <a name="index-replay-log-events_002c-remote-reply"></a>
  139. </dd>
  140. <dt>&lsquo;<samp>replaylog</samp>&rsquo;</dt>
  141. <dd><p>The packet indicates that the target cannot continue replaying
  142. logged execution events, because it has reached the end (or the
  143. beginning when executing backward) of the log. The value of <var>r</var>
  144. will be either &lsquo;<samp>begin</samp>&rsquo; or &lsquo;<samp>end</samp>&rsquo;. See <a href="Reverse-Execution.html#Reverse-Execution">Reverse Execution</a>,
  145. for more information.
  146. </p>
  147. </dd>
  148. <dt>&lsquo;<samp>swbreak</samp>&rsquo;</dt>
  149. <dd><a name="swbreak-stop-reason"></a><p>The packet indicates a software breakpoint instruction was executed,
  150. irrespective of whether it was <small>GDB</small> that planted the
  151. breakpoint or the breakpoint is hardcoded in the program. The <var>r</var>
  152. part must be left empty.
  153. </p>
  154. <p>On some architectures, such as x86, at the architecture level, when a
  155. breakpoint instruction executes the program counter points at the
  156. breakpoint address plus an offset. On such targets, the stub is
  157. responsible for adjusting the PC to point back at the breakpoint
  158. address.
  159. </p>
  160. <p>This packet should not be sent by default; older <small>GDB</small> versions
  161. did not support it. <small>GDB</small> requests it, by supplying an
  162. appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature (see <a href="General-Query-Packets.html#qSupported">qSupported</a>). The
  163. remote stub must also supply the appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature
  164. indicating support.
  165. </p>
  166. <p>This packet is required for correct non-stop mode operation.
  167. </p>
  168. </dd>
  169. <dt>&lsquo;<samp>hwbreak</samp>&rsquo;</dt>
  170. <dd><p>The packet indicates the target stopped for a hardware breakpoint.
  171. The <var>r</var> part must be left empty.
  172. </p>
  173. <p>The same remarks about &lsquo;<samp>qSupported</samp>&rsquo; and non-stop mode above
  174. apply.
  175. </p>
  176. <a name="index-fork-events_002c-remote-reply"></a>
  177. </dd>
  178. <dt>&lsquo;<samp>fork</samp>&rsquo;</dt>
  179. <dd><p>The packet indicates that <code>fork</code> was called, and <var>r</var>
  180. is the thread ID of the new child process. Refer to
  181. <a href="Packets.html#thread_002did-syntax">thread-id syntax</a> for the format of the <var>thread-id</var>
  182. field. This packet is only applicable to targets that support
  183. fork events.
  184. </p>
  185. <p>This packet should not be sent by default; older <small>GDB</small> versions
  186. did not support it. <small>GDB</small> requests it, by supplying an
  187. appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature (see <a href="General-Query-Packets.html#qSupported">qSupported</a>). The
  188. remote stub must also supply the appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature
  189. indicating support.
  190. </p>
  191. <a name="index-vfork-events_002c-remote-reply"></a>
  192. </dd>
  193. <dt>&lsquo;<samp>vfork</samp>&rsquo;</dt>
  194. <dd><p>The packet indicates that <code>vfork</code> was called, and <var>r</var>
  195. is the thread ID of the new child process. Refer to
  196. <a href="Packets.html#thread_002did-syntax">thread-id syntax</a> for the format of the <var>thread-id</var>
  197. field. This packet is only applicable to targets that support
  198. vfork events.
  199. </p>
  200. <p>This packet should not be sent by default; older <small>GDB</small> versions
  201. did not support it. <small>GDB</small> requests it, by supplying an
  202. appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature (see <a href="General-Query-Packets.html#qSupported">qSupported</a>). The
  203. remote stub must also supply the appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature
  204. indicating support.
  205. </p>
  206. <a name="index-vforkdone-events_002c-remote-reply"></a>
  207. </dd>
  208. <dt>&lsquo;<samp>vforkdone</samp>&rsquo;</dt>
  209. <dd><p>The packet indicates that a child process created by a vfork
  210. has either called <code>exec</code> or terminated, so that the
  211. address spaces of the parent and child process are no longer
  212. shared. The <var>r</var> part is ignored. This packet is only
  213. applicable to targets that support vforkdone events.
  214. </p>
  215. <p>This packet should not be sent by default; older <small>GDB</small> versions
  216. did not support it. <small>GDB</small> requests it, by supplying an
  217. appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature (see <a href="General-Query-Packets.html#qSupported">qSupported</a>). The
  218. remote stub must also supply the appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature
  219. indicating support.
  220. </p>
  221. <a name="index-exec-events_002c-remote-reply"></a>
  222. </dd>
  223. <dt>&lsquo;<samp>exec</samp>&rsquo;</dt>
  224. <dd><p>The packet indicates that <code>execve</code> was called, and <var>r</var>
  225. is the absolute pathname of the file that was executed, in hex.
  226. This packet is only applicable to targets that support exec events.
  227. </p>
  228. <p>This packet should not be sent by default; older <small>GDB</small> versions
  229. did not support it. <small>GDB</small> requests it, by supplying an
  230. appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature (see <a href="General-Query-Packets.html#qSupported">qSupported</a>). The
  231. remote stub must also supply the appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature
  232. indicating support.
  233. </p>
  234. <a name="index-thread-create-event_002c-remote-reply"></a>
  235. <a name="thread-create-event"></a></dd>
  236. <dt>&lsquo;<samp>create</samp>&rsquo;</dt>
  237. <dd><p>The packet indicates that the thread was just created. The new thread
  238. is stopped until <small>GDB</small> sets it running with a resumption packet
  239. (see <a href="Packets.html#vCont-packet">vCont packet</a>). This packet should not be sent by default;
  240. <small>GDB</small> requests it with the <a href="General-Query-Packets.html#QThreadEvents">QThreadEvents</a> packet. See
  241. also the &lsquo;<samp>w</samp>&rsquo; (see <a href="#thread-exit-event">thread exit event</a>) remote reply below. The
  242. <var>r</var> part is ignored.
  243. </p>
  244. </dd>
  245. </dl>
  246. </dd>
  247. <dt>&lsquo;<samp>W <var>AA</var></samp>&rsquo;</dt>
  248. <dt>&lsquo;<samp>W <var>AA</var> ; process:<var>pid</var></samp>&rsquo;</dt>
  249. <dd><p>The process exited, and <var>AA</var> is the exit status. This is only
  250. applicable to certain targets.
  251. </p>
  252. <p>The second form of the response, including the process ID of the
  253. exited process, can be used only when <small>GDB</small> has reported
  254. support for multiprocess protocol extensions; see <a href="General-Query-Packets.html#multiprocess-extensions">multiprocess extensions</a>. Both <var>AA</var> and <var>pid</var> are formatted as big-endian
  255. hex strings.
  256. </p>
  257. </dd>
  258. <dt>&lsquo;<samp>X <var>AA</var></samp>&rsquo;</dt>
  259. <dt>&lsquo;<samp>X <var>AA</var> ; process:<var>pid</var></samp>&rsquo;</dt>
  260. <dd><p>The process terminated with signal <var>AA</var>.
  261. </p>
  262. <p>The second form of the response, including the process ID of the
  263. terminated process, can be used only when <small>GDB</small> has reported
  264. support for multiprocess protocol extensions; see <a href="General-Query-Packets.html#multiprocess-extensions">multiprocess extensions</a>. Both <var>AA</var> and <var>pid</var> are formatted as big-endian
  265. hex strings.
  266. </p>
  267. <a name="thread-exit-event"></a><a name="index-thread-exit-event_002c-remote-reply"></a>
  268. </dd>
  269. <dt>&lsquo;<samp>w <var>AA</var> ; <var>tid</var></samp>&rsquo;</dt>
  270. <dd>
  271. <p>The thread exited, and <var>AA</var> is the exit status. This response
  272. should not be sent by default; <small>GDB</small> requests it with the
  273. <a href="General-Query-Packets.html#QThreadEvents">QThreadEvents</a> packet. See also <a href="#thread-create-event">thread create event</a> above.
  274. <var>AA</var> is formatted as a big-endian hex string.
  275. </p>
  276. </dd>
  277. <dt>&lsquo;<samp>N</samp>&rsquo;</dt>
  278. <dd><p>There are no resumed threads left in the target. In other words, even
  279. though the process is alive, the last resumed thread has exited. For
  280. example, say the target process has two threads: thread 1 and thread
  281. 2. The client leaves thread 1 stopped, and resumes thread 2, which
  282. subsequently exits. At this point, even though the process is still
  283. alive, and thus no &lsquo;<samp>W</samp>&rsquo; stop reply is sent, no thread is actually
  284. executing either. The &lsquo;<samp>N</samp>&rsquo; stop reply thus informs the client
  285. that it can stop waiting for stop replies. This packet should not be
  286. sent by default; older <small>GDB</small> versions did not support it.
  287. <small>GDB</small> requests it, by supplying an appropriate
  288. &lsquo;<samp>qSupported</samp>&rsquo; feature (see <a href="General-Query-Packets.html#qSupported">qSupported</a>). The remote stub must
  289. also supply the appropriate &lsquo;<samp>qSupported</samp>&rsquo; feature indicating
  290. support.
  291. </p>
  292. </dd>
  293. <dt>&lsquo;<samp>O <var>XX</var>&hellip;</samp>&rsquo;</dt>
  294. <dd><p>&lsquo;<samp><var>XX</var>&hellip;</samp>&rsquo; is hex encoding of <small>ASCII</small> data, to be
  295. written as the program&rsquo;s console output. This can happen at any time
  296. while the program is running and the debugger should continue to wait
  297. for &lsquo;<samp>W</samp>&rsquo;, &lsquo;<samp>T</samp>&rsquo;, etc. This reply is not permitted in non-stop mode.
  298. </p>
  299. </dd>
  300. <dt>&lsquo;<samp>F <var>call-id</var>,<var>parameter</var>&hellip;</samp>&rsquo;</dt>
  301. <dd><p><var>call-id</var> is the identifier which says which host system call should
  302. be called. This is just the name of the function. Translation into the
  303. correct system call is only applicable as it&rsquo;s defined in <small>GDB</small>.
  304. See <a href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a>, for a list of implemented
  305. system calls.
  306. </p>
  307. <p>&lsquo;<samp><var>parameter</var>&hellip;</samp>&rsquo; is a list of parameters as defined for
  308. this very system call.
  309. </p>
  310. <p>The target replies with this packet when it expects <small>GDB</small> to
  311. call a host system call on behalf of the target. <small>GDB</small> replies
  312. with an appropriate &lsquo;<samp>F</samp>&rsquo; packet and keeps up waiting for the next
  313. reply packet from the target. The latest &lsquo;<samp>C</samp>&rsquo;, &lsquo;<samp>c</samp>&rsquo;, &lsquo;<samp>S</samp>&rsquo;
  314. or &lsquo;<samp>s</samp>&rsquo; action is expected to be continued. See <a href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a>, for more details.
  315. </p>
  316. </dd>
  317. </dl>
  318. <hr>
  319. <div class="header">
  320. <p>
  321. Next: <a href="General-Query-Packets.html#General-Query-Packets" accesskey="n" rel="next">General Query Packets</a>, Previous: <a href="Packets.html#Packets" accesskey="p" rel="prev">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>
  322. </div>
  323. </body>
  324. </html>