
Running Your Program Under GDB
Motorola
GNU Debugger (GDB)
For More Information On This Product,
Go to: www.freescale.com
D-13
The
arguments
.
You specify the arguments to give the program as the arguments of the ‘run’
command.
The
environment
.
The program normally inherits its environment from GDB, but you can use the
GDB commands ‘set environment’ and ‘unset environment’ to change parts of the
environment that will be given to the program.
The
working directory
.
The program inherits its working directory from GDB. You can set GDB’s working
directory with the ‘cd’ command in GDB.
After the ‘run’ command, the debugger does nothing but wait for your program to
stop. See section Stopping.
Note that once your program has been started by the ‘run’ command, you may
evaluate expressions that involve calls to functions in the inferior. See section
Expressions. If you wish to evaluate a function simply for its side affects, you may
use the ‘set’ command. See section Assignment.
D.5.1 Your Program’s Arguments
The arguments to your program are specified by the arguments of the ‘run’ command.
They are passed to a shell, which expands wildcard characters and performs redirection of
I/O, and thence to the program.
‘run’ with no arguments uses the same arguments used by the previous ‘run’.
The command ‘set args’ can be used to specify the arguments to be used the next time the
program is run. If ‘set args’ has no arguments, it means to use no arguments the next time
the program is run. If you have run your program with arguments and want to run it again
with no arguments, this is the only way to do so.
D.5.2 Your Program’s Environment
The environment consists of a set of environment variables and their values. Environment
variables conventionally record such things as your user name, your home directory, your
terminal type, and your search path for programs to run. Usually you set up environment
variables with the shell and they are inherited by all the other programs you run. When
debugging, it can be useful to try running the program with different environments
without having to start the debugger over again.
F
Freescale Semiconductor, Inc.
n
.