GDB_002fMI-Program-Execution.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  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: GDB/MI Program Execution</title>
  16. <meta name="description" content="Debugging with GDB: GDB/MI Program Execution">
  17. <meta name="keywords" content="Debugging with GDB: GDB/MI Program Execution">
  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="GDB_002fMI.html#GDB_002fMI" rel="up" title="GDB/MI">
  26. <link href="GDB_002fMI-Stack-Manipulation.html#GDB_002fMI-Stack-Manipulation" rel="next" title="GDB/MI Stack Manipulation">
  27. <link href="GDB_002fMI-Ada-Tasking-Commands.html#GDB_002fMI-Ada-Tasking-Commands" rel="previous" title="GDB/MI Ada Tasking Commands">
  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="GDB_002fMI-Program-Execution"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="GDB_002fMI-Stack-Manipulation.html#GDB_002fMI-Stack-Manipulation" accesskey="n" rel="next">GDB/MI Stack Manipulation</a>, Previous: <a href="GDB_002fMI-Ada-Tasking-Commands.html#GDB_002fMI-Ada-Tasking-Commands" accesskey="p" rel="previous">GDB/MI Ada Tasking Commands</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</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="GDB_002fMI-Program-Execution-1"></a>
  65. <h3 class="section">27.13 <small>GDB/MI</small> Program Execution</h3>
  66. <p>These are the asynchronous commands which generate the out-of-band
  67. record &lsquo;<samp>*stopped</samp>&rsquo;. Currently <small>GDB</small> only really executes
  68. asynchronously with remote targets and this interaction is mimicked in
  69. other cases.
  70. </p>
  71. <a name="The-_002dexec_002dcontinue-Command"></a>
  72. <h4 class="subheading">The <code>-exec-continue</code> Command</h4>
  73. <a name="index-_002dexec_002dcontinue"></a>
  74. <a name="Synopsis-30"></a>
  75. <h4 class="subsubheading">Synopsis</h4>
  76. <div class="smallexample">
  77. <pre class="smallexample"> -exec-continue [--reverse] [--all|--thread-group N]
  78. </pre></div>
  79. <p>Resumes the execution of the inferior program, which will continue
  80. to execute until it reaches a debugger stop event. If the
  81. &lsquo;<samp>--reverse</samp>&rsquo; option is specified, execution resumes in reverse until
  82. it reaches a stop event. Stop events may include
  83. </p><ul>
  84. <li> breakpoints or watchpoints
  85. </li><li> signals or exceptions
  86. </li><li> the end of the process (or its beginning under &lsquo;<samp>--reverse</samp>&rsquo;)
  87. </li><li> the end or beginning of a replay log if one is being used.
  88. </li></ul>
  89. <p>In all-stop mode (see <a href="All_002dStop-Mode.html#All_002dStop-Mode">All-Stop Mode</a>), may resume only one thread, or all threads, depending on the
  90. value of the &lsquo;<samp>scheduler-locking</samp>&rsquo; variable. If &lsquo;<samp>--all</samp>&rsquo; is
  91. specified, all threads (in all inferiors) will be resumed. The &lsquo;<samp>--all</samp>&rsquo; option is
  92. ignored in all-stop mode. If the &lsquo;<samp>--thread-group</samp>&rsquo; options is
  93. specified, then all threads in that thread group are resumed.
  94. </p>
  95. <a name="GDB-Command-29"></a>
  96. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  97. <p>The corresponding <small>GDB</small> corresponding is &lsquo;<samp>continue</samp>&rsquo;.
  98. </p>
  99. <a name="Example-29"></a>
  100. <h4 class="subsubheading">Example</h4>
  101. <div class="smallexample">
  102. <pre class="smallexample">-exec-continue
  103. ^running
  104. (gdb)
  105. @Hello world
  106. *stopped,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,bkptno=&quot;2&quot;,frame={
  107. func=&quot;foo&quot;,args=[],file=&quot;hello.c&quot;,fullname=&quot;/home/foo/bar/hello.c&quot;,
  108. line=&quot;13&quot;,arch=&quot;i386:x86_64&quot;}
  109. (gdb)
  110. </pre></div>
  111. <a name="The-_002dexec_002dfinish-Command"></a>
  112. <h4 class="subheading">The <code>-exec-finish</code> Command</h4>
  113. <a name="index-_002dexec_002dfinish"></a>
  114. <a name="Synopsis-31"></a>
  115. <h4 class="subsubheading">Synopsis</h4>
  116. <div class="smallexample">
  117. <pre class="smallexample"> -exec-finish [--reverse]
  118. </pre></div>
  119. <p>Resumes the execution of the inferior program until the current
  120. function is exited. Displays the results returned by the function.
  121. If the &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes the reverse
  122. execution of the inferior program until the point where current
  123. function was called.
  124. </p>
  125. <a name="GDB-Command-30"></a>
  126. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  127. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>finish</samp>&rsquo;.
  128. </p>
  129. <a name="Example-30"></a>
  130. <h4 class="subsubheading">Example</h4>
  131. <p>Function returning <code>void</code>.
  132. </p>
  133. <div class="smallexample">
  134. <pre class="smallexample">-exec-finish
  135. ^running
  136. (gdb)
  137. @hello from foo
  138. *stopped,reason=&quot;function-finished&quot;,frame={func=&quot;main&quot;,args=[],
  139. file=&quot;hello.c&quot;,fullname=&quot;/home/foo/bar/hello.c&quot;,line=&quot;7&quot;,arch=&quot;i386:x86_64&quot;}
  140. (gdb)
  141. </pre></div>
  142. <p>Function returning other than <code>void</code>. The name of the internal
  143. <small>GDB</small> variable storing the result is printed, together with the
  144. value itself.
  145. </p>
  146. <div class="smallexample">
  147. <pre class="smallexample">-exec-finish
  148. ^running
  149. (gdb)
  150. *stopped,reason=&quot;function-finished&quot;,frame={addr=&quot;0x000107b0&quot;,func=&quot;foo&quot;,
  151. args=[{name=&quot;a&quot;,value=&quot;1&quot;],{name=&quot;b&quot;,value=&quot;9&quot;}},
  152. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
  153. arch=&quot;i386:x86_64&quot;},
  154. gdb-result-var=&quot;$1&quot;,return-value=&quot;0&quot;
  155. (gdb)
  156. </pre></div>
  157. <a name="The-_002dexec_002dinterrupt-Command"></a>
  158. <h4 class="subheading">The <code>-exec-interrupt</code> Command</h4>
  159. <a name="index-_002dexec_002dinterrupt"></a>
  160. <a name="Synopsis-32"></a>
  161. <h4 class="subsubheading">Synopsis</h4>
  162. <div class="smallexample">
  163. <pre class="smallexample"> -exec-interrupt [--all|--thread-group N]
  164. </pre></div>
  165. <p>Interrupts the background execution of the target. Note how the token
  166. associated with the stop message is the one for the execution command
  167. that has been interrupted. The token for the interrupt itself only
  168. appears in the &lsquo;<samp>^done</samp>&rsquo; output. If the user is trying to
  169. interrupt a non-running program, an error message will be printed.
  170. </p>
  171. <p>Note that when asynchronous execution is enabled, this command is
  172. asynchronous just like other execution commands. That is, first the
  173. &lsquo;<samp>^done</samp>&rsquo; response will be printed, and the target stop will be
  174. reported after that using the &lsquo;<samp>*stopped</samp>&rsquo; notification.
  175. </p>
  176. <p>In non-stop mode, only the context thread is interrupted by default.
  177. All threads (in all inferiors) will be interrupted if the
  178. &lsquo;<samp>--all</samp>&rsquo; option is specified. If the &lsquo;<samp>--thread-group</samp>&rsquo;
  179. option is specified, all threads in that group will be interrupted.
  180. </p>
  181. <a name="GDB-Command-31"></a>
  182. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  183. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>interrupt</samp>&rsquo;.
  184. </p>
  185. <a name="Example-31"></a>
  186. <h4 class="subsubheading">Example</h4>
  187. <div class="smallexample">
  188. <pre class="smallexample">(gdb)
  189. 111-exec-continue
  190. 111^running
  191. (gdb)
  192. 222-exec-interrupt
  193. 222^done
  194. (gdb)
  195. 111*stopped,signal-name=&quot;SIGINT&quot;,signal-meaning=&quot;Interrupt&quot;,
  196. frame={addr=&quot;0x00010140&quot;,func=&quot;foo&quot;,args=[],file=&quot;try.c&quot;,
  197. fullname=&quot;/home/foo/bar/try.c&quot;,line=&quot;13&quot;,arch=&quot;i386:x86_64&quot;}
  198. (gdb)
  199. (gdb)
  200. -exec-interrupt
  201. ^error,msg=&quot;mi_cmd_exec_interrupt: Inferior not executing.&quot;
  202. (gdb)
  203. </pre></div>
  204. <a name="The-_002dexec_002djump-Command"></a>
  205. <h4 class="subheading">The <code>-exec-jump</code> Command</h4>
  206. <a name="index-_002dexec_002djump"></a>
  207. <a name="Synopsis-33"></a>
  208. <h4 class="subsubheading">Synopsis</h4>
  209. <div class="smallexample">
  210. <pre class="smallexample"> -exec-jump <var>location</var>
  211. </pre></div>
  212. <p>Resumes execution of the inferior program at the location specified by
  213. parameter. See <a href="Specify-Location.html#Specify-Location">Specify Location</a>, for a description of the
  214. different forms of <var>location</var>.
  215. </p>
  216. <a name="GDB-Command-32"></a>
  217. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  218. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>jump</samp>&rsquo;.
  219. </p>
  220. <a name="Example-32"></a>
  221. <h4 class="subsubheading">Example</h4>
  222. <div class="smallexample">
  223. <pre class="smallexample">-exec-jump foo.c:10
  224. *running,thread-id=&quot;all&quot;
  225. ^running
  226. </pre></div>
  227. <a name="The-_002dexec_002dnext-Command"></a>
  228. <h4 class="subheading">The <code>-exec-next</code> Command</h4>
  229. <a name="index-_002dexec_002dnext"></a>
  230. <a name="Synopsis-34"></a>
  231. <h4 class="subsubheading">Synopsis</h4>
  232. <div class="smallexample">
  233. <pre class="smallexample"> -exec-next [--reverse]
  234. </pre></div>
  235. <p>Resumes execution of the inferior program, stopping when the beginning
  236. of the next source line is reached.
  237. </p>
  238. <p>If the &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes reverse execution
  239. of the inferior program, stopping at the beginning of the previous
  240. source line. If you issue this command on the first line of a
  241. function, it will take you back to the caller of that function, to the
  242. source line where the function was called.
  243. </p>
  244. <a name="GDB-Command-33"></a>
  245. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  246. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>next</samp>&rsquo;.
  247. </p>
  248. <a name="Example-33"></a>
  249. <h4 class="subsubheading">Example</h4>
  250. <div class="smallexample">
  251. <pre class="smallexample">-exec-next
  252. ^running
  253. (gdb)
  254. *stopped,reason=&quot;end-stepping-range&quot;,line=&quot;8&quot;,file=&quot;hello.c&quot;
  255. (gdb)
  256. </pre></div>
  257. <a name="The-_002dexec_002dnext_002dinstruction-Command"></a>
  258. <h4 class="subheading">The <code>-exec-next-instruction</code> Command</h4>
  259. <a name="index-_002dexec_002dnext_002dinstruction"></a>
  260. <a name="Synopsis-35"></a>
  261. <h4 class="subsubheading">Synopsis</h4>
  262. <div class="smallexample">
  263. <pre class="smallexample"> -exec-next-instruction [--reverse]
  264. </pre></div>
  265. <p>Executes one machine instruction. If the instruction is a function
  266. call, continues until the function returns. If the program stops at an
  267. instruction in the middle of a source line, the address will be
  268. printed as well.
  269. </p>
  270. <p>If the &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes reverse execution
  271. of the inferior program, stopping at the previous instruction. If the
  272. previously executed instruction was a return from another function,
  273. it will continue to execute in reverse until the call to that function
  274. (from the current stack frame) is reached.
  275. </p>
  276. <a name="GDB-Command-34"></a>
  277. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  278. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>nexti</samp>&rsquo;.
  279. </p>
  280. <a name="Example-34"></a>
  281. <h4 class="subsubheading">Example</h4>
  282. <div class="smallexample">
  283. <pre class="smallexample">(gdb)
  284. -exec-next-instruction
  285. ^running
  286. (gdb)
  287. *stopped,reason=&quot;end-stepping-range&quot;,
  288. addr=&quot;0x000100d4&quot;,line=&quot;5&quot;,file=&quot;hello.c&quot;
  289. (gdb)
  290. </pre></div>
  291. <a name="The-_002dexec_002dreturn-Command"></a>
  292. <h4 class="subheading">The <code>-exec-return</code> Command</h4>
  293. <a name="index-_002dexec_002dreturn"></a>
  294. <a name="Synopsis-36"></a>
  295. <h4 class="subsubheading">Synopsis</h4>
  296. <div class="smallexample">
  297. <pre class="smallexample"> -exec-return
  298. </pre></div>
  299. <p>Makes current function return immediately. Doesn&rsquo;t execute the inferior.
  300. Displays the new current frame.
  301. </p>
  302. <a name="GDB-Command-35"></a>
  303. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  304. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>return</samp>&rsquo;.
  305. </p>
  306. <a name="Example-35"></a>
  307. <h4 class="subsubheading">Example</h4>
  308. <div class="smallexample">
  309. <pre class="smallexample">(gdb)
  310. 200-break-insert callee4
  311. 200^done,bkpt={number=&quot;1&quot;,addr=&quot;0x00010734&quot;,
  312. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;8&quot;}
  313. (gdb)
  314. 000-exec-run
  315. 000^running
  316. (gdb)
  317. 000*stopped,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,bkptno=&quot;1&quot;,
  318. frame={func=&quot;callee4&quot;,args=[],
  319. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
  320. fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;8&quot;,
  321. arch=&quot;i386:x86_64&quot;}
  322. (gdb)
  323. 205-break-delete
  324. 205^done
  325. (gdb)
  326. 111-exec-return
  327. 111^done,frame={level=&quot;0&quot;,func=&quot;callee3&quot;,
  328. args=[{name=&quot;strarg&quot;,
  329. value=&quot;0x11940 \&quot;A string argument.\&quot;&quot;}],
  330. file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
  331. fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;18&quot;,
  332. arch=&quot;i386:x86_64&quot;}
  333. (gdb)
  334. </pre></div>
  335. <a name="The-_002dexec_002drun-Command"></a>
  336. <h4 class="subheading">The <code>-exec-run</code> Command</h4>
  337. <a name="index-_002dexec_002drun"></a>
  338. <a name="Synopsis-37"></a>
  339. <h4 class="subsubheading">Synopsis</h4>
  340. <div class="smallexample">
  341. <pre class="smallexample"> -exec-run [ --all | --thread-group N ] [ --start ]
  342. </pre></div>
  343. <p>Starts execution of the inferior from the beginning. The inferior
  344. executes until either a breakpoint is encountered or the program
  345. exits. In the latter case the output will include an exit code, if
  346. the program has exited exceptionally.
  347. </p>
  348. <p>When neither the &lsquo;<samp>--all</samp>&rsquo; nor the &lsquo;<samp>--thread-group</samp>&rsquo; option
  349. is specified, the current inferior is started. If the
  350. &lsquo;<samp>--thread-group</samp>&rsquo; option is specified, it should refer to a thread
  351. group of type &lsquo;<samp>process</samp>&rsquo;, and that thread group will be started.
  352. If the &lsquo;<samp>--all</samp>&rsquo; option is specified, then all inferiors will be started.
  353. </p>
  354. <p>Using the &lsquo;<samp>--start</samp>&rsquo; option instructs the debugger to stop
  355. the execution at the start of the inferior&rsquo;s main subprogram,
  356. following the same behavior as the <code>start</code> command
  357. (see <a href="Starting.html#Starting">Starting</a>).
  358. </p>
  359. <a name="GDB-Command-36"></a>
  360. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  361. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>run</samp>&rsquo;.
  362. </p>
  363. <a name="Examples-2"></a>
  364. <h4 class="subsubheading">Examples</h4>
  365. <div class="smallexample">
  366. <pre class="smallexample">(gdb)
  367. -break-insert main
  368. ^done,bkpt={number=&quot;1&quot;,addr=&quot;0x0001072c&quot;,file=&quot;recursive2.c&quot;,line=&quot;4&quot;}
  369. (gdb)
  370. -exec-run
  371. ^running
  372. (gdb)
  373. *stopped,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,bkptno=&quot;1&quot;,
  374. frame={func=&quot;main&quot;,args=[],file=&quot;recursive2.c&quot;,
  375. fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;4&quot;,arch=&quot;i386:x86_64&quot;}
  376. (gdb)
  377. </pre></div>
  378. <p>Program exited normally:
  379. </p>
  380. <div class="smallexample">
  381. <pre class="smallexample">(gdb)
  382. -exec-run
  383. ^running
  384. (gdb)
  385. x = 55
  386. *stopped,reason=&quot;exited-normally&quot;
  387. (gdb)
  388. </pre></div>
  389. <p>Program exited exceptionally:
  390. </p>
  391. <div class="smallexample">
  392. <pre class="smallexample">(gdb)
  393. -exec-run
  394. ^running
  395. (gdb)
  396. x = 55
  397. *stopped,reason=&quot;exited&quot;,exit-code=&quot;01&quot;
  398. (gdb)
  399. </pre></div>
  400. <p>Another way the program can terminate is if it receives a signal such as
  401. <code>SIGINT</code>. In this case, <small>GDB/MI</small> displays this:
  402. </p>
  403. <div class="smallexample">
  404. <pre class="smallexample">(gdb)
  405. *stopped,reason=&quot;exited-signalled&quot;,signal-name=&quot;SIGINT&quot;,
  406. signal-meaning=&quot;Interrupt&quot;
  407. </pre></div>
  408. <a name="The-_002dexec_002dstep-Command"></a>
  409. <h4 class="subheading">The <code>-exec-step</code> Command</h4>
  410. <a name="index-_002dexec_002dstep"></a>
  411. <a name="Synopsis-38"></a>
  412. <h4 class="subsubheading">Synopsis</h4>
  413. <div class="smallexample">
  414. <pre class="smallexample"> -exec-step [--reverse]
  415. </pre></div>
  416. <p>Resumes execution of the inferior program, stopping when the beginning
  417. of the next source line is reached, if the next source line is not a
  418. function call. If it is, stop at the first instruction of the called
  419. function. If the &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes reverse
  420. execution of the inferior program, stopping at the beginning of the
  421. previously executed source line.
  422. </p>
  423. <a name="GDB-Command-37"></a>
  424. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  425. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>step</samp>&rsquo;.
  426. </p>
  427. <a name="Example-36"></a>
  428. <h4 class="subsubheading">Example</h4>
  429. <p>Stepping into a function:
  430. </p>
  431. <div class="smallexample">
  432. <pre class="smallexample">-exec-step
  433. ^running
  434. (gdb)
  435. *stopped,reason=&quot;end-stepping-range&quot;,
  436. frame={func=&quot;foo&quot;,args=[{name=&quot;a&quot;,value=&quot;10&quot;},
  437. {name=&quot;b&quot;,value=&quot;0&quot;}],file=&quot;recursive2.c&quot;,
  438. fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;11&quot;,arch=&quot;i386:x86_64&quot;}
  439. (gdb)
  440. </pre></div>
  441. <p>Regular stepping:
  442. </p>
  443. <div class="smallexample">
  444. <pre class="smallexample">-exec-step
  445. ^running
  446. (gdb)
  447. *stopped,reason=&quot;end-stepping-range&quot;,line=&quot;14&quot;,file=&quot;recursive2.c&quot;
  448. (gdb)
  449. </pre></div>
  450. <a name="The-_002dexec_002dstep_002dinstruction-Command"></a>
  451. <h4 class="subheading">The <code>-exec-step-instruction</code> Command</h4>
  452. <a name="index-_002dexec_002dstep_002dinstruction"></a>
  453. <a name="Synopsis-39"></a>
  454. <h4 class="subsubheading">Synopsis</h4>
  455. <div class="smallexample">
  456. <pre class="smallexample"> -exec-step-instruction [--reverse]
  457. </pre></div>
  458. <p>Resumes the inferior which executes one machine instruction. If the
  459. &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes reverse execution of the
  460. inferior program, stopping at the previously executed instruction.
  461. The output, once <small>GDB</small> has stopped, will vary depending on
  462. whether we have stopped in the middle of a source line or not. In the
  463. former case, the address at which the program stopped will be printed
  464. as well.
  465. </p>
  466. <a name="GDB-Command-38"></a>
  467. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  468. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>stepi</samp>&rsquo;.
  469. </p>
  470. <a name="Example-37"></a>
  471. <h4 class="subsubheading">Example</h4>
  472. <div class="smallexample">
  473. <pre class="smallexample">(gdb)
  474. -exec-step-instruction
  475. ^running
  476. (gdb)
  477. *stopped,reason=&quot;end-stepping-range&quot;,
  478. frame={func=&quot;foo&quot;,args=[],file=&quot;try.c&quot;,
  479. fullname=&quot;/home/foo/bar/try.c&quot;,line=&quot;10&quot;,arch=&quot;i386:x86_64&quot;}
  480. (gdb)
  481. -exec-step-instruction
  482. ^running
  483. (gdb)
  484. *stopped,reason=&quot;end-stepping-range&quot;,
  485. frame={addr=&quot;0x000100f4&quot;,func=&quot;foo&quot;,args=[],file=&quot;try.c&quot;,
  486. fullname=&quot;/home/foo/bar/try.c&quot;,line=&quot;10&quot;,arch=&quot;i386:x86_64&quot;}
  487. (gdb)
  488. </pre></div>
  489. <a name="The-_002dexec_002duntil-Command"></a>
  490. <h4 class="subheading">The <code>-exec-until</code> Command</h4>
  491. <a name="index-_002dexec_002duntil"></a>
  492. <a name="Synopsis-40"></a>
  493. <h4 class="subsubheading">Synopsis</h4>
  494. <div class="smallexample">
  495. <pre class="smallexample"> -exec-until [ <var>location</var> ]
  496. </pre></div>
  497. <p>Executes the inferior until the <var>location</var> specified in the
  498. argument is reached. If there is no argument, the inferior executes
  499. until a source line greater than the current one is reached. The
  500. reason for stopping in this case will be &lsquo;<samp>location-reached</samp>&rsquo;.
  501. </p>
  502. <a name="GDB-Command-39"></a>
  503. <h4 class="subsubheading"><small>GDB</small> Command</h4>
  504. <p>The corresponding <small>GDB</small> command is &lsquo;<samp>until</samp>&rsquo;.
  505. </p>
  506. <a name="Example-38"></a>
  507. <h4 class="subsubheading">Example</h4>
  508. <div class="smallexample">
  509. <pre class="smallexample">(gdb)
  510. -exec-until recursive2.c:6
  511. ^running
  512. (gdb)
  513. x = 55
  514. *stopped,reason=&quot;location-reached&quot;,frame={func=&quot;main&quot;,args=[],
  515. file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;6&quot;,
  516. arch=&quot;i386:x86_64&quot;}
  517. (gdb)
  518. </pre></div>
  519. <hr>
  520. <div class="header">
  521. <p>
  522. Next: <a href="GDB_002fMI-Stack-Manipulation.html#GDB_002fMI-Stack-Manipulation" accesskey="n" rel="next">GDB/MI Stack Manipulation</a>, Previous: <a href="GDB_002fMI-Ada-Tasking-Commands.html#GDB_002fMI-Ada-Tasking-Commands" accesskey="p" rel="previous">GDB/MI Ada Tasking Commands</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</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>
  523. </div>
  524. </body>
  525. </html>