Using Sun WorkShop

Tracing Code

Tracing collects information about what is happening in your program and displays it in the Dbx Commands window. Program execution does not stop.

An unfiltered trace displays each line of source code as it is about to be executed, which in all but the simplest programs produces volumes of output.

It is more useful to filter a trace 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.

An event is the association of a program event with a debugging action. A typical event is a change in the value of a specified variable. A handler manages debugging events. The trace listing in the Breakpoints window is called a trace handler because it manages the trace, a type of event.

To set up a trace:

  1. In the Breakpoints window, if the Details pane is not displayed, click the Add/Change Breakpoint button.

  2. From the Event list box, choose the type of event you want to trace.

  3. Type any event information, such as the name of a function, or the file name and line number of a location, in the text box.

  4. Choose Action > Trace.

  5. Click Add.


    Note -

    You can control the speed of the trace using the Debugging Behavior category in the Debugging Options dialog box (See the Debugging online help for information on setting debugging options.)