Go to the first, previous, next, last section, table of contents.


GDB/MI Program control

Program termination

As a result of execution, the inferior program can run to completion, if it doesn't encounter any breakpoints. In this case the output will include an exit code, if the program has exited exceptionally.

Examples

Program exited normally:

(gdb)
-exec-run
^running
(gdb)
x = 55
*stopped,reason="exited-normally"
(gdb)

Program exited exceptionally:

(gdb)
-exec-run
^running
(gdb)
x = 55
*stopped,reason="exited",exit-code="01"
(gdb)

Another way the program can terminate is if it receives a signal such as SIGINT. In this case, GDB/MI displays this:

(gdb)
*stopped,reason="exited-signalled",signal-name="SIGINT",
signal-meaning="Interrupt"

The -exec-abort Command

Synopsis

 -exec-abort

Kill the inferior running program.

GDB Command

The corresponding GDB command is `kill'.

Example

N.A.

The -exec-arguments Command

Synopsis

 -exec-arguments args

Set the inferior program arguments, to be used in the next `-exec-run'.

GDB Command

The corresponding GDB command is `set args'.

Example

Don't have one around.

The -exec-continue Command

Synopsis

 -exec-continue

Asynchronous command. Resumes the execution of the inferior program until a breakpoint is encountered, or until the inferior exits.

GDB Command

The corresponding GDB corresponding is `continue'.

Example

-exec-continue
^running
(gdb)
@Hello world
*stopped,reason="breakpoint-hit",bkptno="2",frame={func="foo",args=[],
file="hello.c",line="13"}
(gdb)

The -exec-finish Command

Synopsis

 -exec-finish

Asynchronous command. Resumes the execution of the inferior program until the current function is exited. Displays the results returned by the function.

GDB Command

The corresponding GDB command is `finish'.

Example

Function returning void.

-exec-finish
^running
(gdb)
@hello from foo
*stopped,reason="function-finished",frame={func="main",args=[],
file="hello.c",line="7"}
(gdb)

Function returning other than void. The name of the internal GDB variable storing the result is printed, together with the value itself.

-exec-finish
^running
(gdb)
*stopped,reason="function-finished",frame={addr="0x000107b0",func="foo",
args=[{name="a",value="1"],{name="b",value="9"}},
file="recursive2.c",line="14"},
gdb-result-var="$1",return-value="0"
(gdb)

The -exec-interrupt Command

Synopsis

 -exec-interrupt

Asynchronous command. 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 `^done' output. If the user is trying to interrupt a non-running program, an error message will be printed.

GDB Command

The corresponding GDB command is `interrupt'.

Example

(gdb)
111-exec-continue
111^running

(gdb)
222-exec-interrupt
222^done
(gdb)
111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
frame={addr="0x00010140",func="foo",args=[],file="try.c",line="13"}
(gdb)

(gdb)
-exec-interrupt
^error,msg="mi_cmd_exec_interrupt: Inferior not executing."
(gdb)

The -exec-next Command

Synopsis

 -exec-next

Asynchronous command. Resumes execution of the inferior program, stopping when the beginning of the next source line is reached.

GDB Command

The corresponding GDB command is `next'.

Example

-exec-next
^running
(gdb)
*stopped,reason="end-stepping-range",line="8",file="hello.c"
(gdb)

The -exec-next-instruction Command

Synopsis

 -exec-next-instruction

Asynchronous command. 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.

GDB Command

The corresponding GDB command is `nexti'.

Example

(gdb)
-exec-next-instruction
^running

(gdb)
*stopped,reason="end-stepping-range",
addr="0x000100d4",line="5",file="hello.c"
(gdb)

The -exec-return Command

Synopsis

 -exec-return

Makes current function return immediately. Doesn't execute the inferior. Displays the new current frame.

GDB Command

The corresponding GDB command is `return'.

Example

