Sun Studio 12: Debugging a Program With dbx

Using the dbx Initialization File

The dbx initialization file stores dbx commands that are executed each time you start dbx. Typically, the file contains commands that customize your debugging environment, but you can place any dbx commands in the file. If you customize dbx from the command line while you are debugging, those settings apply only to the current debugging session.


Note –

A . dbxrc file should not contain commands that execute your code. However, you can put such commands in a file, and then use the dbx source command to execute the commands in that file.


During startup, the search order is:

  1. Installation directory (unless you specify the -S option to the dbx command) /installation_directory/lib/dbxrc (the default installation_directory is /opt/SUNWspro on Solaris platforms and /opt/sun/sunstudio12 on Linux platform). If your Sun Studio software is not installed in the default installation_directory, dbx derives the path to the dbxrc file from the path to the dbx executable.

  2. Current directory ./.dbxrc

  3. Home directory $HOME/.dbxrc

Creating a .dbxrc File

To create a .dbxrc file that contains common customizations and aliases, type:


(dbx) help .dbxrc>$HOME/.dbxrc

You can then customize the resulting file by using your text editor to uncomment the entries you want to have executed.

Initialization File Sample

Here is a sample .dbxrc file:


dbxenv input_case_sensitive false
catch FPE

The first line changes the default setting for the case sensitivity control:

The next line is a debugging command, catch, which adds a system signal, FPE, to the default list of signals to which dbx responds, stopping the program.