B.3.2. CADIBptCondition_t and CADIBptConditionOperator_t

Breakpoint comparison operations only apply to CADI_BPT_MEMORY and CADI_BPT_REGISTER breakpoints. Other breakpoints must always specify CADI_BPT_COND_UNCONDITIONAL as conditionOperator. Breakpoint conditions are always applied as a secondary condition after the primary condition of the breakpoint which depends on the breakpoint type and the trigger type.

CADI_BPT_PROGRAM, CADI_BPT_PROGRAM_RANGE, CADI_BPT_INST_STEP, CADI_BPT_EXCEPTION must obey the ignoreCount if the useFormalCondition is set. However, the debugger must ensure that conditionOperator is CADI_BPT_COND_UNCONDITIONAL, otherwise the behavior is undefined.

Example B.25. CADIBptCondition_t

struct CADIBptCondition_t
{
public: // methods
   CADIBptCondition_t(
                     CADIBptConditionOperator_t conditionOperator = CADI_BPT_COND_UNCONDITIONAL,
                     int64_t comparisonValue = 0,
                     uint32_t threadID = 0,
                     uint32_t ignoreCount = 0,
                     uint32_t bitwidth = 0) :
           conditionOperator(conditionOperator),
           comparisonValue(comparisonValue),
           threadID(threadID),
           ignoreCount(ignoreCount),
           bitwidth(bitwidth)
     {
     }
public: // data
   CADIBptConditionOperator_t   conditionOperator; 
   int64_t                      comparisonValue;  
   uint32_t                     threadID; 
   uint32_t                      ignoreCount;  
   uint32_t                      bitwidth; 
};

The data members are:

conditionOperator

specifies the types of condition that are used to determine whether a breakpoint matches. This specifies how the fields comparisonValue and threadID are interpreted. Targets must return CADI_STATUS_ArgNotSupported from CADIBptSet() if this field is set to a value that is not supported by the target.

comparisonValue

if the bottom 30-bits of conditionOperator have a value other than CADI_BPT_COND_UNCONDITIONAL (0), then they specify how comparisonValue is to be compared with the value associated with the breakpoint hit. See the list of condition values enumerated in Example B.26.

threadID

if bit 31 of conditionOperator is set (CADI_BPT_COND_THREADID), then this field specifies that the breakpoint only hits if threadID matches the current thread. It is up to the target to specify how thread IDs are to be matched. Targets must use the extendedTargetFeatures register to identify the mechanism being used. (See CADITargetFeatures_t structure under the nExtendedTargetFeaturesRegNum entry.) One possible mechanism for ARM targets is to match against CONTEXTIDR, as described in Thread-aware breakpoints using CONTEXTIDR. Targets must return CADI_STATUS_ArgNotSupported from CADIBptSet() if threadID is non-zero and bit 31 of conditionOperator is not set.

ignoreCount

is the number of breaks to ignore.

bitwidth

is the width of comparison value.

The conditional breakpoint operations are enumerated in CADIBptConditionOperator_t as listed in Example B.26.

Example B.26. CADIBptConditionOperator_t

enum CADIBptConditionOperator_t
{
    CADI_BPT_COND_UNCONDITIONAL,   // Normal breakpoint, always break, no additional condition.
    CADI_BPT_COND_EQUALS,          // Only break if value == comparisionValue (unsigned comparison)
    CADI_BPT_COND_NOT_EQUALS,      // Only break if value != comparisionValue (unsigned comparison)
        // signed comparison
    CADI_BPT_COND_GREATER_THAN_SIGNED,            // Only break if value >  comparisionValue 
    CADI_BPT_COND_GREATER_THAN_OR_EQUALS_SIGNED,  // Only break if value >= comparisionValue 
    CADI_BPT_COND_LESS_THAN_SIGNED,               // Only break if value <  comparisionValue 
    CADI_BPT_COND_LESS_THAN_OR_EQUALS_SIGNED,     // Only break if value <= comparisionValue
        // unsigned comparison
    CADI_BPT_COND_GREATER_THAN_UNSIGNED,             // Only break if value >  comparisionValue 
    CADI_BPT_COND_GREATER_THAN_OR_EQUALS_UNSIGNED,   // Only break if value >= comparisionValue
    CADI_BPT_COND_LESS_THAN_UNSIGNED,                // Only break if value <  comparisionValue 
    CADI_BPT_COND_LESS_THAN_OR_EQUALS_UNSIGNED,      // Only break if value <= comparisionValue
    CADI_BPT_COND_ENUM_COUNT,                        // Not a valid condition operator
        // legacy support, same as signed comparison
    CADI_BPT_COND_GREATER_THAN = CADI_BPT_COND_GREATER_THAN_SIGNED,
    CADI_BPT_COND_GREATER_THAN_OR_EQUALS = CADI_BPT_COND_GREATER_THAN_OR_EQUALS_SIGNED,
    CADI_BPT_COND_LESS_THAN = CADI_BPT_COND_LESS_THAN_SIGNED,
    CADI_BPT_COND_LESS_THAN_OR_EQUALS = CADI_BPT_COND_LESS_THAN_OR_EQUALS_SIGNED,
        // these are no breakpoint conditions:
    CADI_BPT_COND_ENUM_MAX = 0xFFFFFFFF
	CADI_BPT_COND_LESS_THAN_OR_EQUALS = 	CADI_BPT_COND_LESS_THAN_OR_EQUALS_SIGNED,
	CADI_BPT_COND_THREADID = 0x80000000,   // Thread-aware breakpoint
		// these are no breakpoint conditions:
	CADI_BPT_COND_ENUM_MAX = 0xFFFFFFFF
};

Thread-aware breakpoints using CONTEXTIDR

ARM targets support thread-aware breakpoints by matching the threadID field against the 32-bit CONTEXTIDR register in the target. Targets must indicate support for this mechanism by including the string threadID=CONTEXTIDR in the extendedTargetFeatures register. See CADITargetFeatures_t structure under the nExtendedTargetFeaturesRegNum entry.

Using this mechanism, whenever a breakpoint condition is met and bit 31 of conditionOperator field is set, the threadID field is compared against CONTEXTIDR. If threadID and CONTEXTIDR are equal, the breakpoint hits. If they differ, the breakpoint does not hit and is ignored. The threadID field is ignored if bit 31 of conditionOperator is 0.

Copyright © 2008-2010 ARM Limited. All rights reserved.ARM DUI 0444F
Non-ConfidentialID110210