hc
2023-11-06 15ade055295d13f95d49e3d99b09f3bbfb4a43e7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2021 Free Software Foundation, Inc.
 
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Free Software" and "Free Software Needs
Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
and with the Back-Cover Texts as in (a) below.
 
(a) The FSF's Back-Cover Text is: "You are free to copy and modify
this GNU Manual.  Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom." -->
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Debugging with GDB: GDB/MI Program Execution</title>
 
<meta name="description" content="Debugging with GDB: GDB/MI Program Execution">
<meta name="keywords" content="Debugging with GDB: GDB/MI Program Execution">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="GDB_002fMI.html#GDB_002fMI" rel="up" title="GDB/MI">
<link href="GDB_002fMI-Stack-Manipulation.html#GDB_002fMI-Stack-Manipulation" rel="next" title="GDB/MI Stack Manipulation">
<link href="GDB_002fMI-Ada-Tasking-Commands.html#GDB_002fMI-Ada-Tasking-Commands" rel="previous" title="GDB/MI Ada Tasking Commands">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
 
 
</head>
 
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="GDB_002fMI-Program-Execution"></a>
<div class="header">
<p>
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>
</div>
<hr>
<a name="GDB_002fMI-Program-Execution-1"></a>
<h3 class="section">27.13 <small>GDB/MI</small> Program Execution</h3>
 
<p>These are the asynchronous commands which generate the out-of-band
record &lsquo;<samp>*stopped</samp>&rsquo;.  Currently <small>GDB</small> only really executes
asynchronously with remote targets and this interaction is mimicked in
other cases.
</p>
<a name="The-_002dexec_002dcontinue-Command"></a>
<h4 class="subheading">The <code>-exec-continue</code> Command</h4>
<a name="index-_002dexec_002dcontinue"></a>
 
<a name="Synopsis-30"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-continue [--reverse] [--all|--thread-group N]
</pre></div>
 
<p>Resumes the execution of the inferior program, which will continue
to execute until it reaches a debugger stop event.  If the 
&lsquo;<samp>--reverse</samp>&rsquo; option is specified, execution resumes in reverse until 
it reaches a stop event.  Stop events may include
</p><ul>
<li> breakpoints or watchpoints
</li><li> signals or exceptions
</li><li> the end of the process (or its beginning under &lsquo;<samp>--reverse</samp>&rsquo;)
</li><li> the end or beginning of a replay log if one is being used.
</li></ul>
<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
value of the &lsquo;<samp>scheduler-locking</samp>&rsquo; variable.  If &lsquo;<samp>--all</samp>&rsquo; is
specified, all threads (in all inferiors) will be resumed.  The &lsquo;<samp>--all</samp>&rsquo; option is
ignored in all-stop mode.  If the &lsquo;<samp>--thread-group</samp>&rsquo; options is
specified, then all threads in that thread group are resumed.
</p>
<a name="GDB-Command-29"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> corresponding is &lsquo;<samp>continue</samp>&rsquo;.
</p>
<a name="Example-29"></a>
<h4 class="subsubheading">Example</h4>
 
<div class="smallexample">
<pre class="smallexample">-exec-continue
^running
(gdb)
@Hello world
*stopped,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,bkptno=&quot;2&quot;,frame={
func=&quot;foo&quot;,args=[],file=&quot;hello.c&quot;,fullname=&quot;/home/foo/bar/hello.c&quot;,
line=&quot;13&quot;,arch=&quot;i386:x86_64&quot;}
(gdb)
</pre></div>
 
 
<a name="The-_002dexec_002dfinish-Command"></a>
<h4 class="subheading">The <code>-exec-finish</code> Command</h4>
<a name="index-_002dexec_002dfinish"></a>
 
<a name="Synopsis-31"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-finish [--reverse]
</pre></div>
 
<p>Resumes the execution of the inferior program until the current
function is exited.  Displays the results returned by the function.
If the &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes the reverse
execution of the inferior program until the point where current
function was called.
</p>
<a name="GDB-Command-30"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>finish</samp>&rsquo;.
</p>
<a name="Example-30"></a>
<h4 class="subsubheading">Example</h4>
 
