Desktop Tools and Development Environment |
Disabling and Clearing Breakpoints
Disable a breakpoint to temporarily ignore it. Clear a breakpoint to remove it.
Disabling and Enabling Breakpoints. You can disable selected breakpoints so the program temporarily ignores them and runs uninterrupted, for example, after you think you identified and corrected a problem. This is especially useful for conditional breakpoints--see Conditional Breakpoints.
To disable a breakpoint, right-click the breakpoint icon and select Disable Breakpoint from the context menu, or click anywhere in a line and select Enable/Disable Breakpoint from the Debug or context menu. You can also disable a conditional breakpoint by clicking the breakpoint icon. This puts an X
through the breakpoint icon as shown here.
After disabling a breakpoint, you can enable it to make it active again, or clear it. To enable it, right-click the breakpoint icon and select Enable Breakpoint from the context menu, or click anywhere in a line and select Enable/Disable Breakpoint from the Breakpoints or context menu. The X
no longer appears on the breakpoint icon and program execution will pause at that line.
When you run dbstatus
, the resulting message for a disabled breakpoint is
Breakpoint on line 10 has conditional expression 'false'.
Clearing (Removing) Breakpoints. All breakpoints remain in a file until you clear (remove) them or until they are automatically cleared. Clear a breakpoint after determining that a line of code is not causing a problem.
To clear a breakpoint in the Editor/Debugger, click anywhere in a line and select Set/Clear Breakpoint from the Debug or context menu. The breakpoint for that line is cleared. Another way to clear a breakpoint is to click a standard breakpoint icon, or a disabled conditional breakpoint icon.
To clear all breakpoints in all files, select Debug -> Clear Breakpoints in All Files, or click its equivalent button on the toolbar.
The function that clears breakpoints is dbclear
. To clear all breakpoints, use dbclear all
. For the example, clear all of the breakpoints in collatzplot
by typing
dbclear all in collatzplot
Breakpoints are automatically cleared when you
Note
When clear name or clear all is in a statement in an M-file that you are debugging, it clears the breakpoints.
|
Ending Debugging | Correcting an M-File |
© 1994-2005 The MathWorks, Inc.