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.

1000 lines
44KB

  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>Packets (Debugging with GDB)</title>
  17. <meta name="description" content="Packets (Debugging with GDB)">
  18. <meta name="keywords" content="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="Stop-Reply-Packets.html#Stop-Reply-Packets" rel="next" title="Stop Reply Packets">
  27. <link href="Overview.html#Overview" rel="prev" title="Overview">
  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="Packets"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Stop-Reply-Packets.html#Stop-Reply-Packets" accesskey="n" rel="next">Stop Reply Packets</a>, Previous: <a href="Overview.html#Overview" accesskey="p" rel="prev">Overview</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="Packets-1"></a>
  64. <h3 class="section">E.2 Packets</h3>
  65. <p>The following table provides a complete list of all currently defined
  66. <var>command</var>s and their corresponding response <var>data</var>.
  67. See <a href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a>, for details about the File
  68. I/O extension of the remote protocol.
  69. </p>
  70. <p>Each packet&rsquo;s description has a template showing the packet&rsquo;s overall
  71. syntax, followed by an explanation of the packet&rsquo;s meaning. We
  72. include spaces in some of the templates for clarity; these are not
  73. part of the packet&rsquo;s syntax. No <small>GDB</small> packet uses spaces to
  74. separate its components. For example, a template like &lsquo;<samp>foo
  75. <var>bar</var> <var>baz</var></samp>&rsquo; describes a packet beginning with the three ASCII
  76. bytes &lsquo;<samp>foo</samp>&rsquo;, followed by a <var>bar</var>, followed directly by a
  77. <var>baz</var>. <small>GDB</small> does not transmit a space character between the
  78. &lsquo;<samp>foo</samp>&rsquo; and the <var>bar</var>, or between the <var>bar</var> and the
  79. <var>baz</var>.
  80. </p>
  81. <a name="index-thread_002did_002c-in-remote-protocol"></a>
  82. <a name="thread_002did-syntax"></a><p>Several packets and replies include a <var>thread-id</var> field to identify
  83. a thread. Normally these are positive numbers with a target-specific
  84. interpretation, formatted as big-endian hex strings. A <var>thread-id</var>
  85. can also be a literal &lsquo;<samp>-1</samp>&rsquo; to indicate all threads, or &lsquo;<samp>0</samp>&rsquo; to
  86. pick any thread.
  87. </p>
  88. <p>In addition, the remote protocol supports a multiprocess feature in
  89. which the <var>thread-id</var> syntax is extended to optionally include both
  90. process and thread ID fields, as &lsquo;<samp>p<var>pid</var>.<var>tid</var></samp>&rsquo;.
  91. The <var>pid</var> (process) and <var>tid</var> (thread) components each have the
  92. format described above: a positive number with target-specific
  93. interpretation formatted as a big-endian hex string, literal &lsquo;<samp>-1</samp>&rsquo;
  94. to indicate all processes or threads (respectively), or &lsquo;<samp>0</samp>&rsquo; to
  95. indicate an arbitrary process or thread. Specifying just a process, as
  96. &lsquo;<samp>p<var>pid</var></samp>&rsquo;, is equivalent to &lsquo;<samp>p<var>pid</var>.-1</samp>&rsquo;. It is an
  97. error to specify all processes but a specific thread, such as
  98. &lsquo;<samp>p-1.<var>tid</var></samp>&rsquo;. Note that the &lsquo;<samp>p</samp>&rsquo; prefix is <em>not</em> used
  99. for those packets and replies explicitly documented to include a process
  100. ID, rather than a <var>thread-id</var>.
  101. </p>
  102. <p>The multiprocess <var>thread-id</var> syntax extensions are only used if both
  103. <small>GDB</small> and the stub report support for the &lsquo;<samp>multiprocess</samp>&rsquo;
  104. feature using &lsquo;<samp>qSupported</samp>&rsquo;. See <a href="General-Query-Packets.html#multiprocess-extensions">multiprocess extensions</a>, for
  105. more information.
  106. </p>
  107. <p>Note that all packet forms beginning with an upper- or lower-case
  108. letter, other than those described here, are reserved for future use.
  109. </p>
  110. <p>Here are the packet descriptions.
  111. </p>
  112. <dl compact="compact">
  113. <dt>&lsquo;<samp>!</samp>&rsquo;</dt>
  114. <dd><a name="index-_0021-packet"></a>
  115. <a name="extended-mode"></a><p>Enable extended mode. In extended mode, the remote server is made
  116. persistent. The &lsquo;<samp>R</samp>&rsquo; packet is used to restart the program being
  117. debugged.
  118. </p>
  119. <p>Reply:
  120. </p><dl compact="compact">
  121. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  122. <dd><p>The remote target both supports and has enabled extended mode.
  123. </p></dd>
  124. </dl>
  125. </dd>
  126. <dt>&lsquo;<samp>?</samp>&rsquo;</dt>
  127. <dd><a name="index-_003f-packet"></a>
  128. <a name="g_t_003f-packet"></a><p>Indicate the reason the target halted. The reply is the same as for
  129. step and continue. This packet has a special interpretation when the
  130. target is in non-stop mode; see <a href="Remote-Non_002dStop.html#Remote-Non_002dStop">Remote Non-Stop</a>.
  131. </p>
  132. <p>Reply:
  133. See <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>, for the reply specifications.
  134. </p>
  135. </dd>
  136. <dt>&lsquo;<samp>A <var>arglen</var>,<var>argnum</var>,<var>arg</var>,&hellip;</samp>&rsquo;</dt>
  137. <dd><a name="index-A-packet"></a>
  138. <p>Initialized <code>argv[]</code> array passed into program. <var>arglen</var>
  139. specifies the number of bytes in the hex encoded byte stream
  140. <var>arg</var>. See <code>gdbserver</code> for more details.
  141. </p>
  142. <p>Reply:
  143. </p><dl compact="compact">
  144. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  145. <dd><p>The arguments were set.
  146. </p></dd>
  147. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  148. <dd><p>An error occurred.
  149. </p></dd>
  150. </dl>
  151. </dd>
  152. <dt>&lsquo;<samp>b <var>baud</var></samp>&rsquo;</dt>
  153. <dd><a name="index-b-packet"></a>
  154. <p>(Don&rsquo;t use this packet; its behavior is not well-defined.)
  155. Change the serial line speed to <var>baud</var>.
  156. </p>
  157. <p>JTC: <em>When does the transport layer state change? When it&rsquo;s
  158. received, or after the ACK is transmitted. In either case, there are
  159. problems if the command or the acknowledgment packet is dropped.</em>
  160. </p>
  161. <p>Stan: <em>If people really wanted to add something like this, and get
  162. it working for the first time, they ought to modify ser-unix.c to send
  163. some kind of out-of-band message to a specially-setup stub and have the
  164. switch happen &quot;in between&quot; packets, so that from remote protocol&rsquo;s point
  165. of view, nothing actually happened.</em>
  166. </p>
  167. </dd>
  168. <dt>&lsquo;<samp>B <var>addr</var>,<var>mode</var></samp>&rsquo;</dt>
  169. <dd><a name="index-B-packet"></a>
  170. <p>Set (<var>mode</var> is &lsquo;<samp>S</samp>&rsquo;) or clear (<var>mode</var> is &lsquo;<samp>C</samp>&rsquo;) a
  171. breakpoint at <var>addr</var>.
  172. </p>
  173. <p>Don&rsquo;t use this packet. Use the &lsquo;<samp>Z</samp>&rsquo; and &lsquo;<samp>z</samp>&rsquo; packets instead
  174. (see <a href="#insert-breakpoint-or-watchpoint-packet">insert breakpoint or watchpoint packet</a>).
  175. </p>
  176. <a name="index-bc-packet"></a>
  177. <a name="bc"></a></dd>
  178. <dt>&lsquo;<samp>bc</samp>&rsquo;</dt>
  179. <dd><p>Backward continue. Execute the target system in reverse. No parameter.
  180. See <a href="Reverse-Execution.html#Reverse-Execution">Reverse Execution</a>, for more information.
  181. </p>
  182. <p>Reply:
  183. See <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>, for the reply specifications.
  184. </p>
  185. <a name="index-bs-packet"></a>
  186. <a name="bs"></a></dd>
  187. <dt>&lsquo;<samp>bs</samp>&rsquo;</dt>
  188. <dd><p>Backward single step. Execute one instruction in reverse. No parameter.
  189. See <a href="Reverse-Execution.html#Reverse-Execution">Reverse Execution</a>, for more information.
  190. </p>
  191. <p>Reply:
  192. See <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>, for the reply specifications.
  193. </p>
  194. </dd>
  195. <dt>&lsquo;<samp>c <span class="roman">[</span><var>addr</var><span class="roman">]</span></samp>&rsquo;</dt>
  196. <dd><a name="index-c-packet"></a>
  197. <p>Continue at <var>addr</var>, which is the address to resume. If <var>addr</var>
  198. is omitted, resume at current address.
  199. </p>
  200. <p>This packet is deprecated for multi-threading support. See <a href="#vCont-packet">vCont packet</a>.
  201. </p>
  202. <p>Reply:
  203. See <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>, for the reply specifications.
  204. </p>
  205. </dd>
  206. <dt>&lsquo;<samp>C <var>sig</var><span class="roman">[</span>;<var>addr</var><span class="roman">]</span></samp>&rsquo;</dt>
  207. <dd><a name="index-C-packet"></a>
  208. <p>Continue with signal <var>sig</var> (hex signal number). If
  209. &lsquo;<samp>;<var>addr</var></samp>&rsquo; is omitted, resume at same address.
  210. </p>
  211. <p>This packet is deprecated for multi-threading support. See <a href="#vCont-packet">vCont packet</a>.
  212. </p>
  213. <p>Reply:
  214. See <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>, for the reply specifications.
  215. </p>
  216. </dd>
  217. <dt>&lsquo;<samp>d</samp>&rsquo;</dt>
  218. <dd><a name="index-d-packet"></a>
  219. <p>Toggle debug flag.
  220. </p>
  221. <p>Don&rsquo;t use this packet; instead, define a general set packet
  222. (see <a href="General-Query-Packets.html#General-Query-Packets">General Query Packets</a>).
  223. </p>
  224. </dd>
  225. <dt>&lsquo;<samp>D</samp>&rsquo;</dt>
  226. <dt>&lsquo;<samp>D;<var>pid</var></samp>&rsquo;</dt>
  227. <dd><a name="index-D-packet"></a>
  228. <p>The first form of the packet is used to detach <small>GDB</small> from the
  229. remote system. It is sent to the remote target
  230. before <small>GDB</small> disconnects via the <code>detach</code> command.
  231. </p>
  232. <p>The second form, including a process ID, is used when multiprocess
  233. protocol extensions are enabled (see <a href="General-Query-Packets.html#multiprocess-extensions">multiprocess extensions</a>), to
  234. detach only a specific process. The <var>pid</var> is specified as a
  235. big-endian hex string.
  236. </p>
  237. <p>Reply:
  238. </p><dl compact="compact">
  239. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  240. <dd><p>for success
  241. </p></dd>
  242. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  243. <dd><p>for an error
  244. </p></dd>
  245. </dl>
  246. </dd>
  247. <dt>&lsquo;<samp>F <var>RC</var>,<var>EE</var>,<var>CF</var>;<var>XX</var></samp>&rsquo;</dt>
  248. <dd><a name="index-F-packet"></a>
  249. <p>A reply from <small>GDB</small> to an &lsquo;<samp>F</samp>&rsquo; packet sent by the target.
  250. This is part of the File-I/O protocol extension. See <a href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a>, for the specification.
  251. </p>
  252. </dd>
  253. <dt>&lsquo;<samp>g</samp>&rsquo;</dt>
  254. <dd><a name="read-registers-packet"></a><a name="index-g-packet"></a>
  255. <p>Read general registers.
  256. </p>
  257. <p>Reply:
  258. </p><dl compact="compact">
  259. <dt>&lsquo;<samp><var>XX&hellip;</var></samp>&rsquo;</dt>
  260. <dd><p>Each byte of register data is described by two hex digits. The bytes
  261. with the register are transmitted in target byte order. The size of
  262. each register and their position within the &lsquo;<samp>g</samp>&rsquo; packet are
  263. determined by the <small>GDB</small> internal gdbarch functions
  264. <code>DEPRECATED_REGISTER_RAW_SIZE</code> and <code>gdbarch_register_name</code>.
  265. </p>
  266. <p>When reading registers from a trace frame (see <a href="Analyze-Collected-Data.html#Analyze-Collected-Data">Using the Collected Data</a>), the stub may also return a string of
  267. literal &lsquo;<samp>x</samp>&rsquo;&rsquo;s in place of the register data digits, to indicate
  268. that the corresponding register has not been collected, thus its value
  269. is unavailable. For example, for an architecture with 4 registers of
  270. 4 bytes each, the following reply indicates to <small>GDB</small> that
  271. registers 0 and 2 have not been collected, while registers 1 and 3
  272. have been collected, and both have zero value:
  273. </p>
  274. <div class="smallexample">
  275. <pre class="smallexample">-&gt; <code>g</code>
  276. &lt;- <code>xxxxxxxx00000000xxxxxxxx00000000</code>
  277. </pre></div>
  278. </dd>
  279. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  280. <dd><p>for an error.
  281. </p></dd>
  282. </dl>
  283. </dd>
  284. <dt>&lsquo;<samp>G <var>XX&hellip;</var></samp>&rsquo;</dt>
  285. <dd><a name="index-G-packet"></a>
  286. <p>Write general registers. See <a href="#read-registers-packet">read registers packet</a>, for a
  287. description of the <var>XX&hellip;</var> data.
  288. </p>
  289. <p>Reply:
  290. </p><dl compact="compact">
  291. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  292. <dd><p>for success
  293. </p></dd>
  294. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  295. <dd><p>for an error
  296. </p></dd>
  297. </dl>
  298. </dd>
  299. <dt>&lsquo;<samp>H <var>op</var> <var>thread-id</var></samp>&rsquo;</dt>
  300. <dd><a name="index-H-packet"></a>
  301. <p>Set thread for subsequent operations (&lsquo;<samp>m</samp>&rsquo;, &lsquo;<samp>M</samp>&rsquo;, &lsquo;<samp>g</samp>&rsquo;,
  302. &lsquo;<samp>G</samp>&rsquo;, et.al.). Depending on the operation to be performed, <var>op</var>
  303. should be &lsquo;<samp>c</samp>&rsquo; for step and continue operations (note that this
  304. is deprecated, supporting the &lsquo;<samp>vCont</samp>&rsquo; command is a better
  305. option), and &lsquo;<samp>g</samp>&rsquo; for other operations. The thread designator
  306. <var>thread-id</var> has the format and interpretation described in
  307. <a href="#thread_002did-syntax">thread-id syntax</a>.
  308. </p>
  309. <p>Reply:
  310. </p><dl compact="compact">
  311. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  312. <dd><p>for success
  313. </p></dd>
  314. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  315. <dd><p>for an error
  316. </p></dd>
  317. </dl>
  318. </dd>
  319. <dt>&lsquo;<samp>i <span class="roman">[</span><var>addr</var><span class="roman">[</span>,<var>nnn</var><span class="roman">]]</span></samp>&rsquo;</dt>
  320. <dd><a name="cycle-step-packet"></a><a name="index-i-packet"></a>
  321. <p>Step the remote target by a single clock cycle. If &lsquo;<samp>,<var>nnn</var></samp>&rsquo; is
  322. present, cycle step <var>nnn</var> cycles. If <var>addr</var> is present, cycle
  323. step starting at that address.
  324. </p>
  325. </dd>
  326. <dt>&lsquo;<samp>I</samp>&rsquo;</dt>
  327. <dd><a name="index-I-packet"></a>
  328. <p>Signal, then cycle step. See <a href="#step-with-signal-packet">step with signal packet</a>. See <a href="#cycle-step-packet">cycle step packet</a>.
  329. </p>
  330. </dd>
  331. <dt>&lsquo;<samp>k</samp>&rsquo;</dt>
  332. <dd><a name="index-k-packet"></a>
  333. <p>Kill request.
  334. </p>
  335. <p>The exact effect of this packet is not specified.
  336. </p>
  337. <p>For a bare-metal target, it may power cycle or reset the target
  338. system. For that reason, the &lsquo;<samp>k</samp>&rsquo; packet has no reply.
  339. </p>
  340. <p>For a single-process target, it may kill that process if possible.
  341. </p>
  342. <p>A multiple-process target may choose to kill just one process, or all
  343. that are under <small>GDB</small>&rsquo;s control. For more precise control, use
  344. the vKill packet (see <a href="#vKill-packet">vKill packet</a>).
  345. </p>
  346. <p>If the target system immediately closes the connection in response to
  347. &lsquo;<samp>k</samp>&rsquo;, <small>GDB</small> does not consider the lack of packet
  348. acknowledgment to be an error, and assumes the kill was successful.
  349. </p>
  350. <p>If connected using <kbd>target extended-remote</kbd>, and the target does
  351. not close the connection in response to a kill request, <small>GDB</small>
  352. probes the target state as if a new connection was opened
  353. (see <a href="#g_t_003f-packet">? packet</a>).
  354. </p>
  355. </dd>
  356. <dt>&lsquo;<samp>m <var>addr</var>,<var>length</var></samp>&rsquo;</dt>
  357. <dd><a name="index-m-packet"></a>
  358. <p>Read <var>length</var> addressable memory units starting at address <var>addr</var>
  359. (see <a href="Memory.html#addressable-memory-unit">addressable memory unit</a>). Note that <var>addr</var> may not be aligned to
  360. any particular boundary.
  361. </p>
  362. <p>The stub need not use any particular size or alignment when gathering
  363. data from memory for the response; even if <var>addr</var> is word-aligned
  364. and <var>length</var> is a multiple of the word size, the stub is free to
  365. use byte accesses, or not. For this reason, this packet may not be
  366. suitable for accessing memory-mapped I/O devices.
  367. <a name="index-alignment-of-remote-memory-accesses"></a>
  368. <a name="index-size-of-remote-memory-accesses"></a>
  369. <a name="index-memory_002c-alignment-and-size-of-remote-accesses"></a>
  370. </p>
  371. <p>Reply:
  372. </p><dl compact="compact">
  373. <dt>&lsquo;<samp><var>XX&hellip;</var></samp>&rsquo;</dt>
  374. <dd><p>Memory contents; each byte is transmitted as a two-digit hexadecimal number.
  375. The reply may contain fewer addressable memory units than requested if the
  376. server was able to read only part of the region of memory.
  377. </p></dd>
  378. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  379. <dd><p><var>NN</var> is errno
  380. </p></dd>
  381. </dl>
  382. </dd>
  383. <dt>&lsquo;<samp>M <var>addr</var>,<var>length</var>:<var>XX&hellip;</var></samp>&rsquo;</dt>
  384. <dd><a name="index-M-packet"></a>
  385. <p>Write <var>length</var> addressable memory units starting at address <var>addr</var>
  386. (see <a href="Memory.html#addressable-memory-unit">addressable memory unit</a>). The data is given by <var>XX&hellip;</var>; each
  387. byte is transmitted as a two-digit hexadecimal number.
  388. </p>
  389. <p>Reply:
  390. </p><dl compact="compact">
  391. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  392. <dd><p>for success
  393. </p></dd>
  394. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  395. <dd><p>for an error (this includes the case where only part of the data was
  396. written).
  397. </p></dd>
  398. </dl>
  399. </dd>
  400. <dt>&lsquo;<samp>p <var>n</var></samp>&rsquo;</dt>
  401. <dd><a name="index-p-packet"></a>
  402. <p>Read the value of register <var>n</var>; <var>n</var> is in hex.
  403. See <a href="#read-registers-packet">read registers packet</a>, for a description of how the returned
  404. register value is encoded.
  405. </p>
  406. <p>Reply:
  407. </p><dl compact="compact">
  408. <dt>&lsquo;<samp><var>XX&hellip;</var></samp>&rsquo;</dt>
  409. <dd><p>the register&rsquo;s value
  410. </p></dd>
  411. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  412. <dd><p>for an error
  413. </p></dd>
  414. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  415. <dd><p>Indicating an unrecognized <var>query</var>.
  416. </p></dd>
  417. </dl>
  418. </dd>
  419. <dt>&lsquo;<samp>P <var>n&hellip;</var>=<var>r&hellip;</var></samp>&rsquo;</dt>
  420. <dd><a name="write-register-packet"></a><a name="index-P-packet"></a>
  421. <p>Write register <var>n&hellip;</var> with value <var>r&hellip;</var>. The register
  422. number <var>n</var> is in hexadecimal, and <var>r&hellip;</var> contains two hex
  423. digits for each byte in the register (target byte order).
  424. </p>
  425. <p>Reply:
  426. </p><dl compact="compact">
  427. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  428. <dd><p>for success
  429. </p></dd>
  430. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  431. <dd><p>for an error
  432. </p></dd>
  433. </dl>
  434. </dd>
  435. <dt>&lsquo;<samp>q <var>name</var> <var>params</var>&hellip;</samp>&rsquo;</dt>
  436. <dt>&lsquo;<samp>Q <var>name</var> <var>params</var>&hellip;</samp>&rsquo;</dt>
  437. <dd><a name="index-q-packet"></a>
  438. <a name="index-Q-packet"></a>
  439. <p>General query (&lsquo;<samp>q</samp>&rsquo;) and set (&lsquo;<samp>Q</samp>&rsquo;). These packets are
  440. described fully in <a href="General-Query-Packets.html#General-Query-Packets">General Query Packets</a>.
  441. </p>
  442. </dd>
  443. <dt>&lsquo;<samp>r</samp>&rsquo;</dt>
  444. <dd><a name="index-r-packet"></a>
  445. <p>Reset the entire system.
  446. </p>
  447. <p>Don&rsquo;t use this packet; use the &lsquo;<samp>R</samp>&rsquo; packet instead.
  448. </p>
  449. </dd>
  450. <dt>&lsquo;<samp>R <var>XX</var></samp>&rsquo;</dt>
  451. <dd><a name="index-R-packet"></a>
  452. <p>Restart the program being debugged. The <var>XX</var>, while needed, is ignored.
  453. This packet is only available in extended mode (see <a href="#extended-mode">extended mode</a>).
  454. </p>
  455. <p>The &lsquo;<samp>R</samp>&rsquo; packet has no reply.
  456. </p>
  457. </dd>
  458. <dt>&lsquo;<samp>s <span class="roman">[</span><var>addr</var><span class="roman">]</span></samp>&rsquo;</dt>
  459. <dd><a name="index-s-packet"></a>
  460. <p>Single step, resuming at <var>addr</var>. If
  461. <var>addr</var> is omitted, resume at same address.
  462. </p>
  463. <p>This packet is deprecated for multi-threading support. See <a href="#vCont-packet">vCont packet</a>.
  464. </p>
  465. <p>Reply:
  466. See <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>, for the reply specifications.
  467. </p>
  468. </dd>
  469. <dt>&lsquo;<samp>S <var>sig</var><span class="roman">[</span>;<var>addr</var><span class="roman">]</span></samp>&rsquo;</dt>
  470. <dd><a name="step-with-signal-packet"></a><a name="index-S-packet"></a>
  471. <p>Step with signal. This is analogous to the &lsquo;<samp>C</samp>&rsquo; packet, but
  472. requests a single-step, rather than a normal resumption of execution.
  473. </p>
  474. <p>This packet is deprecated for multi-threading support. See <a href="#vCont-packet">vCont packet</a>.
  475. </p>
  476. <p>Reply:
  477. See <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>, for the reply specifications.
  478. </p>
  479. </dd>
  480. <dt>&lsquo;<samp>t <var>addr</var>:<var>PP</var>,<var>MM</var></samp>&rsquo;</dt>
  481. <dd><a name="index-t-packet"></a>
  482. <p>Search backwards starting at address <var>addr</var> for a match with pattern
  483. <var>PP</var> and mask <var>MM</var>, both of which are are 4 byte long.
  484. There must be at least 3 digits in <var>addr</var>.
  485. </p>
  486. </dd>
  487. <dt>&lsquo;<samp>T <var>thread-id</var></samp>&rsquo;</dt>
  488. <dd><a name="index-T-packet"></a>
  489. <p>Find out if the thread <var>thread-id</var> is alive. See <a href="#thread_002did-syntax">thread-id syntax</a>.
  490. </p>
  491. <p>Reply:
  492. </p><dl compact="compact">
  493. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  494. <dd><p>thread is still alive
  495. </p></dd>
  496. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  497. <dd><p>thread is dead
  498. </p></dd>
  499. </dl>
  500. </dd>
  501. <dt>&lsquo;<samp>v</samp>&rsquo;</dt>
  502. <dd><p>Packets starting with &lsquo;<samp>v</samp>&rsquo; are identified by a multi-letter name,
  503. up to the first &lsquo;<samp>;</samp>&rsquo; or &lsquo;<samp>?</samp>&rsquo; (or the end of the packet).
  504. </p>
  505. </dd>
  506. <dt>&lsquo;<samp>vAttach;<var>pid</var></samp>&rsquo;</dt>
  507. <dd><a name="index-vAttach-packet"></a>
  508. <p>Attach to a new process with the specified process ID <var>pid</var>.
  509. The process ID is a
  510. hexadecimal integer identifying the process. In all-stop mode, all
  511. threads in the attached process are stopped; in non-stop mode, it may be
  512. attached without being stopped if that is supported by the target.
  513. </p>
  514. <p>This packet is only available in extended mode (see <a href="#extended-mode">extended mode</a>).
  515. </p>
  516. <p>Reply:
  517. </p><dl compact="compact">
  518. <dt>&lsquo;<samp>E <var>nn</var></samp>&rsquo;</dt>
  519. <dd><p>for an error
  520. </p></dd>
  521. <dt>&lsquo;<samp><span class="roman">Any stop packet</span></samp>&rsquo;</dt>
  522. <dd><p>for success in all-stop mode (see <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>)
  523. </p></dd>
  524. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  525. <dd><p>for success in non-stop mode (see <a href="Remote-Non_002dStop.html#Remote-Non_002dStop">Remote Non-Stop</a>)
  526. </p></dd>
  527. </dl>
  528. </dd>
  529. <dt>&lsquo;<samp>vCont<span class="roman">[</span>;<var>action</var><span class="roman">[</span>:<var>thread-id</var><span class="roman">]]</span>&hellip;</samp>&rsquo;</dt>
  530. <dd><a name="index-vCont-packet"></a>
  531. <a name="vCont-packet"></a><p>Resume the inferior, specifying different actions for each thread.
  532. </p>
  533. <p>For each inferior thread, the leftmost action with a matching
  534. <var>thread-id</var> is applied. Threads that don&rsquo;t match any action
  535. remain in their current state. Thread IDs are specified using the
  536. syntax described in <a href="#thread_002did-syntax">thread-id syntax</a>. If multiprocess
  537. extensions (see <a href="General-Query-Packets.html#multiprocess-extensions">multiprocess extensions</a>) are supported, actions
  538. can be specified to match all threads in a process by using the
  539. &lsquo;<samp>p<var>pid</var>.-1</samp>&rsquo; form of the <var>thread-id</var>. An action with no
  540. <var>thread-id</var> matches all threads. Specifying no actions is an
  541. error.
  542. </p>
  543. <p>Currently supported actions are:
  544. </p>
  545. <dl compact="compact">
  546. <dt>&lsquo;<samp>c</samp>&rsquo;</dt>
  547. <dd><p>Continue.
  548. </p></dd>
  549. <dt>&lsquo;<samp>C <var>sig</var></samp>&rsquo;</dt>
  550. <dd><p>Continue with signal <var>sig</var>. The signal <var>sig</var> should be two hex digits.
  551. </p></dd>
  552. <dt>&lsquo;<samp>s</samp>&rsquo;</dt>
  553. <dd><p>Step.
  554. </p></dd>
  555. <dt>&lsquo;<samp>S <var>sig</var></samp>&rsquo;</dt>
  556. <dd><p>Step with signal <var>sig</var>. The signal <var>sig</var> should be two hex digits.
  557. </p></dd>
  558. <dt>&lsquo;<samp>t</samp>&rsquo;</dt>
  559. <dd><p>Stop.
  560. </p></dd>
  561. <dt>&lsquo;<samp>r <var>start</var>,<var>end</var></samp>&rsquo;</dt>
  562. <dd><p>Step once, and then keep stepping as long as the thread stops at
  563. addresses between <var>start</var> (inclusive) and <var>end</var> (exclusive).
  564. The remote stub reports a stop reply when either the thread goes out
  565. of the range or is stopped due to an unrelated reason, such as hitting
  566. a breakpoint. See <a href="Continuing-and-Stepping.html#range-stepping">range stepping</a>.
  567. </p>
  568. <p>If the range is empty (<var>start</var> == <var>end</var>), then the action
  569. becomes equivalent to the &lsquo;<samp>s</samp>&rsquo; action. In other words,
  570. single-step once, and report the stop (even if the stepped instruction
  571. jumps to <var>start</var>).
  572. </p>
  573. <p>(A stop reply may be sent at any point even if the PC is still within
  574. the stepping range; for example, it is valid to implement this packet
  575. in a degenerate way as a single instruction step operation.)
  576. </p>
  577. </dd>
  578. </dl>
  579. <p>The optional argument <var>addr</var> normally associated with the
  580. &lsquo;<samp>c</samp>&rsquo;, &lsquo;<samp>C</samp>&rsquo;, &lsquo;<samp>s</samp>&rsquo;, and &lsquo;<samp>S</samp>&rsquo; packets is
  581. not supported in &lsquo;<samp>vCont</samp>&rsquo;.
  582. </p>
  583. <p>The &lsquo;<samp>t</samp>&rsquo; action is only relevant in non-stop mode
  584. (see <a href="Remote-Non_002dStop.html#Remote-Non_002dStop">Remote Non-Stop</a>) and may be ignored by the stub otherwise.
  585. A stop reply should be generated for any affected thread not already stopped.
  586. When a thread is stopped by means of a &lsquo;<samp>t</samp>&rsquo; action,
  587. the corresponding stop reply should indicate that the thread has stopped with
  588. signal &lsquo;<samp>0</samp>&rsquo;, regardless of whether the target uses some other signal
  589. as an implementation detail.
  590. </p>
  591. <p>The server must ignore &lsquo;<samp>c</samp>&rsquo;, &lsquo;<samp>C</samp>&rsquo;, &lsquo;<samp>s</samp>&rsquo;, &lsquo;<samp>S</samp>&rsquo;, and
  592. &lsquo;<samp>r</samp>&rsquo; actions for threads that are already running. Conversely,
  593. the server must ignore &lsquo;<samp>t</samp>&rsquo; actions for threads that are already
  594. stopped.
  595. </p>
  596. <p><em>Note:</em> In non-stop mode, a thread is considered running until
  597. <small>GDB</small> acknowledges an asynchronous stop notification for it with
  598. the &lsquo;<samp>vStopped</samp>&rsquo; packet (see <a href="Remote-Non_002dStop.html#Remote-Non_002dStop">Remote Non-Stop</a>).
  599. </p>
  600. <p>The stub must support &lsquo;<samp>vCont</samp>&rsquo; if it reports support for
  601. multiprocess extensions (see <a href="General-Query-Packets.html#multiprocess-extensions">multiprocess extensions</a>).
  602. </p>
  603. <p>Reply:
  604. See <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>, for the reply specifications.
  605. </p>
  606. </dd>
  607. <dt>&lsquo;<samp>vCont?</samp>&rsquo;</dt>
  608. <dd><a name="index-vCont_003f-packet"></a>
  609. <p>Request a list of actions supported by the &lsquo;<samp>vCont</samp>&rsquo; packet.
  610. </p>
  611. <p>Reply:
  612. </p><dl compact="compact">
  613. <dt>&lsquo;<samp>vCont<span class="roman">[</span>;<var>action</var>&hellip;<span class="roman">]</span></samp>&rsquo;</dt>
  614. <dd><p>The &lsquo;<samp>vCont</samp>&rsquo; packet is supported. Each <var>action</var> is a supported
  615. command in the &lsquo;<samp>vCont</samp>&rsquo; packet.
  616. </p></dd>
  617. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  618. <dd><p>The &lsquo;<samp>vCont</samp>&rsquo; packet is not supported.
  619. </p></dd>
  620. </dl>
  621. <a name="vCtrlC-packet"></a></dd>
  622. <dt>&lsquo;<samp>vCtrlC</samp>&rsquo;</dt>
  623. <dd><a name="index-vCtrlC-packet"></a>
  624. <p>Interrupt remote target as if a control-C was pressed on the remote
  625. terminal. This is the equivalent to reacting to the <code>^C</code>
  626. (&lsquo;<samp>\003</samp>&rsquo;, the control-C character) character in all-stop mode
  627. while the target is running, except this works in non-stop mode.
  628. See <a href="Interrupts.html#interrupting-remote-targets">interrupting remote targets</a>, for more info on the all-stop
  629. variant.
  630. </p>
  631. <p>Reply:
  632. </p><dl compact="compact">
  633. <dt>&lsquo;<samp>E <var>nn</var></samp>&rsquo;</dt>
  634. <dd><p>for an error
  635. </p></dd>
  636. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  637. <dd><p>for success
  638. </p></dd>
  639. </dl>
  640. </dd>
  641. <dt>&lsquo;<samp>vFile:<var>operation</var>:<var>parameter</var>&hellip;</samp>&rsquo;</dt>
  642. <dd><a name="index-vFile-packet"></a>
  643. <p>Perform a file operation on the target system. For details,
  644. see <a href="Host-I_002fO-Packets.html#Host-I_002fO-Packets">Host I/O Packets</a>.
  645. </p>
  646. </dd>
  647. <dt>&lsquo;<samp>vFlashErase:<var>addr</var>,<var>length</var></samp>&rsquo;</dt>
  648. <dd><a name="index-vFlashErase-packet"></a>
  649. <p>Direct the stub to erase <var>length</var> bytes of flash starting at
  650. <var>addr</var>. The region may enclose any number of flash blocks, but
  651. its start and end must fall on block boundaries, as indicated by the
  652. flash block size appearing in the memory map (see <a href="Memory-Map-Format.html#Memory-Map-Format">Memory Map Format</a>). <small>GDB</small> groups flash memory programming operations
  653. together, and sends a &lsquo;<samp>vFlashDone</samp>&rsquo; request after each group; the
  654. stub is allowed to delay erase operation until the &lsquo;<samp>vFlashDone</samp>&rsquo;
  655. packet is received.
  656. </p>
  657. <p>Reply:
  658. </p><dl compact="compact">
  659. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  660. <dd><p>for success
  661. </p></dd>
  662. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  663. <dd><p>for an error
  664. </p></dd>
  665. </dl>
  666. </dd>
  667. <dt>&lsquo;<samp>vFlashWrite:<var>addr</var>:<var>XX&hellip;</var></samp>&rsquo;</dt>
  668. <dd><a name="index-vFlashWrite-packet"></a>
  669. <p>Direct the stub to write data to flash address <var>addr</var>. The data
  670. is passed in binary form using the same encoding as for the &lsquo;<samp>X</samp>&rsquo;
  671. packet (see <a href="Overview.html#Binary-Data">Binary Data</a>). The memory ranges specified by
  672. &lsquo;<samp>vFlashWrite</samp>&rsquo; packets preceding a &lsquo;<samp>vFlashDone</samp>&rsquo; packet must
  673. not overlap, and must appear in order of increasing addresses
  674. (although &lsquo;<samp>vFlashErase</samp>&rsquo; packets for higher addresses may already
  675. have been received; the ordering is guaranteed only between
  676. &lsquo;<samp>vFlashWrite</samp>&rsquo; packets). If a packet writes to an address that was
  677. neither erased by a preceding &lsquo;<samp>vFlashErase</samp>&rsquo; packet nor by some other
  678. target-specific method, the results are unpredictable.
  679. </p>
  680. <p>Reply:
  681. </p><dl compact="compact">
  682. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  683. <dd><p>for success
  684. </p></dd>
  685. <dt>&lsquo;<samp>E.memtype</samp>&rsquo;</dt>
  686. <dd><p>for vFlashWrite addressing non-flash memory
  687. </p></dd>
  688. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  689. <dd><p>for an error
  690. </p></dd>
  691. </dl>
  692. </dd>
  693. <dt>&lsquo;<samp>vFlashDone</samp>&rsquo;</dt>
  694. <dd><a name="index-vFlashDone-packet"></a>
  695. <p>Indicate to the stub that flash programming operation is finished.
  696. The stub is permitted to delay or batch the effects of a group of
  697. &lsquo;<samp>vFlashErase</samp>&rsquo; and &lsquo;<samp>vFlashWrite</samp>&rsquo; packets until a
  698. &lsquo;<samp>vFlashDone</samp>&rsquo; packet is received. The contents of the affected
  699. regions of flash memory are unpredictable until the &lsquo;<samp>vFlashDone</samp>&rsquo;
  700. request is completed.
  701. </p>
  702. </dd>
  703. <dt>&lsquo;<samp>vKill;<var>pid</var></samp>&rsquo;</dt>
  704. <dd><a name="index-vKill-packet"></a>
  705. <a name="vKill-packet"></a><p>Kill the process with the specified process ID <var>pid</var>, which is a
  706. hexadecimal integer identifying the process. This packet is used in
  707. preference to &lsquo;<samp>k</samp>&rsquo; when multiprocess protocol extensions are
  708. supported; see <a href="General-Query-Packets.html#multiprocess-extensions">multiprocess extensions</a>.
  709. </p>
  710. <p>Reply:
  711. </p><dl compact="compact">
  712. <dt>&lsquo;<samp>E <var>nn</var></samp>&rsquo;</dt>
  713. <dd><p>for an error
  714. </p></dd>
  715. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  716. <dd><p>for success
  717. </p></dd>
  718. </dl>
  719. </dd>
  720. <dt>&lsquo;<samp>vMustReplyEmpty</samp>&rsquo;</dt>
  721. <dd><a name="index-vMustReplyEmpty-packet"></a>
  722. <p>The correct reply to an unknown &lsquo;<samp>v</samp>&rsquo; packet is to return the empty
  723. string, however, some older versions of <code>gdbserver</code> would
  724. incorrectly return &lsquo;<samp>OK</samp>&rsquo; for unknown &lsquo;<samp>v</samp>&rsquo; packets.
  725. </p>
  726. <p>The &lsquo;<samp>vMustReplyEmpty</samp>&rsquo; is used as a feature test to check how
  727. <code>gdbserver</code> handles unknown packets, it is important that this
  728. packet be handled in the same way as other unknown &lsquo;<samp>v</samp>&rsquo; packets.
  729. If this packet is handled differently to other unknown &lsquo;<samp>v</samp>&rsquo;
  730. packets then it is possible that <small>GDB</small> may run into problems in
  731. other areas, specifically around use of &lsquo;<samp>vFile:setfs:</samp>&rsquo;.
  732. </p>
  733. </dd>
  734. <dt>&lsquo;<samp>vRun;<var>filename</var><span class="roman">[</span>;<var>argument</var><span class="roman">]</span>&hellip;</samp>&rsquo;</dt>
  735. <dd><a name="index-vRun-packet"></a>
  736. <p>Run the program <var>filename</var>, passing it each <var>argument</var> on its
  737. command line. The file and arguments are hex-encoded strings. If
  738. <var>filename</var> is an empty string, the stub may use a default program
  739. (e.g. the last program run). The program is created in the stopped
  740. state.
  741. </p>
  742. <p>This packet is only available in extended mode (see <a href="#extended-mode">extended mode</a>).
  743. </p>
  744. <p>Reply:
  745. </p><dl compact="compact">
  746. <dt>&lsquo;<samp>E <var>nn</var></samp>&rsquo;</dt>
  747. <dd><p>for an error
  748. </p></dd>
  749. <dt>&lsquo;<samp><span class="roman">Any stop packet</span></samp>&rsquo;</dt>
  750. <dd><p>for success (see <a href="Stop-Reply-Packets.html#Stop-Reply-Packets">Stop Reply Packets</a>)
  751. </p></dd>
  752. </dl>
  753. </dd>
  754. <dt>&lsquo;<samp>vStopped</samp>&rsquo;</dt>
  755. <dd><a name="index-vStopped-packet"></a>
  756. <p>See <a href="Notification-Packets.html#Notification-Packets">Notification Packets</a>.
  757. </p>
  758. </dd>
  759. <dt>&lsquo;<samp>X <var>addr</var>,<var>length</var>:<var>XX&hellip;</var></samp>&rsquo;</dt>
  760. <dd><a name="X-packet"></a><a name="index-X-packet"></a>
  761. <p>Write data to memory, where the data is transmitted in binary.
  762. Memory is specified by its address <var>addr</var> and number of addressable memory
  763. units <var>length</var> (see <a href="Memory.html#addressable-memory-unit">addressable memory unit</a>);
  764. &lsquo;<samp><var>XX</var>&hellip;</samp>&rsquo; is binary data (see <a href="Overview.html#Binary-Data">Binary Data</a>).
  765. </p>
  766. <p>Reply:
  767. </p><dl compact="compact">
  768. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  769. <dd><p>for success
  770. </p></dd>
  771. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  772. <dd><p>for an error
  773. </p></dd>
  774. </dl>
  775. </dd>
  776. <dt>&lsquo;<samp>z <var>type</var>,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  777. <dt>&lsquo;<samp>Z <var>type</var>,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  778. <dd><a name="insert-breakpoint-or-watchpoint-packet"></a><a name="index-z-packet"></a>
  779. <a name="index-Z-packets"></a>
  780. <p>Insert (&lsquo;<samp>Z</samp>&rsquo;) or remove (&lsquo;<samp>z</samp>&rsquo;) a <var>type</var> breakpoint or
  781. watchpoint starting at address <var>address</var> of kind <var>kind</var>.
  782. </p>
  783. <p>Each breakpoint and watchpoint packet <var>type</var> is documented
  784. separately.
  785. </p>
  786. <p><em>Implementation notes: A remote target shall return an empty string
  787. for an unrecognized breakpoint or watchpoint packet <var>type</var>. A
  788. remote target shall support either both or neither of a given
  789. &lsquo;<samp>Z<var>type</var>&hellip;</samp>&rsquo; and &lsquo;<samp>z<var>type</var>&hellip;</samp>&rsquo; packet pair. To
  790. avoid potential problems with duplicate packets, the operations should
  791. be implemented in an idempotent way.</em>
  792. </p>
  793. </dd>
  794. <dt>&lsquo;<samp>z0,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  795. <dt>&lsquo;<samp>Z0,<var>addr</var>,<var>kind</var><span class="roman">[</span>;<var>cond_list</var>&hellip;<span class="roman">]</span><span class="roman">[</span>;cmds:<var>persist</var>,<var>cmd_list</var>&hellip;<span class="roman">]</span></samp>&rsquo;</dt>
  796. <dd><a name="index-z0-packet"></a>
  797. <a name="index-Z0-packet"></a>
  798. <p>Insert (&lsquo;<samp>Z0</samp>&rsquo;) or remove (&lsquo;<samp>z0</samp>&rsquo;) a software breakpoint at address
  799. <var>addr</var> of type <var>kind</var>.
  800. </p>
  801. <p>A software breakpoint is implemented by replacing the instruction at
  802. <var>addr</var> with a software breakpoint or trap instruction. The
  803. <var>kind</var> is target-specific and typically indicates the size of the
  804. breakpoint in bytes that should be inserted. E.g., the <small>ARM</small> and
  805. <small>MIPS</small> can insert either a 2 or 4 byte breakpoint. Some
  806. architectures have additional meanings for <var>kind</var>
  807. (see <a href="Architecture_002dSpecific-Protocol-Details.html#Architecture_002dSpecific-Protocol-Details">Architecture-Specific Protocol Details</a>); if no
  808. architecture-specific value is being used, it should be &lsquo;<samp>0</samp>&rsquo;.
  809. <var>kind</var> is hex-encoded. <var>cond_list</var> is an optional list of
  810. conditional expressions in bytecode form that should be evaluated on
  811. the target&rsquo;s side. These are the conditions that should be taken into
  812. consideration when deciding if the breakpoint trigger should be
  813. reported back to <small>GDB</small>.
  814. </p>
  815. <p>See also the &lsquo;<samp>swbreak</samp>&rsquo; stop reason (see <a href="Stop-Reply-Packets.html#swbreak-stop-reason">swbreak stop reason</a>)
  816. for how to best report a software breakpoint event to <small>GDB</small>.
  817. </p>
  818. <p>The <var>cond_list</var> parameter is comprised of a series of expressions,
  819. concatenated without separators. Each expression has the following form:
  820. </p>
  821. <dl compact="compact">
  822. <dt>&lsquo;<samp>X <var>len</var>,<var>expr</var></samp>&rsquo;</dt>
  823. <dd><p><var>len</var> is the length of the bytecode expression and <var>expr</var> is the
  824. actual conditional expression in bytecode form.
  825. </p>
  826. </dd>
  827. </dl>
  828. <p>The optional <var>cmd_list</var> parameter introduces commands that may be
  829. run on the target, rather than being reported back to <small>GDB</small>.
  830. The parameter starts with a numeric flag <var>persist</var>; if the flag is
  831. nonzero, then the breakpoint may remain active and the commands
  832. continue to be run even when <small>GDB</small> disconnects from the target.
  833. Following this flag is a series of expressions concatenated with no
  834. separators. Each expression has the following form:
  835. </p>
  836. <dl compact="compact">
  837. <dt>&lsquo;<samp>X <var>len</var>,<var>expr</var></samp>&rsquo;</dt>
  838. <dd><p><var>len</var> is the length of the bytecode expression and <var>expr</var> is the
  839. actual commands expression in bytecode form.
  840. </p>
  841. </dd>
  842. </dl>
  843. <p><em>Implementation note: It is possible for a target to copy or move
  844. code that contains software breakpoints (e.g., when implementing
  845. overlays). The behavior of this packet, in the presence of such a
  846. target, is not defined.</em>
  847. </p>
  848. <p>Reply:
  849. </p><dl compact="compact">
  850. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  851. <dd><p>success
  852. </p></dd>
  853. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  854. <dd><p>not supported
  855. </p></dd>
  856. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  857. <dd><p>for an error
  858. </p></dd>
  859. </dl>
  860. </dd>
  861. <dt>&lsquo;<samp>z1,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  862. <dt>&lsquo;<samp>Z1,<var>addr</var>,<var>kind</var><span class="roman">[</span>;<var>cond_list</var>&hellip;<span class="roman">]</span><span class="roman">[</span>;cmds:<var>persist</var>,<var>cmd_list</var>&hellip;<span class="roman">]</span></samp>&rsquo;</dt>
  863. <dd><a name="index-z1-packet"></a>
  864. <a name="index-Z1-packet"></a>
  865. <p>Insert (&lsquo;<samp>Z1</samp>&rsquo;) or remove (&lsquo;<samp>z1</samp>&rsquo;) a hardware breakpoint at
  866. address <var>addr</var>.
  867. </p>
  868. <p>A hardware breakpoint is implemented using a mechanism that is not
  869. dependent on being able to modify the target&rsquo;s memory. The
  870. <var>kind</var>, <var>cond_list</var>, and <var>cmd_list</var> arguments have the
  871. same meaning as in &lsquo;<samp>Z0</samp>&rsquo; packets.
  872. </p>
  873. <p><em>Implementation note: A hardware breakpoint is not affected by code
  874. movement.</em>
  875. </p>
  876. <p>Reply:
  877. </p><dl compact="compact">
  878. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  879. <dd><p>success
  880. </p></dd>
  881. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  882. <dd><p>not supported
  883. </p></dd>
  884. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  885. <dd><p>for an error
  886. </p></dd>
  887. </dl>
  888. </dd>
  889. <dt>&lsquo;<samp>z2,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  890. <dt>&lsquo;<samp>Z2,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  891. <dd><a name="index-z2-packet"></a>
  892. <a name="index-Z2-packet"></a>
  893. <p>Insert (&lsquo;<samp>Z2</samp>&rsquo;) or remove (&lsquo;<samp>z2</samp>&rsquo;) a write watchpoint at <var>addr</var>.
  894. The number of bytes to watch is specified by <var>kind</var>.
  895. </p>
  896. <p>Reply:
  897. </p><dl compact="compact">
  898. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  899. <dd><p>success
  900. </p></dd>
  901. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  902. <dd><p>not supported
  903. </p></dd>
  904. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  905. <dd><p>for an error
  906. </p></dd>
  907. </dl>
  908. </dd>
  909. <dt>&lsquo;<samp>z3,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  910. <dt>&lsquo;<samp>Z3,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  911. <dd><a name="index-z3-packet"></a>
  912. <a name="index-Z3-packet"></a>
  913. <p>Insert (&lsquo;<samp>Z3</samp>&rsquo;) or remove (&lsquo;<samp>z3</samp>&rsquo;) a read watchpoint at <var>addr</var>.
  914. The number of bytes to watch is specified by <var>kind</var>.
  915. </p>
  916. <p>Reply:
  917. </p><dl compact="compact">
  918. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  919. <dd><p>success
  920. </p></dd>
  921. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  922. <dd><p>not supported
  923. </p></dd>
  924. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  925. <dd><p>for an error
  926. </p></dd>
  927. </dl>
  928. </dd>
  929. <dt>&lsquo;<samp>z4,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  930. <dt>&lsquo;<samp>Z4,<var>addr</var>,<var>kind</var></samp>&rsquo;</dt>
  931. <dd><a name="index-z4-packet"></a>
  932. <a name="index-Z4-packet"></a>
  933. <p>Insert (&lsquo;<samp>Z4</samp>&rsquo;) or remove (&lsquo;<samp>z4</samp>&rsquo;) an access watchpoint at <var>addr</var>.
  934. The number of bytes to watch is specified by <var>kind</var>.
  935. </p>
  936. <p>Reply:
  937. </p><dl compact="compact">
  938. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  939. <dd><p>success
  940. </p></dd>
  941. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  942. <dd><p>not supported
  943. </p></dd>
  944. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  945. <dd><p>for an error
  946. </p></dd>
  947. </dl>
  948. </dd>
  949. </dl>
  950. <hr>
  951. <div class="header">
  952. <p>
  953. Next: <a href="Stop-Reply-Packets.html#Stop-Reply-Packets" accesskey="n" rel="next">Stop Reply Packets</a>, Previous: <a href="Overview.html#Overview" accesskey="p" rel="prev">Overview</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>
  954. </div>
  955. </body>
  956. </html>