<p>Function returning <code>void</code>.
</p>
<div class="smallexample">
<pre class="smallexample">-exec-finish
^running
(gdb)
@hello from foo
*stopped,reason=&quot;function-finished&quot;,frame={func=&quot;main&quot;,args=[],
file=&quot;hello.c&quot;,fullname=&quot;/home/foo/bar/hello.c&quot;,line=&quot;7&quot;,arch=&quot;i386:x86_64&quot;}
(gdb)
</pre></div>
 
<p>Function returning other than <code>void</code>.  The name of the internal
<small>GDB</small> variable storing the result is printed, together with the
value itself.
</p>
<div class="smallexample">
<pre class="smallexample">-exec-finish
^running
(gdb)
*stopped,reason=&quot;function-finished&quot;,frame={addr=&quot;0x000107b0&quot;,func=&quot;foo&quot;,
args=[{name=&quot;a&quot;,value=&quot;1&quot;],{name=&quot;b&quot;,value=&quot;9&quot;}},
file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;14&quot;,
arch=&quot;i386:x86_64&quot;},
gdb-result-var=&quot;$1&quot;,return-value=&quot;0&quot;
(gdb)
</pre></div>
 
 
<a name="The-_002dexec_002dinterrupt-Command"></a>
<h4 class="subheading">The <code>-exec-interrupt</code> Command</h4>
<a name="index-_002dexec_002dinterrupt"></a>
 
<a name="Synopsis-32"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-interrupt [--all|--thread-group N]
</pre></div>
 
<p>Interrupts the background execution of the target.  Note how the token
associated with the stop message is the one for the execution command
that has been interrupted.  The token for the interrupt itself only
appears in the &lsquo;<samp>^done</samp>&rsquo; output.  If the user is trying to
interrupt a non-running program, an error message will be printed.
</p>
<p>Note that when asynchronous execution is enabled, this command is
asynchronous just like other execution commands.  That is, first the
&lsquo;<samp>^done</samp>&rsquo; response will be printed, and the target stop will be
reported after that using the &lsquo;<samp>*stopped</samp>&rsquo; notification.
</p>
<p>In non-stop mode, only the context thread is interrupted by default.
All threads (in all inferiors) will be interrupted if the
&lsquo;<samp>--all</samp>&rsquo;  option is specified.  If the &lsquo;<samp>--thread-group</samp>&rsquo;
option is specified, all threads in that group will be interrupted.
</p>
<a name="GDB-Command-31"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>interrupt</samp>&rsquo;.
</p>
<a name="Example-31"></a>
<h4 class="subsubheading">Example</h4>
 
<div class="smallexample">
<pre class="smallexample">(gdb)
111-exec-continue
111^running
 
(gdb)
222-exec-interrupt
222^done
(gdb)
111*stopped,signal-name=&quot;SIGINT&quot;,signal-meaning=&quot;Interrupt&quot;,
frame={addr=&quot;0x00010140&quot;,func=&quot;foo&quot;,args=[],file=&quot;try.c&quot;,
fullname=&quot;/home/foo/bar/try.c&quot;,line=&quot;13&quot;,arch=&quot;i386:x86_64&quot;}
(gdb)
 
(gdb)
-exec-interrupt
^error,msg=&quot;mi_cmd_exec_interrupt: Inferior not executing.&quot;
(gdb)
</pre></div>
 
<a name="The-_002dexec_002djump-Command"></a>
<h4 class="subheading">The <code>-exec-jump</code> Command</h4>
<a name="index-_002dexec_002djump"></a>
 
<a name="Synopsis-33"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-jump <var>location</var>
</pre></div>
 
<p>Resumes execution of the inferior program at the location specified by
parameter.  See <a href="Specify-Location.html#Specify-Location">Specify Location</a>, for a description of the
different forms of <var>location</var>.
</p>
<a name="GDB-Command-32"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>jump</samp>&rsquo;.
</p>
<a name="Example-32"></a>
<h4 class="subsubheading">Example</h4>
 
