A breakpoint is a marker set on a specific line of source code and is designed to halt program execution when encountered by the debugger. After you set a breakpoint at a key point in the program, you can halt its execution, examine its current state, and check register and variable values. You can also change values and alter the flow of normal program execution. Setting breakpoints helps you debug your program and verify its efficiency.
A project can have multiple breakpoints set in the source code files. All breakpoints in a project are shown in the Breakpoints view. Breakpoints are enabled or disabled on the currently selected line within a source code editor by selecting the Run > Toggle Breakpoint menu option, right-clicking the marker bar in the editor and selecting Toggle Breakpoint, or by pressing CTRL-SHIFT-B.
You can set a breakpoint on any executable line of code that the debugger can resolve. Lines containing comments and other non executable code cannot be assigned a breakpoint as they are normally stripped from the compiled binary. The debugger must load the symbols for a module before it can attempt to resolve breakpoints within the module. This is most easily done using the Executables view to import a binary file, especially if the binary is not in the workspace.
When the debugger attempts to resolve a breakpoint it will result in:
Breakpoints have enabled and disabled types as well as resolved and unresolved states. Table 1 explains the different breakpoint types and states.
Type | State | Icon | Explanation |
---|---|---|---|
Enabled | Unresolved |
![]() |
Indicates that the breakpoint is currently enabled but not located in the executable during a debug session. Debugger cannot halt program execution. |
Enabled | Resolved |
![]() |
Indicates that the breakpoint is currently enabled and resolved for the source line. The debugger halts program execution at an enabled breakpoint. |
Disabled | Unresolved |
![]() |
Indicates that the breakpoint is currently disabled but not located in the executable during a debug session. The debugger does not halt program execution at a disabled breakpoint. |
Disabled | Resolved |
![]() |
Indicates that the breakpoint is currently disabled and resolved for the source line. The debugger does not halt program execution at a disabled breakpoint. |
Other references