After you have loaded a program, you can create a process executing this program using either of the following forms of the run command:
run_command
: run [ argument_string ] [ io_redirection ... ]
| rerun [ argument_string ] [ io_redirection ... ]
If the rerun command is specified without arguments, the arguments and io_redirection arguments of the most recent run command entered with arguments are used. If there was no previous run command, the rerun command defaults to run.
run_command
: run [ argument_string ] [ io_redirection ... ]
| r [ argument_string ] [ io_redirection ... ]
arg_commands
: set_args_command
| show_args_command
set_args_command
: set args [ argument_string ] [ io_redirection ... ]
show_args_command
: show args
If the run (or r) command does not specify any arguments, default arguments are used. Default arguments are specified by the previous run command with arguments or by set args command. To view default arguments, use the show args command.
The set args commands does not affect process currently running. New arguments will affect only the next run.
If the last modification time or size of the binary file or any of the shared objects used by the binary file has changed since the last run or rerun (dbx) command was issued, the debugger automatically rereads the symbol table information. If this happens, the old breakpoint settings may no longer be valid after the new symbol table information is read.
The argument_string provides both the argc and argv for the created process in the same way a shell does.
The debugger breaks up the argument_string into words, and supports several shell features, including tilde (~) and environment variable expansion, wildcard substitution, single quote ('), double quote ("), and single character quote (\).
The io_redirection argument allows you to change stdin, stdout, and stderr, which are otherwise inherited from the debugger process:
io_redirection
The various forms have the same effect as in the csh(1) shell.
Although the grammar currently allows more than the following forms of redirection, you should only use the following forms because the grammar may change in a future release of the debugger.
> filename Redirect stdout
1> filename Redirect stdout
2> filename Redirect stderr
>& filename Redirect stdout and stderr
1> filename 2> filename Redirect stdout and stderr to different files
Examples:
(idb) stop at 182
[#1: stop at "src/x_list.cxx":182]
(idb) run -s > prog.output
[1] stopped at [int main(void):182 0x08052e0f]
182 List<Node> nodeList;
(idb) break main
Breakpoint 1 at 0x8052e0f: file src/x_list.cxx, line 182.
(idb) show args
Argument list to give program being debugged when it is started is "".
(idb) run
Starting program: /home/user/examples/x_list
Breakpoint 1, main () at src/x_list.cxx:182
182 List<Node> nodeList;
(idb) continue
Continuing.
The list is:
Node 1 type is integer, value is 1
Node 2 type is compound, value is 12.345
parent type is integer, value is 2
Node 3 type is compound, value is 3.1415
parent type is integer, value is 7
Node 4 type is integer, value is 3
Node 5 type is integer, value is 4
Node 6 type is compound, value is 10.123
parent type is integer, value is 5
Destroying nodes...
All nodes destroyed
Program exited normally.
(idb) set args -s > prog.output
(idb) show args
Argument list to give program being debugged when it is started is "-s > prog.output".
(idb) run
Starting program: /home/user/examples/x_list
Breakpoint 1, main () at src/x_list.cxx:182
182 List<Node> nodeList;