<div class="smallexample">
<pre class="smallexample">-exec-jump foo.c:10
*running,thread-id=&quot;all&quot;
^running
</pre></div>
 
 
<a name="The-_002dexec_002dnext-Command"></a>
<h4 class="subheading">The <code>-exec-next</code> Command</h4>
<a name="index-_002dexec_002dnext"></a>
 
<a name="Synopsis-34"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-next [--reverse]
</pre></div>
 
<p>Resumes execution of the inferior program, stopping when the beginning
of the next source line is reached.
</p>
<p>If the &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes reverse execution
of the inferior program, stopping at the beginning of the previous
source line.  If you issue this command on the first line of a
function, it will take you back to the caller of that function, to the
source line where the function was called.
</p>
 
<a name="GDB-Command-33"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>next</samp>&rsquo;.
</p>
<a name="Example-33"></a>
<h4 class="subsubheading">Example</h4>
 
<div class="smallexample">
<pre class="smallexample">-exec-next
^running
(gdb)
*stopped,reason=&quot;end-stepping-range&quot;,line=&quot;8&quot;,file=&quot;hello.c&quot;
(gdb)
</pre></div>
 
 
<a name="The-_002dexec_002dnext_002dinstruction-Command"></a>
<h4 class="subheading">The <code>-exec-next-instruction</code> Command</h4>
<a name="index-_002dexec_002dnext_002dinstruction"></a>
 
<a name="Synopsis-35"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-next-instruction [--reverse]
</pre></div>
 
<p>Executes one machine instruction.  If the instruction is a function
call, continues until the function returns.  If the program stops at an
instruction in the middle of a source line, the address will be
printed as well.
</p>
<p>If the &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes reverse execution
of the inferior program, stopping at the previous instruction.  If the
previously executed instruction was a return from another function,
it will continue to execute in reverse until the call to that function
(from the current stack frame) is reached.
</p>
<a name="GDB-Command-34"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>nexti</samp>&rsquo;.
</p>
<a name="Example-34"></a>
<h4 class="subsubheading">Example</h4>
 
<div class="smallexample">
<pre class="smallexample">(gdb)
-exec-next-instruction
^running
 
(gdb)
*stopped,reason=&quot;end-stepping-range&quot;,
addr=&quot;0x000100d4&quot;,line=&quot;5&quot;,file=&quot;hello.c&quot;
(gdb)
</pre></div>
 
 
<a name="The-_002dexec_002dreturn-Command"></a>
<h4 class="subheading">The <code>-exec-return</code> Command</h4>
<a name="index-_002dexec_002dreturn"></a>
 
<a name="Synopsis-36"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-return
</pre></div>
 
<p>Makes current function return immediately.  Doesn&rsquo;t execute the inferior.
Displays the new current frame.
</p>
<a name="GDB-Command-35"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>return</samp>&rsquo;.
</p>
<a name="Example-35"></a>
<h4 class="subsubheading">Example</h4>
 
<div class="smallexample">
<pre class="smallexample">(gdb)
200-break-insert callee4
200^done,bkpt={number=&quot;1&quot;,addr=&quot;0x00010734&quot;,
file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;8&quot;}
(gdb)
000-exec-run
000^running
(gdb)
000*stopped,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,bkptno=&quot;1&quot;,
frame={func=&quot;callee4&quot;,args=[],
file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;8&quot;,
arch=&quot;i386:x86_64&quot;}
(gdb)
205-break-delete
205^done
(gdb)
111-exec-return
111^done,frame={level=&quot;0&quot;,func=&quot;callee3&quot;,
args=[{name=&quot;strarg&quot;,
value=&quot;0x11940 \&quot;A string argument.\&quot;&quot;}],
file=&quot;../../../devo/gdb/testsuite/gdb.mi/basics.c&quot;,
fullname=&quot;/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c&quot;,line=&quot;18&quot;,
arch=&quot;i386:x86_64&quot;}
(gdb)
</pre></div>
 
 
<a name="The-_002dexec_002drun-Command"></a>
<h4 class="subheading">The <code>-exec-run</code> Command</h4>
<a name="index-_002dexec_002drun"></a>
 
