In This Book

Setting Traces

Traces are useful for monitoring the ￿ow of a program. After setting a trace, for example, you can see when a particular function is called or when certain statements are executed.

By default, setting a trace will display every statement, as it is executed, in the debugger output area. However, you can also set traces that stop execution or that execute debugger commands.

Several levels of trace granularity are available:

At every procedure entry

At every procedure exit

At the entry and exit of every procedure

Every statement

Every assembly instruction

Traces can also be restricted to certain blocks. The debugger allows you to narrow traces to a particular ￿le, C function or C++ object. See Chapter 7 for an explanation of blocks.

Traces on procedure entry or exit can take a signi￿cant amount of time for the debugger to execute. Eliminating entry/exit granularity causes the debugger to run faster, but target program execution may be much slower.

3-14 Using Monitors (Breakpoints, Watchpoints, Traces, and Intercepts)