Trace From Trigger A to Trigger B

To set trigger A and trigger B in the editor area in the Continuous mode:

  1. In the CodeWarrior Projects view, select the Sources folder of your project.
  2. Double-click the source file, for example, main.c to display its contents in the editor area. Replace the source code of the main.c file with the source code shown in Listing: Source code for trace collection.
  3. Save and build the project.
  4. Open the Debug Configurations dialog box, and select your project in the tree structure.
  5. Click the Trace and Profile tab, and check the Enable Trace and Profile checkbox.
  6. Click Apply to save the settings, and close the Debug Configurations dialog box.
  7. In the editor area, select the statement f();.
  8. Right-click the marker bar, select the Trace Triggers > Toggle Trace Trigger A option from the context menu.
  9. Right-click the marker bar corresponding to the statement, f2();, and select Trace Triggers > Toggle Trace Trigger B from the context menu.

    The trigger B icon appears on the marker bar in red color as shown in figure below. .

    Note: It is recommended to set both triggers in the same function so that the trace that is collected is meaningful.
    Figure 1. Setting Triggers A and B
    Setting Triggers A and B
    Note: The mouse pointer over a trigger icon in the marker bar displays the attributes of the trigger on that line. For source lines, there can be multiple tracepoints mapping to the same line.
  10. Open the Debug Configurations dialog box, and click the Trace and Profile tab.
  11. Select the Continuous option from the Select Trace Mode group.
  12. Select the Trace from Trigger A to Trigger B option from the Trace Start/Stop Conditions drop-down list.
  13. Click Apply to save the settings.
  14. Click Debug to debug the application.
  15. Click Resume to collect the trace data.
  16. Click Suspend to stop the target application.
  17. Open the Trace Data viewer following the steps explained in the topic Viewing Data to view the trace results.

    The figure below shows the data files and the timeline graph that is generated by the application in which the data has been collected after setting triggers, A and B. The Trace Data viewer in the figure shows that trace starts collecting from the f() function where you set trigger A.

    Figure 2. Trace Data View After Setting Trace From Trigger A to Trigger B in Continuous Mode - Begin
    Trace Data View After Setting Trace From Trigger A to Trigger B in Continuous Mode - Begin

    The figure below shows that trace stops at the f2() function where you set trigger B.

    Figure 3. Trace Data View After Setting Trace From Trigger A to Trigger B in Continuous Mode - End
    Trace Data View After Setting Trace From Trigger A to Trigger B in Continuous Mode - End
    Note: If trigger A and trigger B have less than three executed instructions between them, the stop point is not taken into consideration by the hardware. That is, the hardware misses trigger B if it is set close (less than three executed instructions) to trigger A. This is because there is a three-instruction delay in the hardware pipeline; therefore trigger A is acknowledged at the third executed instruction from where it is actually set. However, incase triggers are set in a loop, hardware will acknowledge trigger B when the loop is executed second time. A three-instruction delay during trace collection also occurs when a breakpoint is set on a jsr instruction in the Disassembly view. This stops the trace abruptly; therefore a red line is displayed in the Trace Data viewer to mark the points where the trace is broken. For more information, refer Trace Collection with Breakpoints.

    The graph in figure below shows the timeline of the trace data. In this graph, you can see that the trace data starts collecting from f(), that is trigger A, and stops at f2(), that is trigger B. To have a clearer view of the graph, you can zoom-in or zoom-out in the graph by scrolling the mouse up or down.

    Figure 4. Graph Displaying Timeline of Trace Data
    Graph Displaying Timeline of Trace Data
  18. Click the Terminate button in the Debug perspective to terminate the application.

This is how you set the Trace From Trigger A to Trigger B trace conditions in the Continuous mode of the ColdFire V1 target and collect trace data.