8.5.4. Solution using the state machine

This solution to the example is based on tracing the instructions that are executed between entry to and exit from the MonitorRequests function. This includes any interrupt handler code as well as functions that MonitorRequests calls.

Note

If you are using ETM hardware implementing ETM version 1.2, it is quicker to configure start/stop points for this task. However, you can still use the state machine for this or other solutions.

This solution requires you to perform the following procedures:

Loading the debugger

In this procedure, you initialize the target and load the debugger with the debug information for the program. Follow these steps:

  1. Load the program symbols into the debugger:

    • If the program is not already running, select Load Image from the File menu to load the executable for which you want to gather trace information.

    • If the program is already running, or loads or runs from ROM, select Load symbols only… from the File menu.

    Note

    After you load an image into AXD, you might have to change the top_of_memory variable value to correspond to the top-of-memory address of your target hardware (see the Debugger Internals window section in the AXD and armsd Debuggers Guide).

  2. Set the overall configuration of the ETM hardware by selecting Configure ETM from the Trace menu. The options configured in this dialog box apply to any subsequent tracing you perform (see Configure ETM).

Setting up the function entry state change trace capture rule

In this procedure you set up the trace capture rules that define the data that is displayed in the Trace window. Follow these steps:

  1. Set the tracing conditions by selecting Configure Capture from the Trace menu. The Configure capture dialog box is shown in Figure 8.35.

    Figure 8.35. Configure capture dialog box

    Configure capture dialog box
  2. Double-click Go from State 1 to 2 in the Actions list to define a rule. The Go from State 1 to 2 Resource selection dialog box shown in Figure 8.36 is displayed.

    Figure 8.36. Resource selection for Go from State 1 to 2

    Resource selection for Go from State 1 to 2
  3. Click on the drop-down list showing TRUE and select Address Point.

  4. Click on Next>. The Include Address Point dialog box shown in Figure 8.37 is displayed.

    Figure 8.37. Include Address Point dialog box

    Include Address Point dialog box
  5. In the Address field, enter %MonitorRequests.

  6. Click Next> to display the end of rule dialog box.

  7. Click Finish to create this rule. The Configure capture dialog box is updated as shown in Figure 8.38.

    Figure 8.38. Configure capture dialog box

    Configure capture dialog box

Setting up the function exit state change trace capture rule

In this procedure you set up the trace capture rules that define the data that is displayed in the Trace window. Follow these steps:

  1. Double-click Go from State 2 to 1 in the Actions list to define a rule. The Go from State 2 to 1 Resource selection dialog box shown in Figure 8.39 is displayed.

    Figure 8.39. Resource selection for Enable Tracing

    Resource selection for Enable Tracing
  2. Click on the drop-down list showing TRUE and select Address Point.

  3. Click on Next>. The Include Address Point dialog box shown in Figure 8.40 is displayed.

    Figure 8.40. Include Address Point dialog box

    Include Address Point dialog box
  4. In the Address field, enter %MonitorRequests:437, where 437 is the line number of the function return code.

  5. Click Next> to display the end of rule dialog box.

  6. Click Finish to create this rule. The Configure capture dialog box is updated as shown in Figure 8.41.

    Figure 8.41. Configure capture dialog box

    Configure capture dialog box

Setting up the Enable Tracing trace capture rule

In this procedure you set up the trace capture rules that define the data that is displayed in the Trace window. Follow these steps:

  1. Double-click Enable Tracing in the Actions list to define a rule. The Enable Tracing Resource selection dialog box shown in Figure 8.42 is displayed.

    Figure 8.42. Resource selection for Enable Tracing

    Resource selection for Enable Tracing
  2. Click on the drop-down list showing TRUE and select In State 2.

  3. Click Next> to display the end of rule dialog box.

  4. Click Finish to create this rule. The Configure capture dialog box is updated as shown in Figure 8.43.

    Figure 8.43. Configure capture dialog box

    Configure capture dialog box

Setting up the Trigger trace capture rule

In this procedure you set up the trigger rule that defines the data that is displayed in the Trace window. Follow these steps:

  1. Double-click Trigger in the Actions list to define a rule. The Trigger Resource selection dialog box shown in Figure 8.44 is displayed.

    Figure 8.44. Resource selection for Trigger

    Resource selection for Trigger
  2. Click on the drop-down list showing TRUE and select Address Point.

  3. Move the Trigger Position slider to the End of buffer position.

    Setting up the trigger in this way causes the trace buffer to match on an address, which we will define next, and contain all the trace information up to the point the trigger matches.

  4. Click on Next>. The Address Point dialog box shown in Figure 8.45 is displayed.

    Figure 8.45. Include Address Point dialog box

    Include Address Point dialog box
  5. In the Address field, enter %MonitorRequests:437 , where 437 is the line number of the end of the function.

  6. Click Next> to display the end of rule dialog box.

  7. Click Finish to complete the rule. The Configure capture dialog box shown in Figure 8.46 now has four rules in the Rules list.

    Figure 8.46. Completed Capture dialog box

    Completed Capture dialog box
  8. Click on OK to activate the rules.

Tracing the target

To trace the target:

  1. A dialog box is displayed asking if you want to Start tracing now?. Click on Yes. TDT writes the trace rules and the ETM configuration to the ETM hardware, and instructs the ETM to start collecting trace data based on these values

  2. Click View Trace on the Trace menu. The trace output window appears.

  3. If your program is not already running, select Go from the Execute menu. During execution, trace information is returned to the Trace window.

Analyzing the trace data

To analyze the trace data:

  1. You can now:

  2. By examining the trace output you can try to determine what is happening.

Copyright © 2000-2002 ARM Limited. All rights reserved.ARM DUI 0118C
Non-Confidential