public class Breakpoint extends Object
DebuggerSession
uses a Breakpoint.Builder
to create a new breakpoint,
choosing among multiple ways to specify the intended location. Examples include a specified
source
, a specified URI
, line ranges, or an
exact SourceSection
.
Example usage: BreakpointSnippets.example()
Modifier and Type | Class and Description |
---|---|
class |
Breakpoint.Builder
Builder implementation for a new
breakpoint . |
class |
Breakpoint.ExceptionBuilder
Builder implementation for a new
breakpoint of EXCEPTION kind. |
static class |
Breakpoint.Kind
Specifies a breakpoint kind.
|
static interface |
Breakpoint.ResolveListener
This listener is called when a breakpoint is resolved at the target location.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Permanently prevents this breakpoint from affecting execution.
|
String |
getCondition()
Returns the expression used to create the current breakpoint condition, null if no condition
set.
|
int |
getHitCount() |
int |
getIgnoreCount() |
Breakpoint.Kind |
getKind()
Returns the kind of this breakpoint.
|
String |
getLocationDescription() |
SuspendAnchor |
getSuspendAnchor()
Returns the suspended position within the guest language source location.
|
boolean |
isDisposed() |
boolean |
isEnabled() |
boolean |
isModifiable()
Test whether this breakpoint can be modified.
|
boolean |
isOneShot() |
boolean |
isResolved() |
static Breakpoint.Builder |
newBuilder(Source source)
Creates a new breakpoint builder based on a
Source . |
static Breakpoint.Builder |
newBuilder(SourceSection sourceSection)
Creates a new breakpoint builder based on the textual region of a guest language source
element.
|
static Breakpoint.Builder |
newBuilder(URI sourceUri)
Creates a new breakpoint builder based on a URI location.
|
static Breakpoint.ExceptionBuilder |
newExceptionBuilder(boolean caught,
boolean uncaught)
Creates a new exception breakpoint builder.
|
void |
setCondition(String expression)
Assigns to this breakpoint a boolean expression whose evaluation will determine whether the
breakpoint suspends execution (i.e.
|
void |
setEnabled(boolean enabled)
Controls whether this breakpoint is currently allowed to suspend execution (true by default).
|
void |
setIgnoreCount(int ignoreCount)
Changes the number of times the breakpoint must be executed before it hits (i.e.
|
String |
toString() |
public Breakpoint.Kind getKind()
public boolean isDisposed()
Breakpoint.dispose()
public boolean isEnabled()
Breakpoint.setEnabled(boolean)
public void setEnabled(boolean enabled)
When not modifiable
, IllegalStateException
is thrown.
enabled
- whether this breakpoint should be allowed to suspend executionpublic boolean isResolved()
public void setCondition(String expression)
null
to remove any condition and always
suspend.
Breakpoints are by default unconditional.
Evaluation: expressions are parsed and evaluated in the lexical context of the breakpoint's location. A conditional breakpoint that applies to multiple code locations will be parsed and evaluated separately for each location.
Evaluation failure: when evaluation of a condition fails for any reason, including the return of a non-boolean value:
true
, andmodifiable
, IllegalStateException
is thrown.expression
- if non-null
, a boolean expression, expressed in the guest language
of the breakpoint's location.SuspendedEvent.getBreakpointConditionException(Breakpoint)
public String getCondition()
public void dispose()
modifiable
, IllegalStateException
is thrown.public boolean isOneShot()
public int getIgnoreCount()
Breakpoint.setIgnoreCount(int)
public void setIgnoreCount(int ignoreCount)
When a breakpoint condition evaluates to false
:
ignoreCount
does not change.modifiable
, IllegalStateException
is thrown.ignoreCount
- number of breakpoint activations to ignore before it hitspublic int getHitCount()
public String getLocationDescription()
public SuspendAnchor getSuspendAnchor()
public boolean isModifiable()
false
, methods that change
breakpoint state throw IllegalStateException
.
Unmodifiable breakpoints are created from installed breakpoints as read-only copies to be
available to clients other than the one who installed the original breakpoint.
Debugger.getBreakpoints()
returns unmodifiable breakpoints, for instance.
public static Breakpoint.Builder newBuilder(URI sourceUri)
sourceUri
- a URI to specify breakpoint locationpublic static Breakpoint.Builder newBuilder(Source source)
Source
.source
- a Source
to specify breakpoint locationpublic static Breakpoint.Builder newBuilder(SourceSection sourceSection)
sourceSection
- a specification for guest language source elementpublic static Breakpoint.ExceptionBuilder newExceptionBuilder(boolean caught, boolean uncaught)
breakpoint
of EXCEPTION
kind.caught
- true
to intercept exceptions that are caught by guest language
code.uncaught
- true
to intercept exceptions that are not caught by guest
language code.