Bytecode-Descriptions.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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: Bytecode Descriptions</title>
  16. <meta name="description" content="Debugging with GDB: Bytecode Descriptions">
  17. <meta name="keywords" content="Debugging with GDB: Bytecode Descriptions">
  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="Agent-Expressions.html#Agent-Expressions" rel="up" title="Agent Expressions">
  26. <link href="Using-Agent-Expressions.html#Using-Agent-Expressions" rel="next" title="Using Agent Expressions">
  27. <link href="General-Bytecode-Design.html#General-Bytecode-Design" rel="previous" title="General Bytecode Design">
  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="Bytecode-Descriptions"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Using-Agent-Expressions.html#Using-Agent-Expressions" accesskey="n" rel="next">Using Agent Expressions</a>, Previous: <a href="General-Bytecode-Design.html#General-Bytecode-Design" accesskey="p" rel="previous">General Bytecode Design</a>, Up: <a href="Agent-Expressions.html#Agent-Expressions" accesskey="u" rel="up">Agent Expressions</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="Bytecode-Descriptions-1"></a>
  65. <h3 class="section">F.2 Bytecode Descriptions</h3>
  66. <p>Each bytecode description has the following form:
  67. </p>
  68. <dl compact="compact">
  69. <dt><code>add</code> (0x02): <var>a</var> <var>b</var> &rArr; <var>a+b</var></dt>
  70. <dd>
  71. <p>Pop the top two stack items, <var>a</var> and <var>b</var>, as integers; push
  72. their sum, as an integer.
  73. </p>
  74. </dd>
  75. </dl>
  76. <p>In this example, <code>add</code> is the name of the bytecode, and
  77. <code>(0x02)</code> is the one-byte value used to encode the bytecode, in
  78. hexadecimal. The phrase &ldquo;<var>a</var> <var>b</var> &rArr; <var>a+b</var>&rdquo; shows
  79. the stack before and after the bytecode executes. Beforehand, the stack
  80. must contain at least two values, <var>a</var> and <var>b</var>; since the top of
  81. the stack is to the right, <var>b</var> is on the top of the stack, and
  82. <var>a</var> is underneath it. After execution, the bytecode will have
  83. popped <var>a</var> and <var>b</var> from the stack, and replaced them with a
  84. single value, <var>a+b</var>. There may be other values on the stack below
  85. those shown, but the bytecode affects only those shown.
  86. </p>
  87. <p>Here is another example:
  88. </p>
  89. <dl compact="compact">
  90. <dt><code>const8</code> (0x22) <var>n</var>: &rArr; <var>n</var></dt>
  91. <dd><p>Push the 8-bit integer constant <var>n</var> on the stack, without sign
  92. extension.
  93. </p>
  94. </dd>
  95. </dl>
  96. <p>In this example, the bytecode <code>const8</code> takes an operand <var>n</var>
  97. directly from the bytecode stream; the operand follows the <code>const8</code>
  98. bytecode itself. We write any such operands immediately after the name
  99. of the bytecode, before the colon, and describe the exact encoding of
  100. the operand in the bytecode stream in the body of the bytecode
  101. description.
  102. </p>
  103. <p>For the <code>const8</code> bytecode, there are no stack items given before
  104. the &rArr;; this simply means that the bytecode consumes no values
  105. from the stack. If a bytecode consumes no values, or produces no
  106. values, the list on either side of the &rArr; may be empty.
  107. </p>
  108. <p>If a value is written as <var>a</var>, <var>b</var>, or <var>n</var>, then the bytecode
  109. treats it as an integer. If a value is written is <var>addr</var>, then the
  110. bytecode treats it as an address.
  111. </p>
  112. <p>We do not fully describe the floating point operations here; although
  113. this design can be extended in a clean way to handle floating point
  114. values, they are not of immediate interest to the customer, so we avoid
  115. describing them, to save time.
  116. </p>
  117. <dl compact="compact">
  118. <dt><code>float</code> (0x01): &rArr;</dt>
  119. <dd>
  120. <p>Prefix for floating-point bytecodes. Not implemented yet.
  121. </p>
  122. </dd>
  123. <dt><code>add</code> (0x02): <var>a</var> <var>b</var> &rArr; <var>a+b</var></dt>
  124. <dd><p>Pop two integers from the stack, and push their sum, as an integer.
  125. </p>
  126. </dd>
  127. <dt><code>sub</code> (0x03): <var>a</var> <var>b</var> &rArr; <var>a-b</var></dt>
  128. <dd><p>Pop two integers from the stack, subtract the top value from the
  129. next-to-top value, and push the difference.
  130. </p>
  131. </dd>
  132. <dt><code>mul</code> (0x04): <var>a</var> <var>b</var> &rArr; <var>a*b</var></dt>
  133. <dd><p>Pop two integers from the stack, multiply them, and push the product on
  134. the stack. Note that, when one multiplies two <var>n</var>-bit numbers
  135. yielding another <var>n</var>-bit number, it is irrelevant whether the
  136. numbers are signed or not; the results are the same.
  137. </p>
  138. </dd>
  139. <dt><code>div_signed</code> (0x05): <var>a</var> <var>b</var> &rArr; <var>a/b</var></dt>
  140. <dd><p>Pop two signed integers from the stack; divide the next-to-top value by
  141. the top value, and push the quotient. If the divisor is zero, terminate
  142. with an error.
  143. </p>
  144. </dd>
  145. <dt><code>div_unsigned</code> (0x06): <var>a</var> <var>b</var> &rArr; <var>a/b</var></dt>
  146. <dd><p>Pop two unsigned integers from the stack; divide the next-to-top value
  147. by the top value, and push the quotient. If the divisor is zero,
  148. terminate with an error.
  149. </p>
  150. </dd>
  151. <dt><code>rem_signed</code> (0x07): <var>a</var> <var>b</var> &rArr; <var>a modulo b</var></dt>
  152. <dd><p>Pop two signed integers from the stack; divide the next-to-top value by
  153. the top value, and push the remainder. If the divisor is zero,
  154. terminate with an error.
  155. </p>
  156. </dd>
  157. <dt><code>rem_unsigned</code> (0x08): <var>a</var> <var>b</var> &rArr; <var>a modulo b</var></dt>
  158. <dd><p>Pop two unsigned integers from the stack; divide the next-to-top value
  159. by the top value, and push the remainder. If the divisor is zero,
  160. terminate with an error.
  161. </p>
  162. </dd>
  163. <dt><code>lsh</code> (0x09): <var>a</var> <var>b</var> &rArr; <var>a&lt;&lt;b</var></dt>
  164. <dd><p>Pop two integers from the stack; let <var>a</var> be the next-to-top value,
  165. and <var>b</var> be the top value. Shift <var>a</var> left by <var>b</var> bits, and
  166. push the result.
  167. </p>
  168. </dd>
  169. <dt><code>rsh_signed</code> (0x0a): <var>a</var> <var>b</var> &rArr; <code>(signed)</code><var>a&gt;&gt;b</var></dt>
  170. <dd><p>Pop two integers from the stack; let <var>a</var> be the next-to-top value,
  171. and <var>b</var> be the top value. Shift <var>a</var> right by <var>b</var> bits,
  172. inserting copies of the top bit at the high end, and push the result.
  173. </p>
  174. </dd>
  175. <dt><code>rsh_unsigned</code> (0x0b): <var>a</var> <var>b</var> &rArr; <var>a&gt;&gt;b</var></dt>
  176. <dd><p>Pop two integers from the stack; let <var>a</var> be the next-to-top value,
  177. and <var>b</var> be the top value. Shift <var>a</var> right by <var>b</var> bits,
  178. inserting zero bits at the high end, and push the result.
  179. </p>
  180. </dd>
  181. <dt><code>log_not</code> (0x0e): <var>a</var> &rArr; <var>!a</var></dt>
  182. <dd><p>Pop an integer from the stack; if it is zero, push the value one;
  183. otherwise, push the value zero.
  184. </p>
  185. </dd>
  186. <dt><code>bit_and</code> (0x0f): <var>a</var> <var>b</var> &rArr; <var>a&amp;b</var></dt>
  187. <dd><p>Pop two integers from the stack, and push their bitwise <code>and</code>.
  188. </p>
  189. </dd>
  190. <dt><code>bit_or</code> (0x10): <var>a</var> <var>b</var> &rArr; <var>a|b</var></dt>
  191. <dd><p>Pop two integers from the stack, and push their bitwise <code>or</code>.
  192. </p>
  193. </dd>
  194. <dt><code>bit_xor</code> (0x11): <var>a</var> <var>b</var> &rArr; <var>a^b</var></dt>
  195. <dd><p>Pop two integers from the stack, and push their bitwise
  196. exclusive-<code>or</code>.
  197. </p>
  198. </dd>
  199. <dt><code>bit_not</code> (0x12): <var>a</var> &rArr; <var>~a</var></dt>
  200. <dd><p>Pop an integer from the stack, and push its bitwise complement.
  201. </p>
  202. </dd>
  203. <dt><code>equal</code> (0x13): <var>a</var> <var>b</var> &rArr; <var>a=b</var></dt>
  204. <dd><p>Pop two integers from the stack; if they are equal, push the value one;
  205. otherwise, push the value zero.
  206. </p>
  207. </dd>
  208. <dt><code>less_signed</code> (0x14): <var>a</var> <var>b</var> &rArr; <var>a&lt;b</var></dt>
  209. <dd><p>Pop two signed integers from the stack; if the next-to-top value is less
  210. than the top value, push the value one; otherwise, push the value zero.
  211. </p>
  212. </dd>
  213. <dt><code>less_unsigned</code> (0x15): <var>a</var> <var>b</var> &rArr; <var>a&lt;b</var></dt>
  214. <dd><p>Pop two unsigned integers from the stack; if the next-to-top value is less
  215. than the top value, push the value one; otherwise, push the value zero.
  216. </p>
  217. </dd>
  218. <dt><code>ext</code> (0x16) <var>n</var>: <var>a</var> &rArr; <var>a</var>, sign-extended from <var>n</var> bits</dt>
  219. <dd><p>Pop an unsigned value from the stack; treating it as an <var>n</var>-bit
  220. twos-complement value, extend it to full length. This means that all
  221. bits to the left of bit <var>n-1</var> (where the least significant bit is bit
  222. 0) are set to the value of bit <var>n-1</var>. Note that <var>n</var> may be
  223. larger than or equal to the width of the stack elements of the bytecode
  224. engine; in this case, the bytecode should have no effect.
  225. </p>
  226. <p>The number of source bits to preserve, <var>n</var>, is encoded as a single
  227. byte unsigned integer following the <code>ext</code> bytecode.
  228. </p>
  229. </dd>
  230. <dt><code>zero_ext</code> (0x2a) <var>n</var>: <var>a</var> &rArr; <var>a</var>, zero-extended from <var>n</var> bits</dt>
  231. <dd><p>Pop an unsigned value from the stack; zero all but the bottom <var>n</var>
  232. bits.
  233. </p>
  234. <p>The number of source bits to preserve, <var>n</var>, is encoded as a single
  235. byte unsigned integer following the <code>zero_ext</code> bytecode.
  236. </p>
  237. </dd>
  238. <dt><code>ref8</code> (0x17): <var>addr</var> &rArr; <var>a</var></dt>
  239. <dt><code>ref16</code> (0x18): <var>addr</var> &rArr; <var>a</var></dt>
  240. <dt><code>ref32</code> (0x19): <var>addr</var> &rArr; <var>a</var></dt>
  241. <dt><code>ref64</code> (0x1a): <var>addr</var> &rArr; <var>a</var></dt>
  242. <dd><p>Pop an address <var>addr</var> from the stack. For bytecode
  243. <code>ref</code><var>n</var>, fetch an <var>n</var>-bit value from <var>addr</var>, using the
  244. natural target endianness. Push the fetched value as an unsigned
  245. integer.
  246. </p>
  247. <p>Note that <var>addr</var> may not be aligned in any particular way; the
  248. <code>ref<var>n</var></code> bytecodes should operate correctly for any address.
  249. </p>
  250. <p>If attempting to access memory at <var>addr</var> would cause a processor
  251. exception of some sort, terminate with an error.
  252. </p>
  253. </dd>
  254. <dt><code>ref_float</code> (0x1b): <var>addr</var> &rArr; <var>d</var></dt>
  255. <dt><code>ref_double</code> (0x1c): <var>addr</var> &rArr; <var>d</var></dt>
  256. <dt><code>ref_long_double</code> (0x1d): <var>addr</var> &rArr; <var>d</var></dt>
  257. <dt><code>l_to_d</code> (0x1e): <var>a</var> &rArr; <var>d</var></dt>
  258. <dt><code>d_to_l</code> (0x1f): <var>d</var> &rArr; <var>a</var></dt>
  259. <dd><p>Not implemented yet.
  260. </p>
  261. </dd>
  262. <dt><code>dup</code> (0x28): <var>a</var> =&gt; <var>a</var> <var>a</var></dt>
  263. <dd><p>Push another copy of the stack&rsquo;s top element.
  264. </p>
  265. </dd>
  266. <dt><code>swap</code> (0x2b): <var>a</var> <var>b</var> =&gt; <var>b</var> <var>a</var></dt>
  267. <dd><p>Exchange the top two items on the stack.
  268. </p>
  269. </dd>
  270. <dt><code>pop</code> (0x29): <var>a</var> =&gt;</dt>
  271. <dd><p>Discard the top value on the stack.
  272. </p>
  273. </dd>
  274. <dt><code>pick</code> (0x32) <var>n</var>: <var>a</var> &hellip; <var>b</var> =&gt; <var>a</var> &hellip; <var>b</var> <var>a</var></dt>
  275. <dd><p>Duplicate an item from the stack and push it on the top of the stack.
  276. <var>n</var>, a single byte, indicates the stack item to copy. If <var>n</var>
  277. is zero, this is the same as <code>dup</code>; if <var>n</var> is one, it copies
  278. the item under the top item, etc. If <var>n</var> exceeds the number of
  279. items on the stack, terminate with an error.
  280. </p>
  281. </dd>
  282. <dt><code>rot</code> (0x33): <var>a</var> <var>b</var> <var>c</var> =&gt; <var>c</var> <var>a</var> <var>b</var></dt>
  283. <dd><p>Rotate the top three items on the stack. The top item (c) becomes the third
  284. item, the next-to-top item (b) becomes the top item and the third item (a) from
  285. the top becomes the next-to-top item.
  286. </p>
  287. </dd>
  288. <dt><code>if_goto</code> (0x20) <var>offset</var>: <var>a</var> &rArr;</dt>
  289. <dd><p>Pop an integer off the stack; if it is non-zero, branch to the given
  290. offset in the bytecode string. Otherwise, continue to the next
  291. instruction in the bytecode stream. In other words, if <var>a</var> is
  292. non-zero, set the <code>pc</code> register to <code>start</code> + <var>offset</var>.
  293. Thus, an offset of zero denotes the beginning of the expression.
  294. </p>
  295. <p>The <var>offset</var> is stored as a sixteen-bit unsigned value, stored
  296. immediately following the <code>if_goto</code> bytecode. It is always stored
  297. most significant byte first, regardless of the target&rsquo;s normal
  298. endianness. The offset is not guaranteed to fall at any particular
  299. alignment within the bytecode stream; thus, on machines where fetching a
  300. 16-bit on an unaligned address raises an exception, you should fetch the
  301. offset one byte at a time.
  302. </p>
  303. </dd>
  304. <dt><code>goto</code> (0x21) <var>offset</var>: &rArr;</dt>
  305. <dd><p>Branch unconditionally to <var>offset</var>; in other words, set the
  306. <code>pc</code> register to <code>start</code> + <var>offset</var>.
  307. </p>
  308. <p>The offset is stored in the same way as for the <code>if_goto</code> bytecode.
  309. </p>
  310. </dd>
  311. <dt><code>const8</code> (0x22) <var>n</var>: &rArr; <var>n</var></dt>
  312. <dt><code>const16</code> (0x23) <var>n</var>: &rArr; <var>n</var></dt>
  313. <dt><code>const32</code> (0x24) <var>n</var>: &rArr; <var>n</var></dt>
  314. <dt><code>const64</code> (0x25) <var>n</var>: &rArr; <var>n</var></dt>
  315. <dd><p>Push the integer constant <var>n</var> on the stack, without sign extension.
  316. To produce a small negative value, push a small twos-complement value,
  317. and then sign-extend it using the <code>ext</code> bytecode.
  318. </p>
  319. <p>The constant <var>n</var> is stored in the appropriate number of bytes
  320. following the <code>const</code><var>b</var> bytecode. The constant <var>n</var> is
  321. always stored most significant byte first, regardless of the target&rsquo;s
  322. normal endianness. The constant is not guaranteed to fall at any
  323. particular alignment within the bytecode stream; thus, on machines where
  324. fetching a 16-bit on an unaligned address raises an exception, you
  325. should fetch <var>n</var> one byte at a time.
  326. </p>
  327. </dd>
  328. <dt><code>reg</code> (0x26) <var>n</var>: &rArr; <var>a</var></dt>
  329. <dd><p>Push the value of register number <var>n</var>, without sign extension. The
  330. registers are numbered following GDB&rsquo;s conventions.
  331. </p>
  332. <p>The register number <var>n</var> is encoded as a 16-bit unsigned integer
  333. immediately following the <code>reg</code> bytecode. It is always stored most
  334. significant byte first, regardless of the target&rsquo;s normal endianness.
  335. The register number is not guaranteed to fall at any particular
  336. alignment within the bytecode stream; thus, on machines where fetching a
  337. 16-bit on an unaligned address raises an exception, you should fetch the
  338. register number one byte at a time.
  339. </p>
  340. </dd>
  341. <dt><code>getv</code> (0x2c) <var>n</var>: &rArr; <var>v</var></dt>
  342. <dd><p>Push the value of trace state variable number <var>n</var>, without sign
  343. extension.
  344. </p>
  345. <p>The variable number <var>n</var> is encoded as a 16-bit unsigned integer
  346. immediately following the <code>getv</code> bytecode. It is always stored most
  347. significant byte first, regardless of the target&rsquo;s normal endianness.
  348. The variable number is not guaranteed to fall at any particular
  349. alignment within the bytecode stream; thus, on machines where fetching a
  350. 16-bit on an unaligned address raises an exception, you should fetch the
  351. register number one byte at a time.
  352. </p>
  353. </dd>
  354. <dt><code>setv</code> (0x2d) <var>n</var>: <var>v</var> &rArr; <var>v</var></dt>
  355. <dd><p>Set trace state variable number <var>n</var> to the value found on the top
  356. of the stack. The stack is unchanged, so that the value is readily
  357. available if the assignment is part of a larger expression. The
  358. handling of <var>n</var> is as described for <code>getv</code>.
  359. </p>
  360. </dd>
  361. <dt><code>trace</code> (0x0c): <var>addr</var> <var>size</var> &rArr;</dt>
  362. <dd><p>Record the contents of the <var>size</var> bytes at <var>addr</var> in a trace
  363. buffer, for later retrieval by GDB.
  364. </p>
  365. </dd>
  366. <dt><code>trace_quick</code> (0x0d) <var>size</var>: <var>addr</var> &rArr; <var>addr</var></dt>
  367. <dd><p>Record the contents of the <var>size</var> bytes at <var>addr</var> in a trace
  368. buffer, for later retrieval by GDB. <var>size</var> is a single byte
  369. unsigned integer following the <code>trace</code> opcode.
  370. </p>
  371. <p>This bytecode is equivalent to the sequence <code>dup const8 <var>size</var>
  372. trace</code>, but we provide it anyway to save space in bytecode strings.
  373. </p>
  374. </dd>
  375. <dt><code>trace16</code> (0x30) <var>size</var>: <var>addr</var> &rArr; <var>addr</var></dt>
  376. <dd><p>Identical to trace_quick, except that <var>size</var> is a 16-bit big-endian
  377. unsigned integer, not a single byte. This should probably have been
  378. named <code>trace_quick16</code>, for consistency.
  379. </p>
  380. </dd>
  381. <dt><code>tracev</code> (0x2e) <var>n</var>: &rArr; <var>a</var></dt>
  382. <dd><p>Record the value of trace state variable number <var>n</var> in the trace
  383. buffer. The handling of <var>n</var> is as described for <code>getv</code>.
  384. </p>
  385. </dd>
  386. <dt><code>tracenz</code> (0x2f) <var>addr</var> <var>size</var> &rArr;</dt>
  387. <dd><p>Record the bytes at <var>addr</var> in a trace buffer, for later retrieval
  388. by GDB. Stop at either the first zero byte, or when <var>size</var> bytes
  389. have been recorded, whichever occurs first.
  390. </p>
  391. </dd>
  392. <dt><code>printf</code> (0x34) <var>numargs</var> <var>string</var> &rArr;</dt>
  393. <dd><p>Do a formatted print, in the style of the C function <code>printf</code>).
  394. The value of <var>numargs</var> is the number of arguments to expect on the
  395. stack, while <var>string</var> is the format string, prefixed with a
  396. two-byte length. The last byte of the string must be zero, and is
  397. included in the length. The format string includes escaped sequences
  398. just as it appears in C source, so for instance the format string
  399. <code>&quot;\t%d\n&quot;</code> is six characters long, and the output will consist of
  400. a tab character, a decimal number, and a newline. At the top of the
  401. stack, above the values to be printed, this bytecode will pop a
  402. &ldquo;function&rdquo; and &ldquo;channel&rdquo;. If the function is nonzero, then the
  403. target may treat it as a function and call it, passing the channel as
  404. a first argument, as with the C function <code>fprintf</code>. If the
  405. function is zero, then the target may simply call a standard formatted
  406. print function of its choice. In all, this bytecode pops 2 +
  407. <var>numargs</var> stack elements, and pushes nothing.
  408. </p>
  409. </dd>
  410. <dt><code>end</code> (0x27): &rArr;</dt>
  411. <dd><p>Stop executing bytecode; the result should be the top element of the
  412. stack. If the purpose of the expression was to compute an lvalue or a
  413. range of memory, then the next-to-top of the stack is the lvalue&rsquo;s
  414. address, and the top of the stack is the lvalue&rsquo;s size, in bytes.
  415. </p>
  416. </dd>
  417. </dl>
  418. <hr>
  419. <div class="header">
  420. <p>
  421. Next: <a href="Using-Agent-Expressions.html#Using-Agent-Expressions" accesskey="n" rel="next">Using Agent Expressions</a>, Previous: <a href="General-Bytecode-Design.html#General-Bytecode-Design" accesskey="p" rel="previous">General Bytecode Design</a>, Up: <a href="Agent-Expressions.html#Agent-Expressions" accesskey="u" rel="up">Agent Expressions</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>
  422. </div>
  423. </body>
  424. </html>