__conditional_software_breakpoint Macro

If the argument is false, a software breakpoint is triggered.

Include

<assert.h>

Prototype

void __conditional_software_breakpoint(scalar expression);

Argument

expression The expression to test.

Remarks

The expression evaluates to zero or non-zero. If zero, a software breakpoint is triggered and execution will be suspended. If the target device does not support software breakpoints, a compiler error is triggered.

Breakpoints may be turned off without removing the code by defining NDEBUG before including <assert.h>. If the macro NDEBUG is defined, __conditional_software_breakpoint() is ignored and no code is generated.

Example

#include <assert.h>

int main(void)
{
  int a;

  a = 2 * 2;
  __conditional_software_breakpoint(a == 4); /* if true-no action */
  __conditional_software_breakpoint(a == 6); /* if false-break on this line */
}