Trace Collection with Breakpoints

A breakpoint suspends the debug session automatically when the instruction on which it is set is executed. When a breakpoint is set in trace collection, it halts the application at a particular source line and stops collecting the trace data. You can start collecting trace again from that source line by resuming the debug session.

You can set breakpoints either in the editor area or in the Disassembly view. The following steps demonstrate how to set a breakpoint in the editor area and collect trace data on the ColdFire V1 target:

  1. Open the Debug Configurations dialog box, and select your project in the tree structure.
  2. Click the Trace and Profile tab, and check the Enable Trace and Profile checkbox.
  3. Select the Continuous option from the Select Trace Mode group.
  4. Ensure that the Trace is Always Enabled option is selected in the Trace Start/Stop Conditions drop-down list.
  5. Click Apply to save the settings.
  6. Click Debug to start the debug session.
  7. In the editor area, double-click the marker bar corresponding to the instruction on which you want to set the breakpoint.
    Figure 1. Setting Breakpoint in Disassembly View
    Setting Breakpoint in Disassembly View
  8. Click Resume . The debug session stops when the breakpoint instruction is executed.
  9. Open the Trace Data viewer following the steps explained in Viewing Data to view the trace data.
  10. Press Resume to resume trace collection.

The figure below shows that trace collection stops at the address where the breakpoint was set.

Figure 2. Trace Results After Setting Breakpoint
Trace Results After Setting Breakpoint
Note: Similarly, you can set breakpoints in the Disassembly view and collect the trace data.
Warning: Do not use breakpoints with triggers when collecting trace on the ColdFire V1 target. This is because there is only one hardware debug module on ColdFire V1 which is shared for setting hardware breakpoints or trace triggers. So you can either set breakpoint or trace trigger using this debug module.

On HCS08, if you are setting breakpoints with triggers for trace control, ensure that you do not to use more than one breakpoint. This is because on HCS08, two hardware debug modules, BDC (Background debug controller) and DBG (debug module) are used. Both debug modules can be used for setting hardware breakpoints, while only DBG can be used for setting triggers. The first breakpoint is set using BDC, any other breakpoints will use DBG and will conflict with the triggers.

On DSC and S12z platforms, breakpoints and triggers are mutually exclusive.

On the Kinetis platform, there are four DWT comparators which can be used for maximum four events. The Software Analysis tool checks which DWT comparators are already used for breakpoints and only uses the remaining ones for triggers.