Chapter 12. Customizing the Debugger

This section shows you how you may customize the WorkShop Debugger specifically to your environment needs.

Customizing the Debugger with Scripts

If there are Debugger commands or combinations of Debugger commands that you use frequently, you may find it convenient to create a script composed of Debugger commands. Debugger scripts are ASCII files containing one Debugger command and its arguments per line. A Debugger script can in turn call other Debugger scripts. There are three general methods for running scripts:

  • Enter the source command and the filename at the Debugger command line. This is useful for scripts that you need only occasionally.

  • Include the script in a startup file. This is useful for scripts that you want implemented every time you use the Debugger.

  • Define a button in the graphical interface to run the script. Use this method for scripts you use frequently but apply only at specific times during a debugging session.

Using a Startup File

A startup file lets you preload your favorite buttons and aliases in a file that runs when the Debugger is invoked. It also is useful if you have traps that you set the same way each time. The suggested name for the startup file is .cvdrc. However, you can select a different name as long as you specify its path in the CVDINIT environment variable. The Debugger uses the following criteria when looking for a startup file:

  • Checks the CVDINIT environment variable.

  • Check for a .cvdrc file in the current directory.

  • Checks for a .cvdrc file in the user's home directory.

Implementing User-Defined Buttons

You can implement buttons by providing a special Debugger startup file or by creating them on the fly within a debugging session. Buttons appear in the order of implementation in a row at the bottom of the control panel area. Currently, you can define only one row of custom buttons. The definitions for the user-defined buttons display in the Debugger command line area.

The syntax for creating a button is as follows:

button label command [$sel]

The syntax for creating a multiple-command button is as follows:

button label {command1 [$sel]; command2 [$sel]; ...}

The button command accepts the following options:

  • label: specifies the button name. Button labels should be kept short since there is only room for a single row of buttons. There can be no spaces in a label.

  • command: specifies one of the Debugger commands, which are entered at the command line at the bottom of the Main View window. See the ProDev WorkShop: Debugger Reference Manual.

  • $sel: provides a substitute for the current cursor selection and should be appropriate as an argument to the selected command.

  • commandn...: specifies Debugger commands to be applied in order. Commands must be separated by semicolons (;) and enclosed by braces ({}). The multiple-command button is a powerful feature; it lets you write a short script to be executed when you click the button.

The following command displays a list of all currently defined buttons:

% button   

The following command deletes the button corresponding to the label:

% unbutton label

You might use this command if you needed room to create a new button. The effect of unbutton is temporary so that subsequently running the startup file reactivates the button.

The following command displays the definition of the specified button, if it exists. If the button does not exist, an error message is displayed:

% button label

Changing X Window System Resources

While there are many X Window System resources that you can change, we recommend that you avoid modifying these resources if at all possible. In some cases, there may be no way within WorkShop to make the desired change. If you must modify resources, the following X Window System resources for the Debugger and its views may be useful:

*AllowPendingTraps:
 

If set to true, enables support for pending traps.

The default value is false.

*autoStringFormat
 

If set to true, sets default format for *char results as strings in Expression View, the Variable Browser, and the Data Explorer.

The default format is the hexadecimal address.

cvmain*sourceView*nameText.columns
 

Sets the length of the File field in the Main View window.

The default value is 30 characters.

Cvmain*disableLicenseWarnings and *disableLicenseWarnings
 

Disables the license warning message that displays when you start the Debugger and the other tools.

*editorCommand
 

If you prefer to view source code in a text editor rather than in Source View, lets you specify a text editor.

The default value is the vi editor.

*expressionView*maxNumOfExpr
 

Lets you set the maximum number of expressions that can be read from a file by Expression View.

The default value is 25.

*UseOldExprEval and *useOldExprEval
 

When set to true, allows you to use the older, dbx-like, expression evaluator rather than the default C++ expression evaluator introduced in WorkShop version 2.6.4. Using the older evaluator may result in faster evaluation of some expressions.

The default value is false.

The following resources apply to Source View:

*svComponent*lineNumbersVisible
 

Displays source line numbers by default.

*sourceView*nameText.columns
 

Sets the length of the File field in Source View.

The default value is 30 characters.

*tabWidth
 

Sets the number of spaces for tabs in Source View.

The following resource applies to Build View:

*buildCommand
 

Is used to determine which program to used with make(1), smake(1), clearmake(1), and so forth.

The default value is make(1).

*runBuild
 

Specifies whether cvmake(1) begins its build immediately upon being launched.

The default value is true.

To change these resources, you need to set the desired value in your .Xdefaults file, and run the xrdb(1) command. Then, restart your application so that the resource gets picked up.

The following are the default font and scrollbar sizes for cvd:

cvarray*fontList: 6x13
cvdata*fontList: 6x13
cvstruct*fontList: 6x13
cvmachine*fontList: 6x13
cvmeter*fontList: 6x13
cvtaskview*fontList: 6x13
cvtaskview*boldLabelFont: 6x13
cvmp*fontList: 6x13
cvmain*fontList: 6x13
cvmotif*fontList: 6x13
cvstatic*fontList: 6x13
cvbuild*fontList: 6x13
cvpav*fontList: 6x13
cvperf*fontList: 6x13
cvxcov*fontList: 6x13
cvmake*fontList: 6x13
cvpathRemap*fontList: 6x13
*cvdHorizontalScrollBarSize: 25
*cvdVerticalScrollBarSize: 25

DUMPCORE Environment Variable

The DUMPCORE environment variable allows the Debugger to dump a core file in the event that there is a debugger execution problem during the debug session. To enable core files, enter either of the following before you startup your debug session:

  • For the C shell, enter:

    % setenv DUMPCORE 1

  • For the Korn shell or Bourne shell, enter:

    $ DUMPCORE=;export DUMPCORE = 1

Other Variables

The user can set the following variables for the Debugger:

  • set $prompt: specifies the prompt to be used in the command window.

  • set $addrfmt: specifies the format for addresses.

  • set $dbxEval: forces the command window to use the dbx evaluator for Fortran and C/C++.

  • set $dbxFortranEval: forces the command window to use the older, dbx-like evaluator.

  • set $dbxCEval: forces the cmmand window to use the dbx evaluator.

  • set $pendingtraps: set to true, allows pending traps.

  • set $sprocmode: set to true, toggles several settings suggested for debugging sproc programs.

To see complete syntax for these variables, issue the following command at the cvd command line:

cvd> help $variables