set args
show args

program. See “Program Input and Output” (page 43).

WARNING! You can redirect input and output, but you cannot use pipes to pass the output of the program you are debugging to another program; if you attempt this, GDB is likely to wind up debugging the wrong program.

NOTE:

When you issue the run command, your program begins to execute immediately. See Chapter 5 (page 51), for discussion of how to arrange for your program to stop. Once your program has stopped, you may call functions in your program, using the print or call commands. See Chapter 8 (page 83).

If the modification time of your symbol file has changed since the last time GDB read its symbols, GDB discards its symbol table, and reads it again. When it does this, GDB tries to retain your current breakpoints.

4.3Arguments To Your Program

The arguments to your program can be specified by the arguments of the run command. On HP-UX, they are passed to the C shell (/usr/bin/csh), which expands wildcard characters and performs redirection of I/O, and then to your program.

On non-Unix systems, the program is usually invoked directly by GDB, which emulates I/O redirection via the appropriate system calls, and the wildcard characters are expanded by the startup code of the program, not by the shell.

The run command used with no arguments uses the same arguments used by the previous run, or those set by the set args command.

Following commands are used to pass the argument values to your program:

Specify the arguments to be used the next time your program is run. If set args has no arguments, run executes your program with no arguments. Once you have run your program with arguments, using set args before the next run is the only way to run it again without arguments.

Show the arguments to give your program when it is started.

4.4 Program Environment

The environment consists of a set of environment variables and their values. Environment variables conventionally record information such 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

4.3 Arguments To Your Program 41

Page 41
Image 41
HP gnu source-level debugger 5992-4701 manual Arguments To Your Program, Program Environment