### 27.10 gdb/mi Program Context

#### 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

         (gdb)
         -exec-arguments -v word
         ^done
         (gdb)

#### The `-environment-cd` Command

##### Synopsis

          -environment-cd pathdir

Set gdb's working directory.

##### gdb Command

The corresponding gdb command is ‘`cd`’.

##### Example

         (gdb)
         -environment-cd /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
         ^done
         (gdb)

#### The `-environment-directory` Command

##### Synopsis

          -environment-directory [ -r ] [ pathdir ]+

Add directories pathdir to beginning of search path for source files. If the ‘`-r`’ option is used, the search path is reset to the default search path. If directories pathdir are supplied in addition to the ‘`-r`’ option, the search path is first reset and then addition occurs as normal. Multiple directories may be specified, separated by blanks. Specifying multiple directories in a single command results in the directories added to the beginning of the search path in the same order they were presented in the command. If blanks are needed as part of a directory name, double-quotes should be used around the name. In the command output, the path will show up separated by the system directory-separator character. The directory-separator character must not be used in any directory name. If no directories are specified, the current search path is displayed.

##### gdb Command

The corresponding gdb command is ‘`dir`’.

##### Example

         (gdb)
         -environment-directory /kwikemart/marge/ezannoni/flathead-dev/devo/gdb
         ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
         (gdb)
         -environment-directory ""
         ^done,source-path="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb:$cdir:$cwd"
         (gdb)
         -environment-directory -r /home/jjohnstn/src/gdb /usr/src
         ^done,source-path="/home/jjohnstn/src/gdb:/usr/src:$cdir:$cwd"
         (gdb)
         -environment-directory -r
         ^done,source-path="$cdir:$cwd"
         (gdb)

#### The `-environment-path` Command

##### Synopsis

          -environment-path [ -r ] [ pathdir ]+

Add directories pathdir to beginning of search path for object files. If the ‘`-r`’ option is used, the search path is reset to the original search path that existed at gdb start-up. If directories pathdir are supplied in addition to the ‘`-r`’ option, the search path is first reset and then addition occurs as normal. Multiple directories may be specified, separated by blanks. Specifying multiple directories in a single command results in the directories added to the beginning of the search path in the same order they were presented in the command. If blanks are needed as part of a directory name, double-quotes should be used around the name. In the command output, the path will show up separated by the system directory-separator character. The directory-separator character must not be used in any directory name. If no directories are specified, the current path is displayed.

##### gdb Command

The corresponding gdb command is ‘`path`’.

##### Example

         (gdb)
         -environment-path
         ^done,path="/usr/bin"
         (gdb)
         -environment-path /kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb /bin
         ^done,path="/kwikemart/marge/ezannoni/flathead-dev/ppc-eabi/gdb:/bin:/usr/bin"
         (gdb)
         -environment-path -r /usr/local/bin
         ^done,path="/usr/local/bin:/usr/bin"
         (gdb)

#### The `-environment-pwd` Command

##### Synopsis

          -environment-pwd

Show the current working directory.

##### gdb Command

The corresponding gdb command is ‘`pwd`’.

##### Example

         (gdb)
         -environment-pwd
         ^done,cwd="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb"
         (gdb)