Using Sun WorkShop

Changing Run Parameters

You can change run parameters such as arguments, the run directory, and environment variables during a debugging session.

Specifying Program Arguments

You can specify program arguments when you load your program for debugging, and edit them at any time once your program is loaded.

When you enter arguments in the text box that contain characters that have special meaning to the shell, make sure you set them off with either a backslash (\) or quotes (" "). The special characters are | & ; < > ( ) $ ` \ " ' * ? [ ] Space Tab Newline.

To specify program arguments when loading a program, type the arguments in the Arguments text box of the Debug New Program dialog box as if you were typing them on the command line. Do not include the program name.

To edit program arguments once a program is loaded:

  1. Choose Debug > Edit Run Parameters to open the Edit Run Parameters dialog box.

  2. Add or change arguments in the Arguments text box.

  3. Click OK.

Specifying a Run Directory

You can specify a run directory when loading your program for debugging and change the run directory at any time once a program is loaded. When your program is loaded, the directory you selected as the run directory is made the current working directory of the debugger.

To specify a run directory when loading a program:

  1. Type the directory name in the Run Directory text box or click the browse button to display the Run Directory dialog box, in which you can select the directory name.

  2. Click OK.

To change the run directory once a program is loaded:

  1. Choose Debug > Edit Run Parameters to open the Edit Run Parameters dialog box.

  2. Type the directory name in the Run Directory text box or click the browse button to display the Run Directory dialog box, in which you can select the directory name.

  3. Click OK.

Setting Environment Variables

You can specify the environment variables that are in effect when the program runs. When you run the program, setenv commands for these environment variables are prepended to the run command.

Using the Environment Variables dialog box, you can add or delete environment variables to the Persistent Environment Variables list. All environment variables in the Persistent Environment Variables list are saved with your WorkSet.


Note -

The Persistent Environment Variables list for running your program is not the same as the Persistent Environment Variables list for building your program described in "Using Environment Variables".


To open the Environment Variables dialog box:

Adding An Environment Variable

To add an environment variable to the Persistent Environment Variables list:

  1. Type the name of an environment variable in the Name text box.

  2. Type a value for the variable in the Value text box.

    If you make a mistake, click Clear to remove entries in the Name and Value text boxes.

  3. Click Add to add the environment variable to the Persistent Environment Variables list.

  4. Repeat the previous three steps to add other environment variables.

  5. Click OK to close the dialog box.


    Note -

    Pressing the Return key after each step move the input focus to the next step.


Deleting an Environment Variable

To delete a variable from the Persistent Environment Variables list:

  1. Select a variable from the list.

  2. Click Delete (Delete All removes all environment variables in the list).

  3. Click OK to establish the change and close the dialog box.

Changing the Value of an Environment Variable

To change the value of an environment variable in the Persistent Environment Variables list:

  1. Select an environment variable in the list.

  2. Type a new value in the Value text box and click Change.

  3. Click OK to establish the change and close the dialog box.

Reviewing and Overriding Environment Variables

An environment variable definition that appears in the Persistent Environment Variables list overrides any environment variable with the same name that appears in the current debugging environment.

To review the current debugging environment variable definitions, click More to open the Current Environment list, which includes all the environment variables in the debugging environment for your program. You can filter the list using the Filter text box.

To override the value of an environment variable:

  1. Select an environment variable in the Current Environment list.

  2. Click <<Add to add the environment variable to the Persistent Environment Variables list.

  3. Type a new value in the Value text box and click Change.

  4. Click OK to establish the change and close the dialog box.

    The environment variable definition in the Persistent Environment Variables list overrides the environment variable definition in the current debugging environment, and is saved with your WorkSet.


Note -

To delete a variable and unset its value, you can use the dbx command unset variable.