• Aucun résultat trouvé

The Trace Function

Dans le document HP B1472 68000/302 Debugger/Emulator (Page 190-195)

The trace function uses the emulation analyzer in your emulator to capture processor bus cycle information synchronously with the processor’s clock signal.

A trace is a collection of these captured states.

You can make simple trace measurements using the Code window pop-up menu.

Using this menu, you can trace states before and after a line of code is executed.

If you need to make a simple trace measurement, skip the details which follow and turn to "To start a trace using the Code pop-up menu."

You can make complex trace measurements using the command line Trace command. You can tell the debugger exactly which states to store by defining trigger events (a series of events which will start the trace) and storage qualifications (which kinds of states to store).

If you will be making many detailed trace measurements, you may find it easier to use the emulator/analyzer user interface.

Trace Events

Trace measurement parameters are specified as events. An event is a bus state consisting of a combination of address, data, and status values.

Address and Data Values. Address and data values may be specified as 32-bit values or a range of of 32-bit values. You can specify a mask to mark valid bits in addresses or data to define "don’t care" values. You can also specify the logical

"NOT" of an address or data value.

Status Values. Status values are the types of bus activities, such as:

Read or write operations.

Memory access size.

Function codes.

Cycle types.

You can also specify the logical "NOT" of a status value.

Trace Trigger

A trigger specifies the bus events that cause the debugger to make a trace

measurement. The debugger lets you trigger on the detection of a single event, an OR’ed combination of events, or after a sequence of events are detected. You can specify a sequence of events, the last of which is the triggering event. You can also trigger on the Nth occurrence of an event, where N is a number you specify with the count parameter in the Trace Trigger Event command.

You can position the trigger event at the start of the trace buffer, centered in the trace buffer, or at the end of the trace buffer.

Storage Qualification

A storage qualifier defines which bus cycles will be stored when you make a trace measurement. You can specify that only cycles corresponding to certain values be stored in the trace buffer. These values can be addresses, a range of addresses, data values, status values (the type of bus activity), or an OR’ed combination of values.

Trace Resources

The trace function uses the emulation analyzer to implement its measurements.

The analyzer puts the following limitations on resources available for trace specifications:

One range resource.

Eight event resources.

Seven sequence terms.

If you enter a range value that can be expressed as a "don’t care" value (for example, address 0x100 to 0x1ff), the debugger uses one of the eight event resources, rather than the range resource. Complex event specifications, such as combinations of Is and Not terms, can use multiple event resources. Up to seven sequential events can be specified in a trigger specification.

Trace Status

The status of the trace measurement is indicated on the debugger status line by the TRC:<Trc_status> field. The possible values for <Trc_status> are:

AwtTrg A trace measurement is in progress, but the trigger condition has not been detected.

BrkRWA An access breakpoint has been set and will be used as the trigger in the next trace measurement.

Cmplt A trace measurement has completed.

DataOK The trace buffer contains valid data.

Trgrd A trace measurement is in progress, and the trigger has been detected.

Trace status characters

When trace data is displayed, a trace status character may be displayed in front of the trace line. The following table defines the trace status characters.

Trace List Status Characters Character Description

* The indicated trace line is the trigger condition.

+ The indicated trace line is in the middle of a C statement, that is, not the first assembly language statement in the C source statement.

! The data in the trace buffer line does not match the data in memory.

? The trace line may be a prefetch.

Access Breakpoints

If you have set access breakpoints with the Breakpt Access, Breakpt Read, or Breakpt Write commands, the trace function will interpret the breakpoints as trace trigger terms. When you step or run your program after setting an access

breakpoint, the trace measurement is started automatically. You cannot define a trace trigger while an access breakpoint is active. This will cause an error condition.

Note The emulator user interface may specify a trace that overrides a debugger access breakpoint. The debugger interface will set up the access breakpoint trace when a run or step command is issued only if the analyzer is not currently in use. Using both access breakpoints in the debugger and trace features in the emulator is not recommended.

Limitations to the Trace Function

There are limitations to the trace function imposed on the debugger by the use of a foreground monitor and when triggering on C variables and instruction fetches.

Limitations when Using a Foreground Monitor. When you use a

foreground monitor, the trace function may capture monitor activity as well as your target program activity.

Limitations when Triggering on C Variables. The emulator’s analysis hardware watches bus cycles, and triggers on specified bus values. However, bus cycles do not always map directly to C variables. This limitation takes two forms.

The first form occurs when an access to a C variable requires multiple bus cycles.

To illustrate this problem, consider a 32-bit variable foo. A C statement that sets the value of foo requires two bus cycles for a 16-bit data bus. If foo is at address 0x1000, the statement:

foo = 0x100

will result in a write of value 0 to address 0x1000 and value 0x100 to address 0x1002. To trigger on a write of 0x100 to foo requires that you trigger on a write of value 0 to address 0x1000 and then value 0x100 to address 0x1002. You must be aware of your data bus configuration and date organization when specifying triggers containing both address and data values.

The second form of problem occurs when a C variable is written, but the address never appears on the bus. To demonstrate this problem, consider a 32-bit C variable foo at address 0x1002 and a "wild pointer" pointing to address

0x1004. A write indirect through the pointer will overwrite part of variable foo, but the address of foo (0x1002) will never appear on the address bus. This limitation can be overcome by specifying an address range when triggering on a symbol that you suspect is being modified by a wild pointer. For example, specify To start a trace using the Code pop-up menu

2 Hold down the right mouse button and select one of the Trace items from the Code window pop-up menu.

3 When "TRC:Cmplt" appears on the status line, stop execution of the program if it is not already halted.

4 Select Window→Trace to see the trace information.

5 Use the keyboard arrow keys or the scroll bar to scroll through the trace information. Press <ESC> <ESC> to exit trace mode.

This will trace the execution of code near the line you selected.

You can choose any one of the following:

Trace after will trace what happens after the selected line is executed.

Trace before will trace what happens before the selected line is executed.

Trace about will trace what happens before and after the selected line is executed.

Trace until will trace what happens before the selected line is executed.

When the selected line is reached, execution is stopped automatically.

Dans le document HP B1472 68000/302 Debugger/Emulator (Page 190-195)

Documents relatifs