Debugging a Program With dbx

Customizing dbx in Sun WorkShop

If you use dbx through the Dbx Commands window in Sun WorkShop Debugging as well as from the command line in a shell, you can customize dbx most effectively by taking advantage of the customization features in Sun WorkShop Debugging.

Setting Debugging Options

If you use dbx primarily in the Dbx Commands window in Sun WorkShop Debugging, you can and should set most dbx environment variables using the Debugging Options dialog box (see the Using Sun WorkShop manual and the "Customizing Your Debugging Environment" section in the Sun WorkShop online help).

When you set debugging options using the Debugging Options dialog box, the dbxenv commands for the corresponding environment variables are stored in the Sun WorkShop configuration file .workshoprc. When you start to debug a program in the Sun WorkShop Debugging window, any settings in your .dbxrc file that conflict with those in your .workshoprc take precedence.

Maintaining a Unified Set of Options

If you use dbx both from the command line in a shell and from within Sun WorkShop, you can create a unified set of options that customizes dbx for both modes:

  1. In the Sun WorkShop Debugging window, choose Debug Æ Debugging Options.

  2. Click Save as Defaults to make your current option settings your defaults.

  3. Open your .dbxrc file in an editor window.

  4. Near the top, add the line source $HOME/.workshoprc.

  5. Move the relevant dbxenv commands to a location after the source line, or delete them, or comment them out.

  6. Save the file.

Any changes made through the Debugging Options dialog box are now available to dbx through both Sun WorkShop and when running in a shell.

Maintaining Two Sets of Options

To maintain different options settings for running dbx within Sun WorkShop and from the command line in a shell, you can use the havegui variable in your .dbxrc file to conditionalize your dbxenv commands. For example:


 if $havegui
   then
      dbxenv follow_fork_mode ask
      dbxenv stack_verbose on
   else
       dbxenv follow_fork_mode parent
       dbxenv stack_verbose off

.

Storing Custom Buttons

Sun WorkShop Debugging includes the Button Editor for adding. removing, and editing buttons in the Custom Buttons window. You no longer need to use the button command to store buttons in your .dbxrc file. You cannot add buttons to, or remove buttons from, your .dbxrc file with the Button Editor.

You cannot permanently delete a button stored in your .dbxrc file with the Button Editor. The button will reappear in your next debugging session. You can remove such a button by editing your .dbxrc file.