Oracle® Solaris Studio 12.4: dbxtool Tutorial

Exit Print View

Updated: October 2014

Example Program

This tutorial uses a simplified and somewhat artificial simulation of the dbx debugger. The source code for this C++ program is available in the sample applications zip file on the Oracle Solaris Studio 12.4 downloads web page at

After accepting the license and downloading, you can extract the zip file in a directory of your choice.

  1. If you have not already done so, download the sample applications zip file, and unpack the file in a location of your choice. The debug_tutorial application is located in the Debugger subdirectory of the SolarisStudioSampleApplications directory.

  2. Build the program.

    $ make
    CC -g   -c
    CC -g   -c
    CC -g   -c
    CC -g   -c
    CC -g   -c
    CC -g   main.o interp.o cmd.o debugger.o cmds.o -o a.out

The program is made up of the following modules:

Class Cmd, a base for implementing debugger commands
Class Interp, a simple command interpreter
Class Debugger, mimics the main semantics of a debugger
Implementations of various debugging commands
The main() function and error handling. Sets up an Interp, creates various commands and assigns them to the Interp. Runs the Interp.

Run the program and try a few dbx commands.

$ a.out
> display var
will display 'var'
> stop in X
> run running ...
stopped in X
var = {
        a = '100'
        b = '101'
        c = '<error>'
        d = '102'
        e = '103'
        f = '104'
> quit