(gdb)
200-break-insert callee4
200^done,bkpt={number="1",addr="0x00010734",
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
(gdb)
000-exec-run
000^running
(gdb)
000*stopped,reason="breakpoint-hit",bkptno="1",
frame={func="callee4",args=[],
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"}
(gdb)
205-break-delete
205^done
(gdb)
111-exec-return
111^done,frame={level="0 ",func="callee3",
args=[{name="strarg",
value="0x11940 \"A string argument.\""}],
file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="18"}
(gdb)

The -exec-run Command

Synopsis

 -exec-run

Asynchronous command. Starts execution of the inferior from the beginning. The inferior executes until either a breakpoint is encountered or the program exits.

GDB Command

The corresponding GDB command is `run'.

Example

(gdb)
-break-insert main
^done,bkpt={number="1",addr="0x0001072c",file="recursive2.c",line="4"}
(gdb)
-exec-run
^running
(gdb)
*stopped,reason="breakpoint-hit",bkptno="1",
frame={func="main",args=[],file="recursive2.c",line="4"}
(gdb)

The -exec-show-arguments Command

Synopsis

 -exec-show-arguments

Print the arguments of the program.

GDB Command

The corresponding GDB command is `show args'.

Example

N.A.

The -exec-step Command

Synopsis

 -exec-step

Asynchronous command. 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.

GDB Command

The corresponding GDB command is `step'.

Example

Stepping into a function:

-exec-step
^running
(gdb)
*stopped,reason="end-stepping-range",
frame={func="foo",args=[{name="a",value="10"},
{name="b",value="0"}],file="recursive2.c",line="11"}
(gdb)

Regular stepping:

-exec-step
^running
(gdb)
*stopped,reason="end-stepping-range",line="14",file="recursive2.c"
(gdb)

The -exec-step-instruction Command

Synopsis

 -exec-step-instruction

Asynchronous command. Resumes the inferior which executes one machine instruction. The output, once GDB 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.

GDB Command

The corresponding GDB command is `stepi'.

Example

(gdb)
-exec-step-instruction
^running

(gdb)
*stopped,reason="end-stepping-range",
frame={func="foo",args=[],file="try.c",line="10"}
(gdb)
-exec-step-instruction
^running

(gdb)
*stopped,reason="end-stepping-range",
frame={addr="0x000100f4",func="foo",args=[],file="try.c",line="10"}
(gdb)

The -exec-until Command

Synopsis

 -exec-until [ location ]

Asynchronous command. Executes the inferior until the location 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 `location-reached'.

GDB Command

The corresponding GDB command is `until'.

Example

(gdb)
-exec-until recursive2.c:6
^running
(gdb)
x = 55
*stopped,reason="location-reached",frame={func="main",args=[],
file="recursive2.c",line="6"}
(gdb)

The -file-exec-and-symbols Command

Synopsis

 -file-exec-and-symbols file

Specify the executable file to be debugged. This file is the one from which the symbol table is also read. If no file is specified, the command clears the executable and symbol information. If breakpoints are set when using this command with no arguments, GDB will produce error messages. Otherwise, no output is produced, except a completion notification.

GDB Command

The corresponding GDB command is `file'.

Example

(gdb)
-file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
^done
(gdb)

The -file-exec-file Command

Synopsis

 -file-exec-file file

Specify the executable file to be debugged. Unlike `-file-exec-and-symbols', the symbol table is not read from this file. If used without argument, GDB clears the information about the executable file. No output is produced, except a completion notification.

GDB Command

The corresponding GDB command is `exec-file'.

Example

(gdb)
-file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
^done
(gdb)

The -file-list-exec-sections Command

Synopsis

 -file-list-exec-sections

List the sections of the current executable file.

GDB Command

The GDB command `info file' shows, among the rest, the same information as this command. gdbtk has a corresponding command `gdb_load_info'.

Example

N.A.

The -file-list-exec-source-files Command

Synopsis

 -file-list-exec-source-files

List the source files for the current executable.

GDB Command

There's no GDB command which directly corresponds to this one. gdbtk has an analogous command `gdb_listfiles'.

Example

N.A.

The -file-list-shared-libraries Command

Synopsis

 -file-list-shared-libraries

List the shared libraries in the program.

GDB Command

The corresponding GDB command is `info shared'.

Example

N.A.

The -file-list-symbol-files Command

Synopsis

 -file-list-symbol-files

List symbol files.

GDB Command

The corresponding GDB command is `info file' (part of it).

Example

N.A.

The -file-symbol-file Command

Synopsis

 -file-symbol-file file

Read symbol table info from the specified file argument. When used without arguments, clears GDB's symbol table info. No output is produced, except for a completion notification.

GDB Command

The corresponding GDB command is `symbol-file'.

Example

(gdb)
-file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx
^done
(gdb)


Go to the first, previous, next, last section, table of contents.