Tracepoint-Packets.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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: Tracepoint Packets</title>
  16. <meta name="description" content="Debugging with GDB: Tracepoint Packets">
  17. <meta name="keywords" content="Debugging with GDB: Tracepoint 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="Host-I_002fO-Packets.html#Host-I_002fO-Packets" rel="next" title="Host I/O Packets">
  27. <link href="MIPS-Breakpoint-Kinds.html#MIPS-Breakpoint-Kinds" rel="previous" title="MIPS Breakpoint Kinds">
  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="Tracepoint-Packets"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Host-I_002fO-Packets.html#Host-I_002fO-Packets" accesskey="n" rel="next">Host I/O Packets</a>, Previous: <a href="Architecture_002dSpecific-Protocol-Details.html#Architecture_002dSpecific-Protocol-Details" accesskey="p" rel="previous">Architecture-Specific Protocol Details</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="Tracepoint-Packets-1"></a>
  65. <h3 class="section">E.6 Tracepoint Packets</h3>
  66. <a name="index-tracepoint-packets"></a>
  67. <a name="index-packets_002c-tracepoint"></a>
  68. <p>Here we describe the packets <small>GDB</small> uses to implement
  69. tracepoints (see <a href="Tracepoints.html#Tracepoints">Tracepoints</a>).
  70. </p>
  71. <dl compact="compact">
  72. <dt>&lsquo;<samp>QTDP:<var>n</var>:<var>addr</var>:<var>ena</var>:<var>step</var>:<var>pass</var>[:F<var>flen</var>][:X<var>len</var>,<var>bytes</var>]<span class="roman">[</span>-<span class="roman">]</span></samp>&rsquo;</dt>
  73. <dd><a name="index-QTDP-packet"></a>
  74. <p>Create a new tracepoint, number <var>n</var>, at <var>addr</var>. If <var>ena</var>
  75. is &lsquo;<samp>E</samp>&rsquo;, then the tracepoint is enabled; if it is &lsquo;<samp>D</samp>&rsquo;, then
  76. the tracepoint is disabled. The <var>step</var> gives the tracepoint&rsquo;s step
  77. count, and <var>pass</var> gives its pass count. If an &lsquo;<samp>F</samp>&rsquo; is present,
  78. then the tracepoint is to be a fast tracepoint, and the <var>flen</var> is
  79. the number of bytes that the target should copy elsewhere to make room
  80. for the tracepoint. If an &lsquo;<samp>X</samp>&rsquo; is present, it introduces a
  81. tracepoint condition, which consists of a hexadecimal length, followed
  82. by a comma and hex-encoded bytes, in a manner similar to action
  83. encodings as described below. If the trailing &lsquo;<samp>-</samp>&rsquo; is present,
  84. further &lsquo;<samp>QTDP</samp>&rsquo; packets will follow to specify this tracepoint&rsquo;s
  85. actions.
  86. </p>
  87. <p>Replies:
  88. </p><dl compact="compact">
  89. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  90. <dd><p>The packet was understood and carried out.
  91. </p></dd>
  92. <dt>&lsquo;<samp>qRelocInsn</samp>&rsquo;</dt>
  93. <dd><p>See <a href="#Tracepoint-Packets">Relocate instruction reply packet</a>.
  94. </p></dd>
  95. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  96. <dd><p>The packet was not recognized.
  97. </p></dd>
  98. </dl>
  99. </dd>
  100. <dt>&lsquo;<samp>QTDP:-<var>n</var>:<var>addr</var>:<span class="roman">[</span>S<span class="roman">]</span><var>action</var>&hellip;<span class="roman">[</span>-<span class="roman">]</span></samp>&rsquo;</dt>
  101. <dd><p>Define actions to be taken when a tracepoint is hit. The <var>n</var> and
  102. <var>addr</var> must be the same as in the initial &lsquo;<samp>QTDP</samp>&rsquo; packet for
  103. this tracepoint. This packet may only be sent immediately after
  104. another &lsquo;<samp>QTDP</samp>&rsquo; packet that ended with a &lsquo;<samp>-</samp>&rsquo;. If the
  105. trailing &lsquo;<samp>-</samp>&rsquo; is present, further &lsquo;<samp>QTDP</samp>&rsquo; packets will follow,
  106. specifying more actions for this tracepoint.
  107. </p>
  108. <p>In the series of action packets for a given tracepoint, at most one
  109. can have an &lsquo;<samp>S</samp>&rsquo; before its first <var>action</var>. If such a packet
  110. is sent, it and the following packets define &ldquo;while-stepping&rdquo;
  111. actions. Any prior packets define ordinary actions &mdash; that is, those
  112. taken when the tracepoint is first hit. If no action packet has an
  113. &lsquo;<samp>S</samp>&rsquo;, then all the packets in the series specify ordinary
  114. tracepoint actions.
  115. </p>
  116. <p>The &lsquo;<samp><var>action</var>&hellip;</samp>&rsquo; portion of the packet is a series of
  117. actions, concatenated without separators. Each action has one of the
  118. following forms:
  119. </p>
  120. <dl compact="compact">
  121. <dt>&lsquo;<samp>R <var>mask</var></samp>&rsquo;</dt>
  122. <dd><p>Collect the registers whose bits are set in <var>mask</var>,
  123. a hexadecimal number whose <var>i</var>&rsquo;th bit is set if register number
  124. <var>i</var> should be collected. (The least significant bit is numbered
  125. zero.) Note that <var>mask</var> may be any number of digits long; it may
  126. not fit in a 32-bit word.
  127. </p>
  128. </dd>
  129. <dt>&lsquo;<samp>M <var>basereg</var>,<var>offset</var>,<var>len</var></samp>&rsquo;</dt>
  130. <dd><p>Collect <var>len</var> bytes of memory starting at the address in register
  131. number <var>basereg</var>, plus <var>offset</var>. If <var>basereg</var> is
  132. &lsquo;<samp>-1</samp>&rsquo;, then the range has a fixed address: <var>offset</var> is the
  133. address of the lowest byte to collect. The <var>basereg</var>,
  134. <var>offset</var>, and <var>len</var> parameters are all unsigned hexadecimal
  135. values (the &lsquo;<samp>-1</samp>&rsquo; value for <var>basereg</var> is a special case).
  136. </p>
  137. </dd>
  138. <dt>&lsquo;<samp>X <var>len</var>,<var>expr</var></samp>&rsquo;</dt>
  139. <dd><p>Evaluate <var>expr</var>, whose length is <var>len</var>, and collect memory as
  140. it directs. The agent expression <var>expr</var> is as described in
  141. <a href="Agent-Expressions.html#Agent-Expressions">Agent Expressions</a>. Each byte of the expression is encoded as a
  142. two-digit hex number in the packet; <var>len</var> is the number of bytes
  143. in the expression (and thus one-half the number of hex digits in the
  144. packet).
  145. </p>
  146. </dd>
  147. </dl>
  148. <p>Any number of actions may be packed together in a single &lsquo;<samp>QTDP</samp>&rsquo;
  149. packet, as long as the packet does not exceed the maximum packet
  150. length (400 bytes, for many stubs). There may be only one &lsquo;<samp>R</samp>&rsquo;
  151. action per tracepoint, and it must precede any &lsquo;<samp>M</samp>&rsquo; or &lsquo;<samp>X</samp>&rsquo;
  152. actions. Any registers referred to by &lsquo;<samp>M</samp>&rsquo; and &lsquo;<samp>X</samp>&rsquo; actions
  153. must be collected by a preceding &lsquo;<samp>R</samp>&rsquo; action. (The
  154. &ldquo;while-stepping&rdquo; actions are treated as if they were attached to a
  155. separate tracepoint, as far as these restrictions are concerned.)
  156. </p>
  157. <p>Replies:
  158. </p><dl compact="compact">
  159. <dt>&lsquo;<samp>OK</samp>&rsquo;</dt>
  160. <dd><p>The packet was understood and carried out.
  161. </p></dd>
  162. <dt>&lsquo;<samp>qRelocInsn</samp>&rsquo;</dt>
  163. <dd><p>See <a href="#Tracepoint-Packets">Relocate instruction reply packet</a>.
  164. </p></dd>
  165. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  166. <dd><p>The packet was not recognized.
  167. </p></dd>
  168. </dl>
  169. </dd>
  170. <dt>&lsquo;<samp>QTDPsrc:<var>n</var>:<var>addr</var>:<var>type</var>:<var>start</var>:<var>slen</var>:<var>bytes</var></samp>&rsquo;</dt>
  171. <dd><a name="index-QTDPsrc-packet"></a>
  172. <p>Specify a source string of tracepoint <var>n</var> at address <var>addr</var>.
  173. This is useful to get accurate reproduction of the tracepoints
  174. originally downloaded at the beginning of the trace run. The <var>type</var>
  175. is the name of the tracepoint part, such as &lsquo;<samp>cond</samp>&rsquo; for the
  176. tracepoint&rsquo;s conditional expression (see below for a list of types), while
  177. <var>bytes</var> is the string, encoded in hexadecimal.
  178. </p>
  179. <p><var>start</var> is the offset of the <var>bytes</var> within the overall source
  180. string, while <var>slen</var> is the total length of the source string.
  181. This is intended for handling source strings that are longer than will
  182. fit in a single packet.
  183. </p>
  184. <p>The available string types are &lsquo;<samp>at</samp>&rsquo; for the location,
  185. &lsquo;<samp>cond</samp>&rsquo; for the conditional, and &lsquo;<samp>cmd</samp>&rsquo; for an action command.
  186. <small>GDB</small> sends a separate packet for each command in the action
  187. list, in the same order in which the commands are stored in the list.
  188. </p>
  189. <p>The target does not need to do anything with source strings except
  190. report them back as part of the replies to the &lsquo;<samp>qTfP</samp>&rsquo;/&lsquo;<samp>qTsP</samp>&rsquo;
  191. query packets.
  192. </p>
  193. <p>Although this packet is optional, and <small>GDB</small> will only send it
  194. if the target replies with &lsquo;<samp>TracepointSource</samp>&rsquo; See <a href="General-Query-Packets.html#General-Query-Packets">General Query Packets</a>, it makes both disconnected tracing and trace files
  195. much easier to use. Otherwise the user must be careful that the
  196. tracepoints in effect while looking at trace frames are identical to
  197. the ones in effect during the trace run; even a small discrepancy
  198. could cause &lsquo;<samp>tdump</samp>&rsquo; not to work, or a particular trace frame not
  199. be found.
  200. </p>
  201. </dd>
  202. <dt>&lsquo;<samp>QTDV:<var>n</var>:<var>value</var>:<var>builtin</var>:<var>name</var></samp>&rsquo;</dt>
  203. <dd><a name="index-define-trace-state-variable_002c-remote-request"></a>
  204. <a name="index-QTDV-packet"></a>
  205. <p>Create a new trace state variable, number <var>n</var>, with an initial
  206. value of <var>value</var>, which is a 64-bit signed integer. Both <var>n</var>
  207. and <var>value</var> are encoded as hexadecimal values. <small>GDB</small> has
  208. the option of not using this packet for initial values of zero; the
  209. target should simply create the trace state variables as they are
  210. mentioned in expressions. The value <var>builtin</var> should be 1 (one)
  211. if the trace state variable is builtin and 0 (zero) if it is not builtin.
  212. <small>GDB</small> only sets <var>builtin</var> to 1 if a previous &lsquo;<samp>qTfV</samp>&rsquo; or
  213. &lsquo;<samp>qTsV</samp>&rsquo; packet had it set. The contents of <var>name</var> is the
  214. hex-encoded name (without the leading &lsquo;<samp>$</samp>&rsquo;) of the trace state
  215. variable.
  216. </p>
  217. </dd>
  218. <dt>&lsquo;<samp>QTFrame:<var>n</var></samp>&rsquo;</dt>
  219. <dd><a name="index-QTFrame-packet"></a>
  220. <p>Select the <var>n</var>&rsquo;th tracepoint frame from the buffer, and use the
  221. register and memory contents recorded there to answer subsequent
  222. request packets from <small>GDB</small>.
  223. </p>
  224. <p>A successful reply from the stub indicates that the stub has found the
  225. requested frame. The response is a series of parts, concatenated
  226. without separators, describing the frame we selected. Each part has
  227. one of the following forms:
  228. </p>
  229. <dl compact="compact">
  230. <dt>&lsquo;<samp>F <var>f</var></samp>&rsquo;</dt>
  231. <dd><p>The selected frame is number <var>n</var> in the trace frame buffer;
  232. <var>f</var> is a hexadecimal number. If <var>f</var> is &lsquo;<samp>-1</samp>&rsquo;, then there
  233. was no frame matching the criteria in the request packet.
  234. </p>
  235. </dd>
  236. <dt>&lsquo;<samp>T <var>t</var></samp>&rsquo;</dt>
  237. <dd><p>The selected trace frame records a hit of tracepoint number <var>t</var>;
  238. <var>t</var> is a hexadecimal number.
  239. </p>
  240. </dd>
  241. </dl>
  242. </dd>
  243. <dt>&lsquo;<samp>QTFrame:pc:<var>addr</var></samp>&rsquo;</dt>
  244. <dd><p>Like &lsquo;<samp>QTFrame:<var>n</var></samp>&rsquo;, but select the first tracepoint frame after the
  245. currently selected frame whose PC is <var>addr</var>;
  246. <var>addr</var> is a hexadecimal number.
  247. </p>
  248. </dd>
  249. <dt>&lsquo;<samp>QTFrame:tdp:<var>t</var></samp>&rsquo;</dt>
  250. <dd><p>Like &lsquo;<samp>QTFrame:<var>n</var></samp>&rsquo;, but select the first tracepoint frame after the
  251. currently selected frame that is a hit of tracepoint <var>t</var>; <var>t</var>
  252. is a hexadecimal number.
  253. </p>
  254. </dd>
  255. <dt>&lsquo;<samp>QTFrame:range:<var>start</var>:<var>end</var></samp>&rsquo;</dt>
  256. <dd><p>Like &lsquo;<samp>QTFrame:<var>n</var></samp>&rsquo;, but select the first tracepoint frame after the
  257. currently selected frame whose PC is between <var>start</var> (inclusive)
  258. and <var>end</var> (inclusive); <var>start</var> and <var>end</var> are hexadecimal
  259. numbers.
  260. </p>
  261. </dd>
  262. <dt>&lsquo;<samp>QTFrame:outside:<var>start</var>:<var>end</var></samp>&rsquo;</dt>
  263. <dd><p>Like &lsquo;<samp>QTFrame:range:<var>start</var>:<var>end</var></samp>&rsquo;, but select the first
  264. frame <em>outside</em> the given range of addresses (exclusive).
  265. </p>
  266. </dd>
  267. <dt>&lsquo;<samp>qTMinFTPILen</samp>&rsquo;</dt>
  268. <dd><a name="index-qTMinFTPILen-packet"></a>
  269. <p>This packet requests the minimum length of instruction at which a fast
  270. tracepoint (see <a href="Set-Tracepoints.html#Set-Tracepoints">Set Tracepoints</a>) may be placed. For instance, on
  271. the 32-bit x86 architecture, it is possible to use a 4-byte jump, but
  272. it depends on the target system being able to create trampolines in
  273. the first 64K of memory, which might or might not be possible for that
  274. system. So the reply to this packet will be 4 if it is able to
  275. arrange for that.
  276. </p>
  277. <p>Replies:
  278. </p>
  279. <dl compact="compact">
  280. <dt>&lsquo;<samp>0</samp>&rsquo;</dt>
  281. <dd><p>The minimum instruction length is currently unknown.
  282. </p></dd>
  283. <dt>&lsquo;<samp><var>length</var></samp>&rsquo;</dt>
  284. <dd><p>The minimum instruction length is <var>length</var>, where <var>length</var>
  285. is a hexadecimal number greater or equal to 1. A reply
  286. of 1 means that a fast tracepoint may be placed on any instruction
  287. regardless of size.
  288. </p></dd>
  289. <dt>&lsquo;<samp>E</samp>&rsquo;</dt>
  290. <dd><p>An error has occurred.
  291. </p></dd>
  292. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  293. <dd><p>An empty reply indicates that the request is not supported by the stub.
  294. </p></dd>
  295. </dl>
  296. </dd>
  297. <dt>&lsquo;<samp>QTStart</samp>&rsquo;</dt>
  298. <dd><a name="index-QTStart-packet"></a>
  299. <p>Begin the tracepoint experiment. Begin collecting data from
  300. tracepoint hits in the trace frame buffer. This packet supports the
  301. &lsquo;<samp>qRelocInsn</samp>&rsquo; reply (see <a href="#Tracepoint-Packets">Relocate
  302. instruction reply packet</a>).
  303. </p>
  304. </dd>
  305. <dt>&lsquo;<samp>QTStop</samp>&rsquo;</dt>
  306. <dd><a name="index-QTStop-packet"></a>
  307. <p>End the tracepoint experiment. Stop collecting trace frames.
  308. </p>
  309. </dd>
  310. <dt>&lsquo;<samp>QTEnable:<var>n</var>:<var>addr</var></samp>&rsquo;</dt>
  311. <dd><a name="QTEnable"></a><a name="index-QTEnable-packet"></a>
  312. <p>Enable tracepoint <var>n</var> at address <var>addr</var> in a started tracepoint
  313. experiment. If the tracepoint was previously disabled, then collection
  314. of data from it will resume.
  315. </p>
  316. </dd>
  317. <dt>&lsquo;<samp>QTDisable:<var>n</var>:<var>addr</var></samp>&rsquo;</dt>
  318. <dd><a name="QTDisable"></a><a name="index-QTDisable-packet"></a>
  319. <p>Disable tracepoint <var>n</var> at address <var>addr</var> in a started tracepoint
  320. experiment. No more data will be collected from the tracepoint unless
  321. &lsquo;<samp>QTEnable:<var>n</var>:<var>addr</var></samp>&rsquo; is subsequently issued.
  322. </p>
  323. </dd>
  324. <dt>&lsquo;<samp>QTinit</samp>&rsquo;</dt>
  325. <dd><a name="index-QTinit-packet"></a>
  326. <p>Clear the table of tracepoints, and empty the trace frame buffer.
  327. </p>
  328. </dd>
  329. <dt>&lsquo;<samp>QTro:<var>start1</var>,<var>end1</var>:<var>start2</var>,<var>end2</var>:&hellip;</samp>&rsquo;</dt>
  330. <dd><a name="index-QTro-packet"></a>
  331. <p>Establish the given ranges of memory as &ldquo;transparent&rdquo;. The stub
  332. will answer requests for these ranges from memory&rsquo;s current contents,
  333. if they were not collected as part of the tracepoint hit.
  334. </p>
  335. <p><small>GDB</small> uses this to mark read-only regions of memory, like those
  336. containing program code. Since these areas never change, they should
  337. still have the same contents they did when the tracepoint was hit, so
  338. there&rsquo;s no reason for the stub to refuse to provide their contents.
  339. </p>
  340. </dd>
  341. <dt>&lsquo;<samp>QTDisconnected:<var>value</var></samp>&rsquo;</dt>
  342. <dd><a name="index-QTDisconnected-packet"></a>
  343. <p>Set the choice to what to do with the tracing run when <small>GDB</small>
  344. disconnects from the target. A <var>value</var> of 1 directs the target to
  345. continue the tracing run, while 0 tells the target to stop tracing if
  346. <small>GDB</small> is no longer in the picture.
  347. </p>
  348. </dd>
  349. <dt>&lsquo;<samp>qTStatus</samp>&rsquo;</dt>
  350. <dd><a name="index-qTStatus-packet"></a>
  351. <p>Ask the stub if there is a trace experiment running right now.
  352. </p>
  353. <p>The reply has the form:
  354. </p>
  355. <dl compact="compact">
  356. <dt>&lsquo;<samp>T<var>running</var><span class="roman">[</span>;<var>field</var><span class="roman">]</span>&hellip;</samp>&rsquo;</dt>
  357. <dd><p><var>running</var> is a single digit <code>1</code> if the trace is presently
  358. running, or <code>0</code> if not. It is followed by semicolon-separated
  359. optional fields that an agent may use to report additional status.
  360. </p>
  361. </dd>
  362. </dl>
  363. <p>If the trace is not running, the agent may report any of several
  364. explanations as one of the optional fields:
  365. </p>
  366. <dl compact="compact">
  367. <dt>&lsquo;<samp>tnotrun:0</samp>&rsquo;</dt>
  368. <dd><p>No trace has been run yet.
  369. </p>
  370. </dd>
  371. <dt>&lsquo;<samp>tstop[:<var>text</var>]:0</samp>&rsquo;</dt>
  372. <dd><p>The trace was stopped by a user-originated stop command. The optional
  373. <var>text</var> field is a user-supplied string supplied as part of the
  374. stop command (for instance, an explanation of why the trace was
  375. stopped manually). It is hex-encoded.
  376. </p>
  377. </dd>
  378. <dt>&lsquo;<samp>tfull:0</samp>&rsquo;</dt>
  379. <dd><p>The trace stopped because the trace buffer filled up.
  380. </p>
  381. </dd>
  382. <dt>&lsquo;<samp>tdisconnected:0</samp>&rsquo;</dt>
  383. <dd><p>The trace stopped because <small>GDB</small> disconnected from the target.
  384. </p>
  385. </dd>
  386. <dt>&lsquo;<samp>tpasscount:<var>tpnum</var></samp>&rsquo;</dt>
  387. <dd><p>The trace stopped because tracepoint <var>tpnum</var> exceeded its pass count.
  388. </p>
  389. </dd>
  390. <dt>&lsquo;<samp>terror:<var>text</var>:<var>tpnum</var></samp>&rsquo;</dt>
  391. <dd><p>The trace stopped because tracepoint <var>tpnum</var> had an error. The
  392. string <var>text</var> is available to describe the nature of the error
  393. (for instance, a divide by zero in the condition expression); it
  394. is hex encoded.
  395. </p>
  396. </dd>
  397. <dt>&lsquo;<samp>tunknown:0</samp>&rsquo;</dt>
  398. <dd><p>The trace stopped for some other reason.
  399. </p>
  400. </dd>
  401. </dl>
  402. <p>Additional optional fields supply statistical and other information.
  403. Although not required, they are extremely useful for users monitoring
  404. the progress of a trace run. If a trace has stopped, and these
  405. numbers are reported, they must reflect the state of the just-stopped
  406. trace.
  407. </p>
  408. <dl compact="compact">
  409. <dt>&lsquo;<samp>tframes:<var>n</var></samp>&rsquo;</dt>
  410. <dd><p>The number of trace frames in the buffer.
  411. </p>
  412. </dd>
  413. <dt>&lsquo;<samp>tcreated:<var>n</var></samp>&rsquo;</dt>
  414. <dd><p>The total number of trace frames created during the run. This may
  415. be larger than the trace frame count, if the buffer is circular.
  416. </p>
  417. </dd>
  418. <dt>&lsquo;<samp>tsize:<var>n</var></samp>&rsquo;</dt>
  419. <dd><p>The total size of the trace buffer, in bytes.
  420. </p>
  421. </dd>
  422. <dt>&lsquo;<samp>tfree:<var>n</var></samp>&rsquo;</dt>
  423. <dd><p>The number of bytes still unused in the buffer.
  424. </p>
  425. </dd>
  426. <dt>&lsquo;<samp>circular:<var>n</var></samp>&rsquo;</dt>
  427. <dd><p>The value of the circular trace buffer flag. <code>1</code> means that the
  428. trace buffer is circular and old trace frames will be discarded if
  429. necessary to make room, <code>0</code> means that the trace buffer is linear
  430. and may fill up.
  431. </p>
  432. </dd>
  433. <dt>&lsquo;<samp>disconn:<var>n</var></samp>&rsquo;</dt>
  434. <dd><p>The value of the disconnected tracing flag. <code>1</code> means that
  435. tracing will continue after <small>GDB</small> disconnects, <code>0</code> means
  436. that the trace run will stop.
  437. </p>
  438. </dd>
  439. </dl>
  440. </dd>
  441. <dt>&lsquo;<samp>qTP:<var>tp</var>:<var>addr</var></samp>&rsquo;</dt>
  442. <dd><a name="index-tracepoint-status_002c-remote-request"></a>
  443. <a name="index-qTP-packet"></a>
  444. <p>Ask the stub for the current state of tracepoint number <var>tp</var> at
  445. address <var>addr</var>.
  446. </p>
  447. <p>Replies:
  448. </p><dl compact="compact">
  449. <dt>&lsquo;<samp>V<var>hits</var>:<var>usage</var></samp>&rsquo;</dt>
  450. <dd><p>The tracepoint has been hit <var>hits</var> times so far during the trace
  451. run, and accounts for <var>usage</var> in the trace buffer. Note that
  452. <code>while-stepping</code> steps are not counted as separate hits, but the
  453. steps&rsquo; space consumption is added into the usage number.
  454. </p>
  455. </dd>
  456. </dl>
  457. </dd>
  458. <dt>&lsquo;<samp>qTV:<var>var</var></samp>&rsquo;</dt>
  459. <dd><a name="index-trace-state-variable-value_002c-remote-request"></a>
  460. <a name="index-qTV-packet"></a>
  461. <p>Ask the stub for the value of the trace state variable number <var>var</var>.
  462. </p>
  463. <p>Replies:
  464. </p><dl compact="compact">
  465. <dt>&lsquo;<samp>V<var>value</var></samp>&rsquo;</dt>
  466. <dd><p>The value of the variable is <var>value</var>. This will be the current
  467. value of the variable if the user is examining a running target, or a
  468. saved value if the variable was collected in the trace frame that the
  469. user is looking at. Note that multiple requests may result in
  470. different reply values, such as when requesting values while the
  471. program is running.
  472. </p>
  473. </dd>
  474. <dt>&lsquo;<samp>U</samp>&rsquo;</dt>
  475. <dd><p>The value of the variable is unknown. This would occur, for example,
  476. if the user is examining a trace frame in which the requested variable
  477. was not collected.
  478. </p></dd>
  479. </dl>
  480. </dd>
  481. <dt>&lsquo;<samp>qTfP</samp>&rsquo;</dt>
  482. <dd><a name="index-qTfP-packet"></a>
  483. </dd>
  484. <dt>&lsquo;<samp>qTsP</samp>&rsquo;</dt>
  485. <dd><a name="index-qTsP-packet"></a>
  486. <p>These packets request data about tracepoints that are being used by
  487. the target. <small>GDB</small> sends <code>qTfP</code> to get the first piece
  488. of data, and multiple <code>qTsP</code> to get additional pieces. Replies
  489. to these packets generally take the form of the <code>QTDP</code> packets
  490. that define tracepoints. (FIXME add detailed syntax)
  491. </p>
  492. </dd>
  493. <dt>&lsquo;<samp>qTfV</samp>&rsquo;</dt>
  494. <dd><a name="index-qTfV-packet"></a>
  495. </dd>
  496. <dt>&lsquo;<samp>qTsV</samp>&rsquo;</dt>
  497. <dd><a name="index-qTsV-packet"></a>
  498. <p>These packets request data about trace state variables that are on the
  499. target. <small>GDB</small> sends <code>qTfV</code> to get the first vari of data,
  500. and multiple <code>qTsV</code> to get additional variables. Replies to
  501. these packets follow the syntax of the <code>QTDV</code> packets that define
  502. trace state variables.
  503. </p>
  504. </dd>
  505. <dt>&lsquo;<samp>qTfSTM</samp>&rsquo;</dt>
  506. <dt>&lsquo;<samp>qTsSTM</samp>&rsquo;</dt>
  507. <dd><a name="qTfSTM"></a><a name="qTsSTM"></a><a name="index-qTfSTM-packet"></a>
  508. <a name="index-qTsSTM-packet"></a>
  509. <p>These packets request data about static tracepoint markers that exist
  510. in the target program. <small>GDB</small> sends <code>qTfSTM</code> to get the
  511. first piece of data, and multiple <code>qTsSTM</code> to get additional
  512. pieces. Replies to these packets take the following form:
  513. </p>
  514. <p>Reply:
  515. </p><dl compact="compact">
  516. <dt>&lsquo;<samp>m <var>address</var>:<var>id</var>:<var>extra</var></samp>&rsquo;</dt>
  517. <dd><p>A single marker
  518. </p></dd>
  519. <dt>&lsquo;<samp>m <var>address</var>:<var>id</var>:<var>extra</var>,<var>address</var>:<var>id</var>:<var>extra</var>&hellip;</samp>&rsquo;</dt>
  520. <dd><p>a comma-separated list of markers
  521. </p></dd>
  522. <dt>&lsquo;<samp>l</samp>&rsquo;</dt>
  523. <dd><p>(lower case letter &lsquo;<samp>L</samp>&rsquo;) denotes end of list.
  524. </p></dd>
  525. <dt>&lsquo;<samp>E <var>nn</var></samp>&rsquo;</dt>
  526. <dd><p>An error occurred. The error number <var>nn</var> is given as hex digits.
  527. </p></dd>
  528. <dt>&lsquo;<samp><!-- /@w --></samp>&rsquo;</dt>
  529. <dd><p>An empty reply indicates that the request is not supported by the
  530. stub.
  531. </p></dd>
  532. </dl>
  533. <p>The <var>address</var> is encoded in hex;
  534. <var>id</var> and <var>extra</var> are strings encoded in hex.
  535. </p>
  536. <p>In response to each query, the target will reply with a list of one or
  537. more markers, separated by commas. <small>GDB</small> will respond to each
  538. reply with a request for more markers (using the &lsquo;<samp>qs</samp>&rsquo; form of the
  539. query), until the target responds with &lsquo;<samp>l</samp>&rsquo; (lower-case ell, for
  540. <em>last</em>).
  541. </p>
  542. </dd>
  543. <dt>&lsquo;<samp>qTSTMat:<var>address</var></samp>&rsquo;</dt>
  544. <dd><a name="qTSTMat"></a><a name="index-qTSTMat-packet"></a>
  545. <p>This packets requests data about static tracepoint markers in the
  546. target program at <var>address</var>. Replies to this packet follow the
  547. syntax of the &lsquo;<samp>qTfSTM</samp>&rsquo; and <code>qTsSTM</code> packets that list static
  548. tracepoint markers.
  549. </p>
  550. </dd>
  551. <dt>&lsquo;<samp>QTSave:<var>filename</var></samp>&rsquo;</dt>
  552. <dd><a name="index-QTSave-packet"></a>
  553. <p>This packet directs the target to save trace data to the file name
  554. <var>filename</var> in the target&rsquo;s filesystem. The <var>filename</var> is encoded
  555. as a hex string; the interpretation of the file name (relative vs
  556. absolute, wild cards, etc) is up to the target.
  557. </p>
  558. </dd>
  559. <dt>&lsquo;<samp>qTBuffer:<var>offset</var>,<var>len</var></samp>&rsquo;</dt>
  560. <dd><a name="index-qTBuffer-packet"></a>
  561. <p>Return up to <var>len</var> bytes of the current contents of trace buffer,
  562. starting at <var>offset</var>. The trace buffer is treated as if it were
  563. a contiguous collection of traceframes, as per the trace file format.
  564. The reply consists as many hex-encoded bytes as the target can deliver
  565. in a packet; it is not an error to return fewer than were asked for.
  566. A reply consisting of just <code>l</code> indicates that no bytes are
  567. available.
  568. </p>
  569. </dd>
  570. <dt>&lsquo;<samp>QTBuffer:circular:<var>value</var></samp>&rsquo;</dt>
  571. <dd><p>This packet directs the target to use a circular trace buffer if
  572. <var>value</var> is 1, or a linear buffer if the value is 0.
  573. </p>
  574. </dd>
  575. <dt>&lsquo;<samp>QTBuffer:size:<var>size</var></samp>&rsquo;</dt>
  576. <dd><a name="QTBuffer_002dsize"></a><a name="index-QTBuffer-size-packet"></a>
  577. <p>This packet directs the target to make the trace buffer be of size
  578. <var>size</var> if possible. A value of <code>-1</code> tells the target to
  579. use whatever size it prefers.
  580. </p>
  581. </dd>
  582. <dt>&lsquo;<samp>QTNotes:<span class="roman">[</span><var>type</var>:<var>text</var><span class="roman">]</span><span class="roman">[</span>;<var>type</var>:<var>text</var><span class="roman">]</span>&hellip;</samp>&rsquo;</dt>
  583. <dd><a name="index-QTNotes-packet"></a>
  584. <p>This packet adds optional textual notes to the trace run. Allowable
  585. types include <code>user</code>, <code>notes</code>, and <code>tstop</code>, the
  586. <var>text</var> fields are arbitrary strings, hex-encoded.
  587. </p>
  588. </dd>
  589. </dl>
  590. <a name="Relocate-instruction-reply-packet"></a>
  591. <h4 class="subsection">E.6.1 Relocate instruction reply packet</h4>
  592. <p>When installing fast tracepoints in memory, the target may need to
  593. relocate the instruction currently at the tracepoint address to a
  594. different address in memory. For most instructions, a simple copy is
  595. enough, but, for example, call instructions that implicitly push the
  596. return address on the stack, and relative branches or other
  597. PC-relative instructions require offset adjustment, so that the effect
  598. of executing the instruction at a different address is the same as if
  599. it had executed in the original location.
  600. </p>
  601. <p>In response to several of the tracepoint packets, the target may also
  602. respond with a number of intermediate &lsquo;<samp>qRelocInsn</samp>&rsquo; request
  603. packets before the final result packet, to have <small>GDB</small> handle
  604. this relocation operation. If a packet supports this mechanism, its
  605. documentation will explicitly say so. See for example the above
  606. descriptions for the &lsquo;<samp>QTStart</samp>&rsquo; and &lsquo;<samp>QTDP</samp>&rsquo; packets. The
  607. format of the request is:
  608. </p>
  609. <dl compact="compact">
  610. <dt>&lsquo;<samp>qRelocInsn:<var>from</var>;<var>to</var></samp>&rsquo;</dt>
  611. <dd>
  612. <p>This requests <small>GDB</small> to copy instruction at address <var>from</var>
  613. to address <var>to</var>, possibly adjusted so that executing the
  614. instruction at <var>to</var> has the same effect as executing it at
  615. <var>from</var>. <small>GDB</small> writes the adjusted instruction to target
  616. memory starting at <var>to</var>.
  617. </p></dd>
  618. </dl>
  619. <p>Replies:
  620. </p><dl compact="compact">
  621. <dt>&lsquo;<samp>qRelocInsn:<var>adjusted_size</var></samp>&rsquo;</dt>
  622. <dd><p>Informs the stub the relocation is complete. The <var>adjusted_size</var> is
  623. the length in bytes of resulting relocated instruction sequence.
  624. </p></dd>
  625. <dt>&lsquo;<samp>E <var>NN</var></samp>&rsquo;</dt>
  626. <dd><p>A badly formed request was detected, or an error was encountered while
  627. relocating the instruction.
  628. </p></dd>
  629. </dl>
  630. <hr>
  631. <div class="header">
  632. <p>
  633. Next: <a href="Host-I_002fO-Packets.html#Host-I_002fO-Packets" accesskey="n" rel="next">Host I/O Packets</a>, Previous: <a href="Architecture_002dSpecific-Protocol-Details.html#Architecture_002dSpecific-Protocol-Details" accesskey="p" rel="previous">Architecture-Specific Protocol Details</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>
  634. </div>
  635. </body>
  636. </html>