JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: Debugging a Program With dbx     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information


1.  Getting Started With dbx

2.  Starting dbx

3.  Customizing dbx

4.  Viewing and Navigating To Code

5.  Controlling Program Execution

6.  Setting Breakpoints and Traces

Setting Breakpoints

Setting a stop Breakpoint at a Line of Source Code

Setting a stop Breakpoint in a Function

Setting Multiple Breaks in C++ Programs

Setting Breakpoints in Member Functions of Different Classes

Setting Breakpoints in All Member Functions of a Class

Setting Multiple Breakpoints in Nonmember Functions

Setting Breakpoints in Objects

Setting Data Change Breakpoints

Stopping Execution When an Address Is Accessed

Stopping Execution When Variables Change

Stopping Execution on a Condition

Setting Filters on Breakpoints

Using the Return Value of a Function Call as a Filter

Setting Data Change Breakpoints on Local Variables

Using a Filter With a Conditional Event

Tracing Execution

Setting a Trace

Controlling the Speed of a Trace

Directing Trace Output to a File

Setting a when Breakpoint at a Line

Setting Breakpoints in Dynamically Loaded Libraries

Listing and Clearing Breakpoints

Listing Breakpoints and Traces

Deleting Specific Breakpoints Using Handler ID Numbers

Enabling and Disabling Breakpoints

Efficiency Considerations

7.  Using the Call Stack

8.  Evaluating and Displaying Data

9.  Using Runtime Checking

10.  Fixing and Continuing

11.  Debugging Multithreaded Applications

12.  Debugging Child Processes

13.  Debugging OpenMP Programs

14.  Working With Signals

15.  Debugging C++ With dbx

16.  Debugging Fortran Using dbx

17.  Debugging a Java Application With dbx

18.  Debugging at the Machine-Instruction Level

19.  Using dbx With the Korn Shell

20.  Debugging Shared Libraries

A.  Modifying a Program State

B.  Event Management

C.  Macros

D.  Command Reference


Tracing Execution

Tracing collects information about what is happening in your program and displays it. If a program arrives at a breakpoint created with a trace command, the program halts and an event-specific trace information line is emitted, then the program continues.

A trace displays each line of source code as it is about to be executed. In all but the simplest programs, this trace produces volumes of output.

A more useful trace applies a filter to display information about events in your program. For example, you can trace each call to a function, every member function of a given name, every function in a class, or each exit from a function. You can also trace changes to a variable.

Setting a Trace

Set a trace by typing a trace command at the command line. The basic syntax of the trace command is:

trace event-specification [ modifier ]

For the complete syntax of the trace command, see trace Command.

The information a trace provides depends on the type of event associated with it (see Setting Event Specifications).

Controlling the Speed of a Trace

Often trace output goes by too quickly. The dbx environment variable trace_speed lets you control the delay after each trace is printed. The default delay is 0.5 seconds.

To set the interval in seconds between execution of each line of code during a trace, type:

dbxenv trace_speed number

Directing Trace Output to a File

You can direct the output of a trace to a file using the -file filename option. For example, the following command direct trace output to the file trace1:

(dbx) trace -file trace1

To revert trace output to standard output use - for filename. Trace output is always appended to filename. It is flushed whenever dbx prompts and when the application has exited. The filename is always re-opened on a new run or resumption after an attach.