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.
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"
-exec-abort
Command-exec-abort
Kill the inferior running program.
The corresponding GDB command is `kill'.
N.A.
-exec-arguments
Command-exec-arguments args
Set the inferior program arguments, to be used in the next `-exec-run'.
The corresponding GDB command is `set args'.
Don't have one around.
-exec-continue
Command-exec-continue
Asynchronous command. Resumes the execution of the inferior program until a breakpoint is encountered, or until the inferior exits.
The corresponding GDB corresponding is `continue'.
-exec-continue ^running (gdb) @Hello world *stopped,reason="breakpoint-hit",bkptno="2",frame={func="foo",args=[], file="hello.c",line="13"} (gdb)
-exec-finish
Command-exec-finish
Asynchronous command. Resumes the execution of the inferior program until the current function is exited. Displays the results returned by the function.
The corresponding GDB command is `finish'.
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)
-exec-interrupt
Command-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.
The corresponding GDB command is `interrupt'.
(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)
-exec-next
Command-exec-next
Asynchronous command. Resumes execution of the inferior program, stopping when the beginning of the next source line is reached.
The corresponding GDB command is `next'.
-exec-next ^running (gdb) *stopped,reason="end-stepping-range",line="8",file="hello.c" (gdb)
-exec-next-instruction
Command-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.
The corresponding GDB command is `nexti'.
(gdb) -exec-next-instruction ^running (gdb) *stopped,reason="end-stepping-range", addr="0x000100d4",line="5",file="hello.c" (gdb)
-exec-return
Command-exec-return
Makes current function return immediately. Doesn't execute the inferior. Displays the new current frame.
The corresponding GDB command is `return'.
(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)
-exec-run
Command-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.
The corresponding GDB command is `run'.
(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)
-exec-show-arguments
Command-exec-show-arguments
Print the arguments of the program.
The corresponding GDB command is `show args'.
N.A.
-exec-step
Command-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.
The corresponding GDB command is `step'.
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)
-exec-step-instruction
Command-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.
The corresponding GDB command is `stepi'.
(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)
-exec-until
Command-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'.
The corresponding GDB command is `until'.
(gdb) -exec-until recursive2.c:6 ^running (gdb) x = 55 *stopped,reason="location-reached",frame={func="main",args=[], file="recursive2.c",line="6"} (gdb)
-file-exec-and-symbols
Command-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.
The corresponding GDB command is `file'.
(gdb) -file-exec-and-symbols /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx ^done (gdb)
-file-exec-file
Command-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.
The corresponding GDB command is `exec-file'.
(gdb) -file-exec-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx ^done (gdb)
-file-list-exec-sections
Command-file-list-exec-sections
List the sections of the current executable file.
The GDB command `info file' shows, among the rest, the same
information as this command. gdbtk
has a corresponding command
`gdb_load_info'.
N.A.
-file-list-exec-source-files
Command-file-list-exec-source-files
List the source files for the current executable.
There's no GDB command which directly corresponds to this one.
gdbtk
has an analogous command `gdb_listfiles'.
N.A.
-file-list-shared-libraries
Command-file-list-shared-libraries
List the shared libraries in the program.
The corresponding GDB command is `info shared'.
N.A.
-file-list-symbol-files
Command-file-list-symbol-files
List symbol files.
The corresponding GDB command is `info file' (part of it).
N.A.
-file-symbol-file
Command-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.
The corresponding GDB command is `symbol-file'.
(gdb) -file-symbol-file /kwikemart/marge/ezannoni/TRUNK/mbx/hello.mbx ^done (gdb)
Go to the first, previous, next, last section, table of contents.