- Breakpoint
- A breakpoint is a mechanism for suspending program execution when a specific set of criteria are met.
The criteria for suspending program execution can range from a simple line breakpoint that stops a program when it lands on a particular line of code, all the way up to complex breakpoints that combine multiple conditions into a detailed set of criteria that can target very specific circumstances.
Types of Breakpoints
Breakpoints fall into two broad categories: hardware breakpoints and software breakpoints. At the Integrated Development Environment (IDE) level, both types will appear to work the same way but there are differences in their implementations behind the scenes.
Hardware Breakpoints
Hardware breakpoints are versatile in their ability to suspending program execution. These breakpoints are limited in number by the target microcontroller's hardware.
MPLAB® X IDE will automatically use hardware breakpoints by default.
Icon | Hardware Breakpoint Type |
---|---|
Line Breakpoint | |
Address Breakpoint | |
Data Breakpoint | |
Event Breakpoint | |
Sequence Breakpoint (Complex) | |
Tuple Breakpoint (Complex) |
Software Breakpoints
There are more software breakpoints available than hardware breakpoints. These breakpoints only support breaking on program memory events.
To use software breakpoints, they must first be enabled. Software breakpoints are only supported by the MPLAB® REAL ICE™ and MPLAB ICD 3 debuggers.
Icon | Software Breakpoint Type |
---|---|
Line Breakpoint | |
Address Breakpoint |
Hardware vs. Software Breakpoints
The following table compares the features of each to help you decide which type of breakpoint to use.
Feature | Hardware Breakpoints | Software Breakpoints |
---|---|---|
Number of breakpoints | Limited | Unlimited |
Breakpoints written to1 | Internal debug registers | Flash Program Memory |
Breakpoints applied to2 | Program Memory/Data Memory | Program Memory only |
Time to set breakpoints | Minimal | Dependent on oscillator speed, time to program Flash Memory and page size |
Breakpoint skidding | Most devices3 | No |
Effect on Endurance4 | No | Yes |
Note: 1. Where information about the breakpoint is written in the device. 2. What kind of device feature applies to the breakpoint. This is where the breakpoint is set. 3. For details, check the 'Limitations section' on Online Help. 4. Using software breakpoints for debug impacts device endurance. Therefore, it is recommended that devices used in this manner not be used as production parts. |