3.6.1. Breakpoints

Breakpoints are an essential part of any debug mechanism. CADI offers several types of breakpoints that target different areas and levels of debugging. Each breakpoint can be individually configured to modify its behavior.

CADI provides the following predefined breakpoint types:

Program Breakpoints

Program breakpoints are breakpoints set in a program memory of the target. As soon as the program counter equals hits the corresponding address, the simulation suspends and awaits additional commands from the caller.

Memory Breakpoints

A memory breakpoint can be set to a specific address in the available memory. This breakpoint suspends simulation if the specified address is read or written, or the value changes.

Register Breakpoints

Setting a register breakpoint to a specific register results in a suspended simulation if the register is read or written, or its value changes.

Instruction Step Breakpoints

The instruction step breakpoint is an inverted program breakpoint. It suspends simulation as soon as the program counter is set to an address different from the selected breakpoint address. As indicated by its name, this type of breakpoint is used for instruction step implementations. The breakpoint can be set to the current value of the program counter.

Program Range Breakpoints

This breakpoint type extends the program breakpoint to check a specific range of program addresses instead of a single one.

Exception Breakpoints

An exception breakpoint is triggered immediately after the occurrence of an exception.

The breakpoint types supported by a target component are stored in a vector that contains the features for the target (CADITargetFeatures_t). CADI provides comparison values to identify supported predefined types. These are named CADI_TARGET_FEATURE_BPT_TypeExtension. To determine support, perform a simple bitwise AND operation on the target features and the comparison value.

Note

There are two different enumeration data types that might be confused:

  • CADI_BPT_TypeExtension represents an index of the breakpoint type

  • CADI_TARGET_FEATURE_BPT_TypeExtension represents a breakpoint type vector for comparison with the CADI target features.

For both enumeration data types, TypeExtension is one of the following:

  • PROGRAM

  • MEMORY

  • REGISTER

  • INST_STEP

  • PROGRAM_RANGE

  • EXCEPTION

  • USER_DEFINED.

Breakpoint properties

CADIBptRequest_t owns several fields specific to certain breakpoint types. These fields are ignored for other types. The following table gives an overview of the respective associations between fields in CADIBptRequest_t and the various breakpoint types.

Table 3.1. Properties for each breakpoint by trigger type

triggerTypeProgram Memory Register Instruction Step Program Range Exception
AddressYesYes-YesYesYes
sizeOfAddressRange----Yes-
EnabledYesYesYesYesYesYes
ConditionsYes[a]YesaYesaYesaYesaYesa
useFormalConditionsYesYesYesYesYesYes
formalConditionYes[b]YesbYesbYesbYesbYesb
typeYesYesYesYesYesYes
regNumber--Yes---
temporaryYesYesYesYesYesYes
continueExecutionYesYesYesYesYesYes

[a] Yes only if useFormalConditions is 0.

[b] Yes only if useFormalConditions is 1.


If a field is not supported for the required breakpoint type, its value must be left to the initial value assigned by the standard constructor of CADIBptRequest_t.

Breakpoint configuration

CADI provides the dedicated data structure CADIBptRequest_t that is used to set a breakpoint requested by the caller. It holds a description of the breakpoint and specifies its details including, for example:

  • its type

  • the location (memory address or register number) it is to be set to

  • a possible condition for the breakpoint.

A breakpoint can be defined as enabled or as disabled and the state can be changed by a corresponding method call. Breakpoints can be configured to continue execution after being hit.

A breakpoint can be declared as temporary. Temporary breakpoints can be easily cleared by calling CADIBptClear() with a special breakpoint ID (CADI_BPT_CLEAR_ALL_TEMPORARY_BPTS). This removes all of the breakpoints that have the temporary field has set in CADIBptRequest_t.

It is not required to set every field of the corresponding data structure for a breakpoint. Properties that are not required for a certain breakpoint type are ignored by the target. For example, the triggerType field of CADIBptRequest_t is only used for setting a register breakpoint or a memory breakpoint. See Breakpoint properties.

Configuring conditional breakpoints requires special planning. There are two options, either:

  • Use the format set of conditions provided by CADI that cover typical conditions.

  • Forward the breakpoint to the target which then decides if custom conditions apply.

Using formal conditions requires that the corresponding data object owned by CADIBptRequest_t is set. This member, of type CADIBptCondition_t, includes the condition operator and a value to apply the operator to. The format of this value is described by the operator, for example whether it is a signed or unsigned value, and by the bitwidth specified in the condition data type. The bitwidth includes the sign bit.

Managing breakpoints

To set a new breakpoint, call CADIBptSet(). It receives a breakpoint description of type CADIBptRequest_t as described in Breakpoint configuration. On return, the caller receives a breakpoint ID of type CADIBptNumber_t to use in subsequent breakpoint management calls.

After creating a new breakpoint/watchpoint with CADIBptSet(), the breakpoint/watchpoint is enabled/disabled depending on the value of the Enabled field.

Use CADIBptConfigure() to change the enable state for a breakpoint. Call CADIBptClear() to clear a breakpoint. After clearing a breakpoint, the corresponding breakpoint number must not be referred to.

Note

There are two breakpoint IDs that must not be used:

  • 0 represents an invalid breakpoint ID

  • 0xFFFFFFFF is reserved for clearing temporary breakpoints.

To read out descriptions of currently set breakpoints either:

  • Use CADIBptRead() to request the description of a single breakpoint.

    The breakpoint number must be available to identify the required breakpoint.

  • Use CADIBptGetList() to request a list of breakpoints set in the target.

    The method can be used, for example, to read out all breakpoint information of an existent simulation the caller is connected to. No specific knowledge about the target is required.

The CADIBptGetList() method call scheme is described in Overview of CADI accesses from a debugger. To create a buffer with an appropriate size, either:

  • make a reasonable estimate of the number of breakpoints required

  • use the number of supported breakpoints specified in the target features (nrBreakpointsAvailable).

    Depending on the target implementation, this number might be very large.

An important use case for CADIBptGetList() is breakpoint synchronization of several connected callers. This debugger can regularly update the breakpoint list and show breakpoints that have been set from another tool.

Copyright © 2008-2014 ARM. All rights reserved.ARM DUI 0444M
Non-ConfidentialID051314