<a name="Synopsis-37"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-run [ --all | --thread-group N ] [ --start ]
</pre></div>
 
<p>Starts execution of the inferior from the beginning.  The inferior
executes until either a breakpoint is encountered or the program
exits.  In the latter case the output will include an exit code, if
the program has exited exceptionally.
</p>
<p>When neither the &lsquo;<samp>--all</samp>&rsquo; nor the &lsquo;<samp>--thread-group</samp>&rsquo; option
is specified, the current inferior is started.  If the
&lsquo;<samp>--thread-group</samp>&rsquo; option is specified, it should refer to a thread
group of type &lsquo;<samp>process</samp>&rsquo;, and that thread group will be started.
If the &lsquo;<samp>--all</samp>&rsquo; option is specified, then all inferiors will be started.
</p>
<p>Using the &lsquo;<samp>--start</samp>&rsquo; option instructs the debugger to stop
the execution at the start of the inferior&rsquo;s main subprogram,
following the same behavior as the <code>start</code> command
(see <a href="Starting.html#Starting">Starting</a>).
</p>
<a name="GDB-Command-36"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>run</samp>&rsquo;.
</p>
<a name="Examples-2"></a>
<h4 class="subsubheading">Examples</h4>
 
<div class="smallexample">
<pre class="smallexample">(gdb)
-break-insert main
^done,bkpt={number=&quot;1&quot;,addr=&quot;0x0001072c&quot;,file=&quot;recursive2.c&quot;,line=&quot;4&quot;}
(gdb)
-exec-run
^running
(gdb)
*stopped,reason=&quot;breakpoint-hit&quot;,disp=&quot;keep&quot;,bkptno=&quot;1&quot;,
frame={func=&quot;main&quot;,args=[],file=&quot;recursive2.c&quot;,
fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;4&quot;,arch=&quot;i386:x86_64&quot;}
(gdb)
</pre></div>
 
<p>Program exited normally:
</p>
<div class="smallexample">
<pre class="smallexample">(gdb)
-exec-run
^running
(gdb)
x = 55
*stopped,reason=&quot;exited-normally&quot;
(gdb)
</pre></div>
 
<p>Program exited exceptionally:
</p>
<div class="smallexample">
<pre class="smallexample">(gdb)
-exec-run
^running
(gdb)
x = 55
*stopped,reason=&quot;exited&quot;,exit-code=&quot;01&quot;
(gdb)
</pre></div>
 
<p>Another way the program can terminate is if it receives a signal such as
<code>SIGINT</code>.  In this case, <small>GDB/MI</small> displays this:
</p>
<div class="smallexample">
<pre class="smallexample">(gdb)
*stopped,reason=&quot;exited-signalled&quot;,signal-name=&quot;SIGINT&quot;,
signal-meaning=&quot;Interrupt&quot;
</pre></div>
 
 
 
 
<a name="The-_002dexec_002dstep-Command"></a>
<h4 class="subheading">The <code>-exec-step</code> Command</h4>
<a name="index-_002dexec_002dstep"></a>
 
<a name="Synopsis-38"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-step [--reverse]
</pre></div>
 
<p>Resumes execution of the inferior program, stopping when the beginning
of the next source line is reached, if the next source line is not a
function call.  If it is, stop at the first instruction of the called
function.  If the &lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes reverse
execution of the inferior program, stopping at the beginning of the
previously executed source line.
</p>
<a name="GDB-Command-37"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>step</samp>&rsquo;.
</p>
<a name="Example-36"></a>
<h4 class="subsubheading">Example</h4>
 
