public class JDIDebugModel extends Object
To provide access to behavior and information specific to the JDI debug
model, a set of interfaces are defined which extend the base set of debug
element interfaces. For example, IJavaStackFrame
is declared to
extend IStackFrame
, and provides methods specific to this debug
model. The specialized interfaces are also available as adapters from the
debug elements generated from this model.
This class provides static utility methods only.
Modifier and Type | Field and Description |
---|---|
static int |
DEF_REQUEST_TIMEOUT
The default JDI request timeout when no preference is set.
|
static String |
PREF_HCR_WITH_COMPILATION_ERRORS
Preference key for specifying if hot code replace should be performed
when a replacement class file contains compilation errors.
|
static String |
PREF_REQUEST_TIMEOUT
Preference key for default JDI request timeout value.
|
static String |
PREF_SUSPEND_FOR_BREAKPOINTS_DURING_EVALUATION
Boolean preference controlling whether breakpoints are hit during an
evaluation operation.
|
Modifier and Type | Method and Description |
---|---|
static void |
addHotCodeReplaceListener(IJavaHotCodeReplaceListener listener)
Registers the given listener for hot code replace notifications.
|
static void |
addJavaBreakpointListener(IJavaBreakpointListener listener)
Registers the given listener for breakpoint notifications.
|
static IJavaClassPrepareBreakpoint |
createClassPrepareBreakpoint(IResource resource,
String typeName,
int memberType,
int charStart,
int charEnd,
boolean register,
Map<String,Object> attributes)
Creates and returns a class prepare breakpoint for a type with the given
name.
|
static IJavaExceptionBreakpoint |
createExceptionBreakpoint(IResource resource,
String exceptionName,
boolean caught,
boolean uncaught,
boolean checked,
boolean register,
Map<String,Object> attributes)
Creates and returns an exception breakpoint for an exception with the
given name.
|
static IJavaLineBreakpoint |
createLineBreakpoint(IResource resource,
String typeName,
int lineNumber,
int charStart,
int charEnd,
int hitCount,
boolean register,
Map<String,Object> attributes)
Creates and returns a line breakpoint in the type with the given name, at
the given line number.
|
static IJavaMethodBreakpoint |
createMethodBreakpoint(IResource resource,
String typePattern,
String methodName,
String methodSignature,
boolean entry,
boolean exit,
boolean nativeOnly,
int lineNumber,
int charStart,
int charEnd,
int hitCount,
boolean register,
Map<String,Object> attributes)
Creates and returns a method breakpoint with the specified criteria.
|
static IJavaMethodEntryBreakpoint |
createMethodEntryBreakpoint(IResource resource,
String typeName,
String methodName,
String methodSignature,
int lineNumber,
int charStart,
int charEnd,
int hitCount,
boolean register,
Map<String,Object> attributes)
Creates and returns a method entry breakpoint with the specified
criteria.
|
static IJavaPatternBreakpoint |
createPatternBreakpoint(IResource resource,
String sourceName,
String pattern,
int lineNumber,
int charStart,
int charEnd,
int hitCount,
boolean register,
Map<String,Object> attributes)
Deprecated.
use
createStratumBreakpoint instead |
static IJavaStratumLineBreakpoint |
createStratumBreakpoint(IResource resource,
String stratum,
String sourceName,
String sourcePath,
String classNamePattern,
int lineNumber,
int charStart,
int charEnd,
int hitCount,
boolean register,
Map<String,Object> attributes)
Creates and returns a line breakpoint identified by its source file name
and/or path, and stratum that it is relative to.
|
static IJavaTargetPatternBreakpoint |
createTargetPatternBreakpoint(IResource resource,
String sourceName,
int lineNumber,
int charStart,
int charEnd,
int hitCount,
boolean register,
Map<String,Object> attributes)
Creates and returns a target pattern breakpoint for the given resource at
the given line number.
|
static IJavaWatchpoint |
createWatchpoint(IResource resource,
String typeName,
String fieldName,
int lineNumber,
int charStart,
int charEnd,
int hitCount,
boolean register,
Map<String,Object> attributes)
Creates and returns a watchpoint on a field with the given name in a type
with the given name.
|
static String |
getPluginIdentifier()
Returns the identifier for the JDI debug model plug-in
|
static Preferences |
getPreferences()
Deprecated.
the
Preferences class has been deprecated, use the IEclipsePreferences accessors instead |
static IJavaLineBreakpoint |
lineBreakpointExists(IResource resource,
String typeName,
int lineNumber)
Returns a Java line breakpoint that is already registered with the
breakpoint manager for a type with the given name at the given line
number in the given resource.
|
static IJavaLineBreakpoint |
lineBreakpointExists(String typeName,
int lineNumber)
Returns a Java line breakpoint that is already registered with the
breakpoint manager for a type with the given name at the given line
number.
|
static IDebugTarget |
newDebugTarget(ILaunch launch,
com.sun.jdi.VirtualMachine vm,
String name,
IProcess process,
boolean allowTerminate,
boolean allowDisconnect)
Creates and returns a debug target for the given VM, with the specified
name, and associates the debug target with the given process for console
I/O.
|
static IDebugTarget |
newDebugTarget(ILaunch launch,
com.sun.jdi.VirtualMachine vm,
String name,
IProcess process,
boolean allowTerminate,
boolean allowDisconnect,
boolean resume)
Creates and returns a debug target for the given VM, with the specified
name, and associates the debug target with the given process for console
I/O.
|
static void |
removeHotCodeReplaceListener(IJavaHotCodeReplaceListener listener)
Unregisters the given listener for hot code replace notifications.
|
static void |
removeJavaBreakpointListener(IJavaBreakpointListener listener)
Unregisters the given listener for breakpoint notifications.
|
static void |
savePreferences()
Deprecated.
the
Preferences class has been deprecated, use the IEclipsePreferences accessors instead |
public static final String PREF_REQUEST_TIMEOUT
public static final String PREF_HCR_WITH_COMPILATION_ERRORS
public static final int DEF_REQUEST_TIMEOUT
public static final String PREF_SUSPEND_FOR_BREAKPOINTS_DURING_EVALUATION
public static IDebugTarget newDebugTarget(ILaunch launch, com.sun.jdi.VirtualMachine vm, String name, IProcess process, boolean allowTerminate, boolean allowDisconnect)
ITerminate
). The allow disconnect flag
specifies whether the debug target will support disconnection (
IDisconnect
). Launching the actual VM is a client
responsibility. By default, the target VM will be resumed on startup. The
debug target is added to the given launch.launch
- the launch the new debug target will be contained invm
- the VM to create a debug target forname
- the name to associate with the VM, which will be returned from
IDebugTarget.getName
. If null
the
name will be retrieved from the underlying VM.process
- the process to associate with the debug target, which will be
returned from IDebugTarget.getProcess
allowTerminate
- whether the target will support terminationallowDisconnect
- whether the target will support disconnectionITerminate
,
IDisconnect
public static IDebugTarget newDebugTarget(ILaunch launch, com.sun.jdi.VirtualMachine vm, String name, IProcess process, boolean allowTerminate, boolean allowDisconnect, boolean resume)
ITerminate
). The allow disconnect flag
specifies whether the debug target will support disconnection (
IDisconnect
). The resume flag specifies if the target VM
should be resumed on startup (has no effect if the VM was already running
when the connection to the VM was established). Launching the actual VM
is a client responsibility. The debug target is added to the given
launch.launch
- the launch the new debug target will be contained invm
- the VM to create a debug target forname
- the name to associate with the VM, which will be returned from
IDebugTarget.getName
. If null
the
name will be retrieved from the underlying VM.process
- the process to associate with the debug target, which will be
returned from IDebugTarget.getProcess
allowTerminate
- whether the target will support terminationallowDisconnect
- whether the target will support disconnectionresume
- whether the target is to be resumed on startup. Has no effect
if the target was already running when the connection to the
VM was established.ITerminate
,
IDisconnect
public static String getPluginIdentifier()
public static void addHotCodeReplaceListener(IJavaHotCodeReplaceListener listener)
Note that since 3.6, if an IJavaDebugTarget
has hot code replace
listeners registered with it directly, listeners registered with this
class are not notified of hot code replace events for that target. This
allows a target to have custom hot code replace notification behavior.
listener
- hot code replace listenerIJavaHotCodeReplaceListener
,
IJavaDebugTarget.addHotCodeReplaceListener(IJavaHotCodeReplaceListener)
public static void removeHotCodeReplaceListener(IJavaHotCodeReplaceListener listener)
listener
- hot code replace listenerIJavaHotCodeReplaceListener
public static void addJavaBreakpointListener(IJavaBreakpointListener listener)
listener
- breakpoint listenerIJavaBreakpointListener
public static void removeJavaBreakpointListener(IJavaBreakpointListener listener)
listener
- breakpoint listenerIJavaBreakpointListener
public static IJavaLineBreakpoint createLineBreakpoint(IResource resource, String typeName, int lineNumber, int charStart, int charEnd, int hitCount, boolean register, Map<String,Object> attributes) throws CoreException
resource
- the resource on which to create the associated breakpoint
markertypeName
- the fully qualified name of the type the breakpoint is to be
installed in. If the breakpoint is to be installed in an inner
type, it is sufficient to provide the name of the top level
enclosing type. If an inner class name is specified, it should
be formatted as the associated class file name (i.e. with
$
). For example,
example.SomeClass$InnerType
, could be specified,
but example.SomeClass
is sufficient.lineNumber
- the lineNumber on which the breakpoint is set - line numbers
are 1 based, associated with the source file in which the
breakpoint is setcharStart
- the first character index associated with the breakpoint, or
-1 if unspecified, in the source file in which the breakpoint
is setcharEnd
- the last character index associated with the breakpoint, or -1
if unspecified, in the source file in which the breakpoint is
sethitCount
- the number of times the breakpoint will be hit before
suspending execution - 0 if it should always suspendregister
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation, or
null
if none.CoreException
- If this method fails. Reasons include:
@Deprecated public static IJavaPatternBreakpoint createPatternBreakpoint(IResource resource, String sourceName, String pattern, int lineNumber, int charStart, int charEnd, int hitCount, boolean register, Map<String,Object> attributes) throws CoreException
createStratumBreakpoint
insteadresource
- the resource on which to create the associated breakpoint
markersourceName
- the name of the source file in which the breakpoint is set, or
null
. When specified, the pattern breakpoint will
install itself in classes that have a source file name debug
attribute that matches this value, and satisfies the class
name pattern.pattern
- the class name pattern in which the pattern breakpoint should
be installed. The pattern breakpoint will install itself in
every class which matches the pattern.lineNumber
- the lineNumber on which the breakpoint is set - line numbers
are 1 based, associated with the source file in which the
breakpoint is setcharStart
- the first character index associated with the breakpoint, or
-1 if unspecified, in the source file in which the breakpoint
is setcharEnd
- the last character index associated with the breakpoint, or -1
if unspecified, in the source file in which the breakpoint is
sethitCount
- the number of times the breakpoint will be hit before
suspending execution - 0 if it should always suspendregister
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation, or
null
if none.CoreException
- If this method fails. Reasons include:
public static IJavaStratumLineBreakpoint createStratumBreakpoint(IResource resource, String stratum, String sourceName, String sourcePath, String classNamePattern, int lineNumber, int charStart, int charEnd, int hitCount, boolean register, Map<String,Object> attributes) throws CoreException
resource
- the resource on which to create the associated breakpoint
markerstratum
- the stratum in which the source name, source path and line
number are relative, or null
. If
null
or if the specified stratum is not defined
for a type, the source name, source path and line number are
relative to the type's default stratum.sourceName
- the simple name of the source file in which the breakpoint is
set, or null
. The breakpoint will install itself
in classes that have a source file name debug attribute that
matches this value in the specified stratum, and satisfies the
class name pattern and source path attribute. When
null
, the source file name debug attribute is not
considered.sourcePath
- the qualified source file name in which the breakpoint is set,
or null
. The breakpoint will install itself in
classes that have a source file path in the specified stratum
that matches this value, and satisfies the class name pattern
and source name attribute. When null
, the source
path attribute is not considered.classNamePattern
- the class name pattern to which the breakpoint should be
restricted, or null
. The breakpoint will install
itself in each type that matches this class name pattern, with
a satisfying source name and source path. Patterns may begin
or end with '*', which matches 0 or more characters. A pattern
that does not contain a '*' is equivalent to a pattern ending
in '*'. Specifying null
, or an empty string is
the equivalent to "*". Multiple patterns can be specified by
delimiting the patterns with a comma - e.g. "x.y.z,a.b.c".
When multiple patterns are specified, The breakpoint will
install itself in each of the types that match any of the
specified class pattern, with a satisfying source name and
source path.lineNumber
- the lineNumber on which the breakpoint is set - line numbers
are 1 based, associated with the source file (stratum) in
which the breakpoint is setcharStart
- the first character index associated with the breakpoint, or
-1 if unspecified, in the source file in which the breakpoint
is setcharEnd
- the last character index associated with the breakpoint, or -1
if unspecified, in the source file in which the breakpoint is
sethitCount
- the number of times the breakpoint will be hit before
suspending execution - 0 if it should always suspendregister
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation, or
null
if none.CoreException
- If this method fails. Reasons include:
public static IJavaTargetPatternBreakpoint createTargetPatternBreakpoint(IResource resource, String sourceName, int lineNumber, int charStart, int charEnd, int hitCount, boolean register, Map<String,Object> attributes) throws CoreException
resource
- the resource on which to create the associated breakpoint
markersourceName
- the name of the source file in which the breakpoint is set, or
null
. When specified, the pattern breakpoint will
install itself in classes that have a source file name debug
attribute that matches this value, and satisfies the class
name pattern.lineNumber
- the lineNumber on which the breakpoint is set - line numbers
are 1 based, associated with the source file in which the
breakpoint is setcharStart
- the first character index associated with the breakpoint, or
-1 if unspecified, in the source file in which the breakpoint
is setcharEnd
- the last character index associated with the breakpoint, or -1
if unspecified, in the source file in which the breakpoint is
sethitCount
- the number of times the breakpoint will be hit before
suspending execution - 0 if it should always suspendregister
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation, or
null
if none.CoreException
- If this method fails. Reasons include:
public static IJavaExceptionBreakpoint createExceptionBreakpoint(IResource resource, String exceptionName, boolean caught, boolean uncaught, boolean checked, boolean register, Map<String,Object> attributes) throws CoreException
resource
- the resource on which to create the associated breakpoint
markerexceptionName
- the fully qualified name of the exception for which to create
the breakpointcaught
- whether to suspend in caught locationsuncaught
- whether to suspend in uncaught locationschecked
- whether the exception is a checked exception (i.e. compiler
detected)register
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation or
null
if none.CoreException
- If this method fails. Reasons include:
public static IJavaWatchpoint createWatchpoint(IResource resource, String typeName, String fieldName, int lineNumber, int charStart, int charEnd, int hitCount, boolean register, Map<String,Object> attributes) throws CoreException
resource
- the resource on which to create the associated breakpoint
markertypeName
- the fully qualified name of the type the breakpoint is to be
installed in. If the breakpoint is to be installed in an inner
type, it is sufficient to provide the name of the top level
enclosing type. If an inner class name is specified, it should
be formatted as the associated class file name (i.e. with
$
). For example,
example.SomeClass$InnerType
, could be specified,
but example.SomeClass
is sufficient.fieldName
- the name of the field on which to suspend (on access or
modification)lineNumber
- the lineNumber on which the breakpoint is set - line numbers
are 1 based, associated with the source file in which the
breakpoint is setcharStart
- the first character index associated with the breakpoint, or
-1 if unspecified, in the source file in which the breakpoint
is setcharEnd
- the last character index associated with the breakpoint, or -1
if unspecified, in the source file in which the breakpoint is
sethitCount
- the number of times the breakpoint will be hit before
suspending execution - 0 if it should always suspendregister
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation, or
null
if none.CoreException
- If this method fails. Reasons include:
public static IJavaMethodBreakpoint createMethodBreakpoint(IResource resource, String typePattern, String methodName, String methodSignature, boolean entry, boolean exit, boolean nativeOnly, int lineNumber, int charStart, int charEnd, int hitCount, boolean register, Map<String,Object> attributes) throws CoreException
resource
- the resource on which to create the associated breakpoint
markertypePattern
- the pattern specifying the fully qualified name of type(s)
this breakpoint suspends execution in. Patterns are limited to
exact matches and patterns that begin or end with '*'.methodName
- the name of the method(s) this breakpoint suspends execution
in, or null
if this breakpoint does not suspend
execution based on method namemethodSignature
- the signature of the method(s) this breakpoint suspends
execution in, or null
if this breakpoint does not
suspend execution based on method signatureentry
- whether this breakpoint causes execution to suspend on entry
of methodsexit
- whether this breakpoint causes execution to suspend on exit of
methodsnativeOnly
- whether this breakpoint causes execution to suspend on
entry/exit of native methods onlylineNumber
- the lineNumber on which the breakpoint is set - line numbers
are 1 based, associated with the source file in which the
breakpoint is setcharStart
- the first character index associated with the breakpoint, or
-1 if unspecified, in the source file in which the breakpoint
is setcharEnd
- the last character index associated with the breakpoint, or -1
if unspecified, in the source file in which the breakpoint is
sethitCount
- the number of times the breakpoint will be hit before
suspending execution - 0 if it should always suspendregister
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation, or
null
if none.CoreException
- If this method fails. Reasons include:
public static IJavaMethodEntryBreakpoint createMethodEntryBreakpoint(IResource resource, String typeName, String methodName, String methodSignature, int lineNumber, int charStart, int charEnd, int hitCount, boolean register, Map<String,Object> attributes) throws CoreException
resource
- the resource on which to create the associated breakpoint
markertypeName
- the fully qualified name of type this breakpoint suspends
execution in.methodName
- the name of the method this breakpoint suspends execution inmethodSignature
- the signature of the method this breakpoint suspends execution
inlineNumber
- the lineNumber on which the breakpoint is set - line numbers
are 1 based, associated with the source file in which the
breakpoint is setcharStart
- the first character index associated with the breakpoint, or
-1 if unspecified, in the source file in which the breakpoint
is setcharEnd
- the last character index associated with the breakpoint, or -1
if unspecified, in the source file in which the breakpoint is
sethitCount
- the number of times the breakpoint will be hit before
suspending execution - 0 if it should always suspendregister
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation, or
null
if none.CoreException
- If this method fails. Reasons include:
public static IJavaLineBreakpoint lineBreakpointExists(String typeName, int lineNumber) throws CoreException
typeName
- fully qualified type namelineNumber
- line numbernull
if no such breakpoint is
registeredCoreException
- if unable to retrieve the associated marker attributes
(line number).public static IJavaLineBreakpoint lineBreakpointExists(IResource resource, String typeName, int lineNumber) throws CoreException
resource
- the resourcetypeName
- fully qualified type namelineNumber
- line numbernull
if no such breakpoint is
registeredCoreException
- if unable to retrieve the associated marker attributes
(line number).@Deprecated public static Preferences getPreferences()
Preferences
class has been deprecated, use the IEclipsePreferences
accessors insteadnull
if the store is not available. IEclipsePreferences node = InstanceScope.INSTANCE.getNode(JDIDebugPlugin.getUniqueIdentifier()); if(node != null) { ... }
@Deprecated public static void savePreferences()
Preferences
class has been deprecated, use the IEclipsePreferences
accessors insteadIEclipsePreferences node = InstanceScope.INSTANCE.getNode(JDIDebugPlugin.getUniqueIdentifier()); if(node != null) { try { node.flush(); } catch (BackingStoreException e) { log(e); } }
public static IJavaClassPrepareBreakpoint createClassPrepareBreakpoint(IResource resource, String typeName, int memberType, int charStart, int charEnd, boolean register, Map<String,Object> attributes) throws CoreException
resource
- the resource on which to create the associated breakpoint
markertypeName
- the fully qualified name of the type for which to create the
breakpointmemberType
- one of TYPE_CLASS
or TYPE_INTERFACE
charStart
- the first character index associated with the breakpoint, or
-1 if unspecified, in the source file in which the breakpoint
is setcharEnd
- the last character index associated with the breakpoint, or -1
if unspecified, in the source file in which the breakpoint is
setregister
- whether to add this breakpoint to the breakpoint managerattributes
- a map of client defined attributes that should be assigned to
the underlying breakpoint marker on creation or
null
if none.CoreException
- If this method fails. Reasons include:
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.