Breakpoints
The following content has been imported from Legacy Help systems and is in the process of being checked for accuracy.
Function
The Breakpoints panel provides information on all breakpoints that are currently defined - either within the open source code documents for any embedded project or in one of the memory address spaces associated with a processor whose embedded code is currently being debugged.
Content and Use
The following two types of breakpoint can be defined:
- Source code breakpoint - applied to a particular line of code in the source document of an embedded software project
- Memory address breakpoint - specified for a particular address in a memory space associated with the processor on which the code is running.
Any breakpoints that are currently defined in any open embedded project source code documents (*.C, *.asm), or processor memory spaces will be listed in the panel. For each breakpoint entry, the following information is available:
- Filename/Address - the entry that appears in this field depends on the type of breakpoint. For a source code breakpoint, the name of the file in which the breakpoint resides will be displayed.
For a memory address breakpoint, the specific memory space (e.g. sfr) and address in that space (e.g. 0x3) at which the breakpoint has been specified, will be displayed. Additional information is displayed to indicate when the breakpoint is applied - r (when the address is read), w (when the address is written), or rw (when the address is read or written).
- Line Number - the line within the source code document at which the breakpoint has been placed (source code breakpoint only)
- Count - the current count status for the breakpoint. A non-zero value for Count specifies how many times the breakpoint can be encountered before code execution is halted. Each encounter decrements the Count value by 1. Upon reaching 0, the code is halted
- Reset Count - the value used to automatically reload the Count field when Count reaches 0 and code execution is halted at the breakpoint
- Condition - any specific condition defined for the breakpoint. If a condition has been specified, the breakpoint is referred to as a 'conditional breakpoint', whereby execution of the code will only halt if the condition returns true, otherwise execution will proceed unchecked.
A small icon to the left of the filename/address is used to indicate the status of the breakpoint:
- | Source code breakpoint - valid and currently enabled | |
- | Source code breakpoint - valid and currently disabled | |
- | Source code breakpoint - invalid | |
- | Memory address breakpoint - currently enabled | |
- | Memory address breakpoint - currently disabled |
The icons used to represent source code breakpoints are also used when marking breakpoints on the source code document itself. The line of code to which a breakpoint applies is also highlighted using the associated breakpoint status color, as illustrated in the following image.
The specific address to which a memory address breakpoint applies is also highlighted using the associated breakpoint status color, as illustrated in the following image:
Double-clicking on a source code breakpoint entry in the panel will make the associated source document the active document in the design editor window, placing the text cursor at the beginning of the line of code to which the breakpoint applies.
Double-clicking on a memory address breakpoint entry in the panel will open the relevant panel for the memory space and select the address to which the breakpoint applies.
Right-click Menu
The right-click pop-up menu for the panel provides the following commands:
- Enable - toggle the state of the selected breakpoint(s) between enabled and disabled
- Delete - delete the selected breakpoint(s)
- Enable All - change the current state of all breakpoints listed in the panel to enabled
- Disable All - change the current state of all breakpoints listed in the panel to disabled
- Delete All - delete all currently defined breakpoints listed in the panel
- Properties - use this command to access the Breakpoint Properties dialog for the focused breakpoint entry - either a source code breakpoint (left) or memory address breakpoint (right).
Use this dialog to edit the definition of the breakpoint as required.
Notes
- A breakpoint tells the debugger to pause its execution of program code at a particular line in a source document, or when a particular address in memory space is accessed. Include a breakpoint when you wish to halt execution at a specific point. A typical use of breakpoints in a source code document would be in the different branches of a conditional statement, where a breakpoint is inserted into each branch to check which one is executed.
When a debug session is started for the embedded code running in a processor, all lines of code that can be executed are distinguished by the use of a 'dot' in the right-hand margin, as shown here:
As source document breakpoints can only be valid when placed on executable lines of code, these visual indicators should be used to effectively (and correctly) define such breakpoints.
- Enabled source code breakpoints can be added directly to a document by clicking in the right-hand margin, next to the line that you wish to apply a breakpoint to. Clicking again will remove the breakpoint. Alternatively, use the Toggle Breakpoint command, available from the Debug menu or toolbar. The Breakpoints panel will update accordingly.
- Enabled memory address breakpoints can be added directly to addresses from within the relevant workspace panel for the required memory space. Right-click over the particular address in memory and choose when the breakpoint is to be applied (on read, on write, on read or write).
A memory address breakpoint can be applied to a single address or a range of addresses. For an address range, the lower and upper addresses will be separated by a hyphen:
- A disabled breakpoint remains defined but will not cause the debugger to pause code execution when encountered.
- There are two cases when a source code breakpoint is deemed invalid:
1) It has been placed on a line of source code that is non-executable
2) It resides in a source code document that is not part of the source for the embedded project currently being debugged.
- Standard CTRL + Click and SHIFT + Click functionality is supported for selection of multiple breakpoints in the panel.
- The focused breakpoint entry is distinguished by a dotted outline. Multiple entries may be selected, but only one entry will be given the focus.
- The keyboard shortcuts Up Arrow (or Left Arrow), HOME, END and Down Arrow (or Right Arrow), can be used to select the previous, first, last and next breakpoint entry, respectively.
- To continue execution of a program that has been halted at a breakpoint, use the Run command, available from the Debug menu or toolbar (shortcut F9), or use the single stepping commands.