<p>Stepping into a function:
</p>
<div class="smallexample">
<pre class="smallexample">-exec-step
^running
(gdb)
*stopped,reason=&quot;end-stepping-range&quot;,
frame={func=&quot;foo&quot;,args=[{name=&quot;a&quot;,value=&quot;10&quot;},
{name=&quot;b&quot;,value=&quot;0&quot;}],file=&quot;recursive2.c&quot;,
fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;11&quot;,arch=&quot;i386:x86_64&quot;}
(gdb)
</pre></div>
 
<p>Regular stepping:
</p>
<div class="smallexample">
<pre class="smallexample">-exec-step
^running
(gdb)
*stopped,reason=&quot;end-stepping-range&quot;,line=&quot;14&quot;,file=&quot;recursive2.c&quot;
(gdb)
</pre></div>
 
 
<a name="The-_002dexec_002dstep_002dinstruction-Command"></a>
<h4 class="subheading">The <code>-exec-step-instruction</code> Command</h4>
<a name="index-_002dexec_002dstep_002dinstruction"></a>
 
<a name="Synopsis-39"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-step-instruction [--reverse]
</pre></div>
 
<p>Resumes the inferior which executes one machine instruction.  If the
&lsquo;<samp>--reverse</samp>&rsquo; option is specified, resumes reverse execution of the
inferior program, stopping at the previously executed instruction.
The output, once <small>GDB</small> has stopped, will vary depending on
whether we have stopped in the middle of a source line or not.  In the
former case, the address at which the program stopped will be printed
as well.
</p>
<a name="GDB-Command-38"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>stepi</samp>&rsquo;.
</p>
<a name="Example-37"></a>
<h4 class="subsubheading">Example</h4>
 
<div class="smallexample">
<pre class="smallexample">(gdb)
-exec-step-instruction
^running
 
(gdb)
*stopped,reason=&quot;end-stepping-range&quot;,
frame={func=&quot;foo&quot;,args=[],file=&quot;try.c&quot;,
fullname=&quot;/home/foo/bar/try.c&quot;,line=&quot;10&quot;,arch=&quot;i386:x86_64&quot;}
(gdb)
-exec-step-instruction
^running
 
(gdb)
*stopped,reason=&quot;end-stepping-range&quot;,
frame={addr=&quot;0x000100f4&quot;,func=&quot;foo&quot;,args=[],file=&quot;try.c&quot;,
fullname=&quot;/home/foo/bar/try.c&quot;,line=&quot;10&quot;,arch=&quot;i386:x86_64&quot;}
(gdb)
</pre></div>
 
 
<a name="The-_002dexec_002duntil-Command"></a>
<h4 class="subheading">The <code>-exec-until</code> Command</h4>
<a name="index-_002dexec_002duntil"></a>
 
<a name="Synopsis-40"></a>
<h4 class="subsubheading">Synopsis</h4>
 
<div class="smallexample">
<pre class="smallexample"> -exec-until [ <var>location</var> ]
</pre></div>
 
<p>Executes the inferior until the <var>location</var> specified in the
argument is reached.  If there is no argument, the inferior executes
until a source line greater than the current one is reached.  The
reason for stopping in this case will be &lsquo;<samp>location-reached</samp>&rsquo;.
</p>
<a name="GDB-Command-39"></a>
<h4 class="subsubheading"><small>GDB</small> Command</h4>
 
<p>The corresponding <small>GDB</small> command is &lsquo;<samp>until</samp>&rsquo;.
</p>
<a name="Example-38"></a>
<h4 class="subsubheading">Example</h4>
 
<div class="smallexample">
<pre class="smallexample">(gdb)
-exec-until recursive2.c:6
^running
(gdb)
x = 55
*stopped,reason=&quot;location-reached&quot;,frame={func=&quot;main&quot;,args=[],
file=&quot;recursive2.c&quot;,fullname=&quot;/home/foo/bar/recursive2.c&quot;,line=&quot;6&quot;,
arch=&quot;i386:x86_64&quot;}
(gdb)
</pre></div>
 
 
<hr>
<div class="header">
<p>
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>
</div>
 
 
 
</body>
</html>