public abstract class JPDADebugger extends Object
VirtualMachine
).
JPDADebugger jpdaDebugger = (JPDADebugger) debuggerEngine.lookup (JPDADebugger.class);
Modifier and Type | Class and Description |
---|---|
static interface |
JPDADebugger.Registration
Declarative registration of a JPDADebugger implementation.
|
Modifier and Type | Field and Description |
---|---|
static String |
ENGINE_ID
ID of JPDA Debugger Engine.
|
static String |
PROP_BREAKPOINTS_ACTIVE
Property name constant.
|
static String |
PROP_CLASSES_FIXED
Property name constant.
|
static String |
PROP_CURRENT_CALL_STACK_FRAME
Name of property for current stack frame.
|
static String |
PROP_CURRENT_THREAD
Name of property for current thread.
|
static String |
PROP_STATE
Name of property for state of debugger.
|
static String |
PROP_SUSPEND
Property name constant.
|
static String |
PROP_THREAD_DIED
Property name constant.
|
static String |
PROP_THREAD_GROUP_ADDED
Property name constant.
|
static String |
PROP_THREAD_STARTED
Property name constant.
|
static String |
SESSION_ID
ID of JPDA Debugger Engine.
|
static int |
STATE_DISCONNECTED
Debugger state constant.
|
static int |
STATE_RUNNING
Debugger state constant.
|
static int |
STATE_STARTING
Debugger state constant.
|
static int |
STATE_STOPPED
Debugger state constant.
|
static int |
SUSPEND_ALL
Suspend property value constant.
|
static int |
SUSPEND_EVENT_THREAD
Suspend property value constant.
|
Constructor and Description |
---|
JPDADebugger() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addPropertyChangeListener(PropertyChangeListener l)
Adds property change listener.
|
abstract void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener l)
Adds property change listener.
|
static JPDADebugger |
attach(String hostName,
int portNumber,
Object[] services)
This utility method helps to start a new JPDA debugger session.
|
static JPDADebugger |
attach(String name,
Object[] services)
This utility method helps to start a new JPDA debugger session.
|
boolean |
canBeModified()
Determines if the target debuggee can be modified.
|
abstract boolean |
canFixClasses()
Returns
true if this debugger supports fix & continue
(HotSwap). |
boolean |
canGetInstanceInfo()
Test whether the debuggee supports accessing of class instances, instance counts, and referring objects.
|
abstract boolean |
canPopFrames()
Returns
true if this debugger supports Pop action. |
JPDAStep |
createJPDAStep(int size,
int depth)
Creates a new
JPDAStep . |
Variable |
createMirrorVar(Object obj)
Create a mirror object in the target virtual machine
|
Variable |
createMirrorVar(Object obj,
boolean isPrimitive)
Create a mirror object in the target virtual machine
|
abstract Variable |
evaluate(String expression)
Evaluates given expression in the current context.
|
protected void |
fireBreakpointEvent(JPDABreakpoint breakpoint,
JPDABreakpointEvent event)
Helper method that fires JPDABreakpointEvent on JPDABreakpoints.
|
abstract void |
fixClasses(Map<String,byte[]> classes)
Implements fix & continue (HotSwap).
|
List<JPDAClassType> |
getAllClasses()
Get the list of all classes in the debuggee.
|
boolean |
getBreakpointsActive()
Test, if breakpoints are active.
|
List<JPDAClassType> |
getClassesByName(String name)
Get the list of all classes mathing the given name in the debuggee.
|
abstract CallStackFrame |
getCurrentCallStackFrame()
Returns current stack frame or null.
|
abstract JPDAThread |
getCurrentThread()
Returns current thread or null.
|
long[] |
getInstanceCounts(List<JPDAClassType> classTypes)
Retrieves the number of instances of each class in the list.
|
Session |
getSession()
Get the session associated with this debugger.
|
abstract SmartSteppingFilter |
getSmartSteppingFilter()
Returns instance of SmartSteppingFilter.
|
abstract int |
getState()
Returns current state of JPDA debugger.
|
abstract int |
getSuspend()
Gets value of suspend property.
|
ThreadsCollector |
getThreadsCollector()
Get the collector of threads.
|
static void |
launch(String mainClassName,
String[] args,
String classPath,
boolean suspend)
This utility method helps to start a new JPDA debugger session.
|
static JPDADebugger |
listen(com.sun.jdi.connect.ListeningConnector connector,
Map<String,? extends com.sun.jdi.connect.Connector.Argument> args,
Object[] services)
This utility method helps to start a new JPDA debugger session.
|
abstract void |
removePropertyChangeListener(PropertyChangeListener l)
Removes property change listener.
|
abstract void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener l)
Removes property change listener.
|
void |
setBreakpointsActive(boolean active)
Set all breakpoints to be active / inactive.
|
abstract void |
setSuspend(int s)
Sets value of suspend property.
|
static void |
startListening(com.sun.jdi.connect.ListeningConnector connector,
Map<String,? extends com.sun.jdi.connect.Connector.Argument> args,
Object[] services)
This utility method helps to start a new JPDA debugger session.
|
static DebuggerEngine[] |
startListeningAndGetEngines(com.sun.jdi.connect.ListeningConnector connector,
Map<String,? extends com.sun.jdi.connect.Connector.Argument> args,
Object[] services)
This utility method helps to start a new JPDA debugger session.
|
abstract void |
waitRunning()
Waits till the Virtual Machine is started and returns
DebuggerStartException if some problem occurres. |
public static final String PROP_STATE
public static final String PROP_CURRENT_THREAD
public static final String PROP_CURRENT_CALL_STACK_FRAME
public static final String PROP_SUSPEND
public static final String PROP_THREAD_STARTED
public static final String PROP_THREAD_DIED
public static final String PROP_THREAD_GROUP_ADDED
public static final String PROP_CLASSES_FIXED
public static final String PROP_BREAKPOINTS_ACTIVE
public static final int SUSPEND_ALL
public static final int SUSPEND_EVENT_THREAD
public static final int STATE_STARTING
public static final int STATE_RUNNING
public static final int STATE_STOPPED
public static final int STATE_DISCONNECTED
public static final String ENGINE_ID
public static final String SESSION_ID
public static void launch(String mainClassName, String[] args, String classPath, boolean suspend)
LaunchingDICookie
and
DebuggerManager.getDebuggerManager()
.mainClassName
- a name or main classargs
- command line argumentsclassPath
- a classPathsuspend
- if true session will be suspendedpublic static JPDADebugger listen(com.sun.jdi.connect.ListeningConnector connector, Map<String,? extends com.sun.jdi.connect.Connector.Argument> args, Object[] services) throws DebuggerStartException
ListeningDICookie
and
DebuggerManager.getDebuggerManager()
.connector
- The listening connectorargs
- The argumentsservices
- The additional services, which are added to the debugger session lookup.Map
with following setup properties:name
with the value being the session name as String,sourcepath
with the ClassPath
value containing class path of sources used by debugger,jdksources
with the ClassPath
value containing class path of platform sources,listeningCP
optional String representation of source class path which is in compile-on-save mode, which we listen on for artifacts changes,baseDir
with the debugging project's base directory as File
.DebuggerStartException
public static void startListening(com.sun.jdi.connect.ListeningConnector connector, Map<String,? extends com.sun.jdi.connect.Connector.Argument> args, Object[] services) throws DebuggerStartException
ListeningDICookie
and
DebuggerManager.getDebuggerManager()
.connector
- The listening connectorargs
- The argumentsservices
- The additional services, which are added to the debugger session lookup.JPDADebugger.listen(com.sun.jdi.connect.ListeningConnector, java.util.Map, java.lang.Object[])
for a more detailed description of this argument.DebuggerStartException
- when DebuggerManager.startDebugging(org.netbeans.api.debugger.DebuggerInfo)
returns an empty arraypublic static DebuggerEngine[] startListeningAndGetEngines(com.sun.jdi.connect.ListeningConnector connector, Map<String,? extends com.sun.jdi.connect.Connector.Argument> args, Object[] services) throws DebuggerStartException
ListeningDICookie
and
DebuggerManager.getDebuggerManager()
.
It's identical to JPDADebugger.startListening(com.sun.jdi.connect.ListeningConnector, java.util.Map, java.lang.Object[])
,
but returns the started engines.connector
- The listening connectorargs
- The argumentsservices
- The additional services, which are added to the debugger session lookup.JPDADebugger.listen(com.sun.jdi.connect.ListeningConnector, java.util.Map, java.lang.Object[])
for a more detailed description of this argument.DebuggerStartException
- when DebuggerManager.startDebugging(org.netbeans.api.debugger.DebuggerInfo)
returns an empty arraypublic static JPDADebugger attach(String hostName, int portNumber, Object[] services) throws DebuggerStartException
AttachingDICookie
and
DebuggerManager.getDebuggerManager()
.hostName
- a name of computer to attach toportNumber
- a port numberservices
- The additional services, which are added to the debugger session lookup.Map
with following setup properties:name
with the value being the session name as String,sourcepath
with the ClassPath
value containing class path of sources used by debugger,jdksources
with the ClassPath
value containing class path of platform sources,listeningCP
optional String representation of source class path which is in compile-on-save mode, which we listen on for artifacts changes,baseDir
with the debugging project's base directory as File
.DebuggerStartException
public static JPDADebugger attach(String name, Object[] services) throws DebuggerStartException
AttachingDICookie
and
DebuggerManager.getDebuggerManager()
.name
- a name of shared memory blockservices
- The additional services, which are added to the debugger session lookup.JPDADebugger.attach(java.lang.String, int, java.lang.Object[])
for a more detailed description of this argument.DebuggerStartException
public abstract int getState()
JPDADebugger.STATE_STARTING
,
JPDADebugger.STATE_RUNNING
,
JPDADebugger.STATE_STOPPED
,
JPDADebugger.STATE_DISCONNECTED
public abstract int getSuspend()
public abstract void setSuspend(int s)
s
- a new value of suspend propertypublic abstract JPDAThread getCurrentThread()
public abstract CallStackFrame getCurrentCallStackFrame()
public abstract Variable evaluate(String expression) throws InvalidExpressionException
expression
- a expression to be evaluatedInvalidExpressionException
public abstract void waitRunning() throws DebuggerStartException
DebuggerStartException
if some problem occurres.DebuggerStartException
- is some problems occurres during debugger
startAbstractDICookie.getVirtualMachine()
public abstract boolean canFixClasses()
true
if this debugger supports fix & continue
(HotSwap).true
if this debugger supports fix & continuepublic abstract boolean canPopFrames()
true
if this debugger supports Pop action.true
if this debugger supports Pop actionpublic boolean canBeModified()
true
if the target debuggee can be modified or when
this information is not available (on JDK 1.4).public abstract void fixClasses(Map<String,byte[]> classes)
classes
- a map from class names to be fixed to byte[]public abstract SmartSteppingFilter getSmartSteppingFilter()
protected void fireBreakpointEvent(JPDABreakpoint breakpoint, JPDABreakpointEvent event)
breakpoint
- a breakpoint to be changedevent
- a event to be firedpublic boolean getBreakpointsActive()
true
when breakpoints are active, false
otherwise. The default implementation returns true
, to be overridden
when needed.public void setBreakpointsActive(boolean active)
JPDADebugger.getBreakpointsActive()
when needed.active
- true
to make all breakpoints active,
false
to make all breakpoints inactive.public abstract void addPropertyChangeListener(PropertyChangeListener l)
l
- new listener.public abstract void removePropertyChangeListener(PropertyChangeListener l)
l
- removed listener.public abstract void addPropertyChangeListener(String propertyName, PropertyChangeListener l)
propertyName
- a name of property to listen onl
- new listener.public abstract void removePropertyChangeListener(String propertyName, PropertyChangeListener l)
propertyName
- a name of property to listen onl
- removed listener.public JPDAStep createJPDAStep(int size, int depth)
JPDAStep
UnsupportedOperationException
- If not overriddenpublic boolean canGetInstanceInfo()
true
when the feature is supported, false
otherwise.JPDADebugger.getInstanceCounts(java.util.List<org.netbeans.api.debugger.jpda.JPDAClassType>)
,
JPDAClassType.getInstanceCount()
,
JPDAClassType.getInstances(long)
,
ObjectVariable.getReferringObjects(long)
public List<JPDAClassType> getAllClasses()
public List<JPDAClassType> getClassesByName(String name)
public Variable createMirrorVar(Object obj) throws InvalidObjectException
obj
- the object to create the mirror fromInvalidObjectException
- when the mirror operation failspublic Variable createMirrorVar(Object obj, boolean isPrimitive) throws InvalidObjectException
obj
- the object to create the mirror fromisPrimitive
- when true
and the object is an encapsulation
of a primitive value, then primitive mirror is created.InvalidObjectException
- when the mirror operation failspublic long[] getInstanceCounts(List<JPDAClassType> classTypes) throws UnsupportedOperationException
JPDADebugger.canGetInstanceInfo()
to determine if this operation is supported.long
containing one instance counts for
each respective element in the classTypes
list.UnsupportedOperationException
public ThreadsCollector getThreadsCollector()
public Session getSession()