diff options
| author | Keith Seitz <keiths@redhat.com> | 2005-08-25 22:09:48 +0000 |
|---|---|---|
| committer | Keith Seitz <keiths@redhat.com> | 2005-08-25 22:09:48 +0000 |
| commit | 22856b8f2a463df5d4fabbe7f2758f4c3069b81c (patch) | |
| tree | a9e1e0bdd83a92981cfc2de8b2b2c099da10ad14 /gnu | |
| parent | 1464bb4c918e172a986f35721aa19c61db3cdaad (diff) | |
| download | classpath-22856b8f2a463df5d4fabbe7f2758f4c3069b81c.tar.gz | |
* gnu/classpath/jdwp/processor/CommandSet.java (CommandSet): Make
an abstract class.
Add protected variables for VMIdManager and VMVirtualMachine.
(runCommand): Make abstract.
* gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
(ArrayReferenceCommandSet): Derive from CommandSet instead of
implementing it. Remove private hooks to ID manager and VM.
Update all VMIdManager and EventManager API calls.
* gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
(ArrayTypeCommandSet): Likewise.
* gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
(ClassLoaderReferenceCommandSet): Likewise.
* gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java
(ClassObjectReferenceCommandSet): Likewise.
* gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
(ClassTypeCommandSet): Likewise.
* gnu/classpath/jdwp/processor/EventRequestCommandSet.java
(EventRequestCommandSet): Likewise.
* gnu/classpath/jdwp/processor/FieldCommandSet.java
(FieldCommandSet): Likewise.
* gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java
(InterfaceTypeCommandSet): Likewise.
* gnu/classpath/jdwp/processor/MethodCommandSet.java
(MethodCommandSet): Likewise.
* gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
(ObjectReferenceCommandSet): Likewise.
* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
(ReferenceTypeCommandSet): Likewise.
* gnu/classpath/jdwp/processor/StackFrameCommandSet.java
(StackFrameCommandSet): Likewise.
* gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
(StringReferenceCommandSet): Likewise.
* gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
(ThreadGroupReferenceCommandSet.java): Likewise.
* gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
(ThreadReferenceCommandSet): Likewise.
* gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
(VirtualMachineCommandSet): Likewise.
* gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
(executeStatus): Fix constant name.
* gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
(executeDisposeObjects): Don't do anything yet -- this
is unimplemented.
Diffstat (limited to 'gnu')
17 files changed, 115 insertions, 191 deletions
diff --git a/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java index ffe709b83..247021662 100644 --- a/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java @@ -40,13 +40,11 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.InvalidObjectException; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.util.Value; @@ -60,11 +58,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ArrayReferenceCommandSet implements CommandSet +public class ArrayReferenceCommandSet + extends CommandSet { - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -98,7 +94,7 @@ public class ArrayReferenceCommandSet implements CommandSet private void executeLength(ByteBuffer bb, DataOutputStream os) throws InvalidObjectException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Object array = oid.getObject(); os.writeInt(Array.getLength(array)); } @@ -106,7 +102,7 @@ public class ArrayReferenceCommandSet implements CommandSet private void executeGetValues(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Object array = oid.getObject(); int first = bb.getInt(); int length = bb.getInt(); @@ -164,7 +160,7 @@ public class ArrayReferenceCommandSet implements CommandSet private void executeSetValues(ByteBuffer bb, DataOutputStream os) throws IOException, JdwpException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Object array = oid.getObject(); int first = bb.getInt(); int length = bb.getInt(); diff --git a/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java b/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java index 91eba6183..8ae1b4508 100644 --- a/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java +++ b/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java @@ -38,12 +38,10 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; @@ -57,11 +55,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ArrayTypeCommandSet implements CommandSet +public class ArrayTypeCommandSet + extends CommandSet { - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -98,7 +94,7 @@ public class ArrayTypeCommandSet implements CommandSet int length = bb.getInt(); Object newArray = Array.newInstance(componentType, length); - ObjectId oid = idMan.getId(newArray); + ObjectId oid = idMan.getObjectId(newArray); // Since this array isn't referenced anywhere we'll disable garbage // collection on it so it's still around when the debugger gets back to it. diff --git a/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java index 86cb18418..a7b415a60 100644 --- a/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java @@ -40,13 +40,10 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.IVirtualMachine; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; @@ -61,14 +58,9 @@ import java.util.Iterator; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ClassLoaderReferenceCommandSet implements CommandSet +public class ClassLoaderReferenceCommandSet + extends CommandSet { - // Our hook into the jvm - private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); - - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -99,7 +91,7 @@ public class ClassLoaderReferenceCommandSet implements CommandSet public void executeVisibleClasses(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oId = idMan.readId(bb); + ObjectId oId = idMan.readObjectId(bb); ClassLoader cl = (ClassLoader) oId.getObject(); ArrayList loadRequests = vm.getLoadRequests(cl); os.writeInt(loadRequests.size()); diff --git a/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java index f219f2290..dcafa6f84 100644 --- a/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java @@ -39,12 +39,10 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; @@ -57,11 +55,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ClassObjectReferenceCommandSet implements CommandSet +public class ClassObjectReferenceCommandSet + extends CommandSet { - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -89,7 +85,7 @@ public class ClassObjectReferenceCommandSet implements CommandSet public void executeReflectedType(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Class clazz = (Class) oid.getObject(); // The difference between a ClassObjectId and a ReferenceTypeId is one is diff --git a/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java b/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java index 1dea24f0b..27945911a 100644 --- a/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java +++ b/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java @@ -40,14 +40,11 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.IVirtualMachine; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.InvalidFieldException; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; import gnu.classpath.jdwp.util.MethodResult; @@ -64,14 +61,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ClassTypeCommandSet implements CommandSet +public class ClassTypeCommandSet + extends CommandSet { - // Our hook into the jvm - private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); - - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -128,7 +120,7 @@ public class ClassTypeCommandSet implements CommandSet for (int i = 0; i < numValues; i++) { - ObjectId fieldId = idMan.readId(bb); + ObjectId fieldId = idMan.readObjectId(bb); Field field = (Field) (fieldId.getObject()); Object value = Value.getUntaggedObj(bb, field.getType()); try @@ -154,7 +146,7 @@ public class ClassTypeCommandSet implements CommandSet Object value = mr.getReturnedValue(); Exception exception = mr.getThrownException(); - ObjectId eId = idMan.getId(exception); + ObjectId eId = idMan.getObjectId(exception); Value.writeTaggedValue(os, value); eId.writeTagged(os); @@ -166,9 +158,9 @@ public class ClassTypeCommandSet implements CommandSet MethodResult mr = invokeMethod(bb); Object obj = mr.getReturnedValue(); - ObjectId oId = idMan.getId(obj); + ObjectId oId = idMan.getObjectId(obj); Exception exception = mr.getThrownException(); - ObjectId eId = idMan.getId(exception); + ObjectId eId = idMan.getObjectId(exception); oId.writeTagged(os); eId.writeTagged(os); @@ -183,10 +175,10 @@ public class ClassTypeCommandSet implements CommandSet ReferenceTypeId refId = idMan.readReferenceTypeId(bb); Class clazz = refId.getType(); - ObjectId tId = idMan.readId(bb); + ObjectId tId = idMan.readObjectId(bb); Thread thread = (Thread) tId.getObject(); - ObjectId mId = idMan.readId(bb); + ObjectId mId = idMan.readObjectId(bb); Method method = (Method) mId.getObject(); int args = bb.getInt(); diff --git a/gnu/classpath/jdwp/processor/CommandSet.java b/gnu/classpath/jdwp/processor/CommandSet.java index 5588c5abc..43fff7130 100644 --- a/gnu/classpath/jdwp/processor/CommandSet.java +++ b/gnu/classpath/jdwp/processor/CommandSet.java @@ -40,6 +40,8 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; import gnu.classpath.jdwp.exception.JdwpException; +import gnu.classpath.jdwp.VMIdManager; +import gnu.classpath.jdwp.VMVirtualMachine; import java.io.DataOutputStream; import java.nio.ByteBuffer; @@ -50,9 +52,19 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public interface CommandSet +public abstract class CommandSet { /** + * The VM's ID manager + */ + protected final VMIdManager idMan = VMIdManager.getDefault (); + + /** + * The virtual machine description + */ + protected final VMVirtualMachine vm = VMVirtualMachine.getDefault (); + + /** * Runs the given command with the data in distr and writes the data for the * reply packet to ostr. * @@ -62,7 +74,7 @@ public interface CommandSet * @return true if the JDWP layer should shut down in response to this packet * @throws JdwpException command wasn't carried out successfully */ - public boolean runCommand(ByteBuffer bb, DataOutputStream os, - byte command) + public abstract boolean runCommand(ByteBuffer bb, DataOutputStream os, + byte command) throws JdwpException; } diff --git a/gnu/classpath/jdwp/processor/EventRequestCommandSet.java b/gnu/classpath/jdwp/processor/EventRequestCommandSet.java index b2eb2ea7b..fa67669cf 100644 --- a/gnu/classpath/jdwp/processor/EventRequestCommandSet.java +++ b/gnu/classpath/jdwp/processor/EventRequestCommandSet.java @@ -39,7 +39,6 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.event.EventManager; import gnu.classpath.jdwp.event.EventRequest; @@ -58,7 +57,6 @@ import gnu.classpath.jdwp.event.filters.ThreadFilter; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; import gnu.classpath.jdwp.id.ThreadId; @@ -75,14 +73,9 @@ import java.util.Iterator; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class EventRequestCommandSet implements CommandSet +public class EventRequestCommandSet + extends CommandSet { - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - - // The Event Manager - private final EventManager evMan = Jdwp.getDefault().getEventManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -132,10 +125,10 @@ public class EventRequestCommandSet implements CommandSet filter = new CountFilter(bb.getInt()); break; case 2: - filter = new ConditionalFilter(idMan.readId(bb)); + filter = new ConditionalFilter(idMan.readObjectId(bb)); break; case 3: - filter = new ThreadFilter((ThreadId) idMan.readId(bb)); + filter = new ThreadFilter((ThreadId) idMan.readObjectId(bb)); break; case 4: filter = new ClassOnlyFilter(idMan.readReferenceTypeId(bb)); @@ -165,13 +158,13 @@ public class EventRequestCommandSet implements CommandSet filter = new FieldOnlyFilter(refId, fieldId); break; case 10: - ObjectId tid = idMan.readId(bb); + ObjectId tid = idMan.readObjectId(bb); int size = bb.getInt(); int depth = bb.getInt(); filter = new StepFilter(tid, size, depth); break; case 11: - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); filter = new InstanceOnlyFilter(oid.getObject()); break; default: @@ -180,7 +173,8 @@ public class EventRequestCommandSet implements CommandSet } eventReq.addFilter(filter); } - evMan.requestEvent(eventReq); + + EventManager.getDefault().requestEvent(eventReq); os.writeInt(eventReq.getId()); } @@ -190,19 +184,14 @@ public class EventRequestCommandSet implements CommandSet { byte eventKind = bb.get(); int requestId = bb.getInt(); - EventRequest request = evMan.getRequest(eventKind, requestId); - evMan.deleteRequest(request); + EventManager.getDefault().deleteRequest(eventKind, requestId); } private void executeClearAllBreakpoints(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - Iterator evReqIter = evMan.getAllRequests(EventRequest.EVENT_BREAKPOINT); - while (evReqIter.hasNext()) - { - EventRequest evReq = (EventRequest) evReqIter.next(); - evMan.deleteRequest(evReq); - } + byte eventKind = bb.get (); + EventManager.getDefault().clearRequests (eventKind); } } diff --git a/gnu/classpath/jdwp/processor/FieldCommandSet.java b/gnu/classpath/jdwp/processor/FieldCommandSet.java index f14635b91..090770038 100644 --- a/gnu/classpath/jdwp/processor/FieldCommandSet.java +++ b/gnu/classpath/jdwp/processor/FieldCommandSet.java @@ -49,7 +49,8 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class FieldCommandSet implements CommandSet +public class FieldCommandSet + extends CommandSet { /** * There are no commands for this CommandSet at this time so we just throw a diff --git a/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java b/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java index a32da38b3..5b29182ec 100644 --- a/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java +++ b/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java @@ -50,7 +50,8 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class InterfaceTypeCommandSet implements CommandSet +public class InterfaceTypeCommandSet + extends CommandSet { /** * There are no commands for this CommandSet at this time so we just throw a diff --git a/gnu/classpath/jdwp/processor/MethodCommandSet.java b/gnu/classpath/jdwp/processor/MethodCommandSet.java index 952b94a55..a30d2c687 100644 --- a/gnu/classpath/jdwp/processor/MethodCommandSet.java +++ b/gnu/classpath/jdwp/processor/MethodCommandSet.java @@ -38,13 +38,10 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.IVirtualMachine; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; import gnu.classpath.jdwp.util.LineTable; @@ -60,14 +57,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class MethodCommandSet implements CommandSet +public class MethodCommandSet + extends CommandSet { - // Our hook into the jvm - private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); - - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -110,7 +102,7 @@ public class MethodCommandSet implements CommandSet ReferenceTypeId refId = idMan.readReferenceTypeId(bb); Class clazz = refId.getType(); - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Method method = (Method) oid.getObject(); LineTable lt = vm.getLineTable(clazz, method); @@ -123,7 +115,7 @@ public class MethodCommandSet implements CommandSet ReferenceTypeId refId = idMan.readReferenceTypeId(bb); Class clazz = refId.getType(); - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Method method = (Method) oid.getObject(); VariableTable vt = vm.getVarTable(clazz, method); diff --git a/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java index 31f629ffe..ca7b5696a 100644 --- a/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java @@ -39,14 +39,11 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.IVirtualMachine; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.InvalidFieldException; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; import gnu.classpath.jdwp.util.Value; @@ -63,14 +60,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ObjectReferenceCommandSet implements CommandSet +public class ObjectReferenceCommandSet + extends CommandSet { - // Our hook into the jvm - private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); - - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -119,7 +111,7 @@ public class ObjectReferenceCommandSet implements CommandSet private void executeReferenceType(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Object obj = oid.getObject(); Class clazz = obj.getClass(); ReferenceTypeId refId = idMan.getReferenceTypeId(clazz); @@ -129,7 +121,7 @@ public class ObjectReferenceCommandSet implements CommandSet private void executeGetValues(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Object obj = oid.getObject(); int numFields = bb.getInt(); @@ -138,7 +130,7 @@ public class ObjectReferenceCommandSet implements CommandSet for (int i = 0; i < numFields; i++) { - Field field = (Field) idMan.readId(bb).getObject(); + Field field = (Field) idMan.readObjectId(bb).getObject(); try { field.setAccessible(true); // Might be a private field @@ -161,14 +153,14 @@ public class ObjectReferenceCommandSet implements CommandSet private void executeSetValues(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Object obj = oid.getObject(); int numFields = bb.getInt(); for (int i = 0; i < numFields; i++) { - Field field = (Field) idMan.readId(bb).getObject(); + Field field = (Field) idMan.readObjectId(bb).getObject(); Object value = Value.getUntaggedObj(bb, field.getType()); try { @@ -201,16 +193,16 @@ public class ObjectReferenceCommandSet implements CommandSet private void executeInvokeMethod(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); Object obj = oid.getObject(); - ObjectId tid = idMan.readId(bb); + ObjectId tid = idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); ReferenceTypeId rid = idMan.readReferenceTypeId(bb); Class clazz = rid.getType(); - ObjectId mid = idMan.readId(bb); + ObjectId mid = idMan.readObjectId(bb); Method method = (Method) mid.getObject(); int args = bb.getInt(); @@ -237,7 +229,7 @@ public class ObjectReferenceCommandSet implements CommandSet Object value = mr.getReturnedValue(); Exception exception = mr.getThrownException(); - ObjectId eId = idMan.getId(exception); + ObjectId eId = idMan.getObjectId(exception); Value.writeTaggedValue(os, value); eId.writeTagged(os); } @@ -245,22 +237,22 @@ public class ObjectReferenceCommandSet implements CommandSet private void executeDisableCollection(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); oid.disableCollection(); } private void executeEnableCollection(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); oid.enableCollection(); } private void executeIsCollected(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); - boolean collected = oid.isCollected(); + ObjectId oid = idMan.readObjectId(bb); + boolean collected = (oid.getReference().get () == null); os.writeBoolean(collected); } } diff --git a/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java b/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java index 4c74db333..be778dbb5 100644 --- a/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java +++ b/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java @@ -39,14 +39,11 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.IVirtualMachine; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.InvalidFieldException; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; import gnu.classpath.jdwp.util.JdwpString; @@ -64,14 +61,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ReferenceTypeCommandSet implements CommandSet +public class ReferenceTypeCommandSet + extends CommandSet { - // Our hook into the jvm - private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); - - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -153,7 +145,7 @@ public class ReferenceTypeCommandSet implements CommandSet Class clazz = refId.getType(); ClassLoader loader = clazz.getClassLoader(); - ObjectId oid = idMan.getId(loader); + ObjectId oid = idMan.getObjectId(loader); oid.write(os); } @@ -177,7 +169,7 @@ public class ReferenceTypeCommandSet implements CommandSet for (int i = 0; i < fields.length; i++) { Field field = fields[i]; - idMan.getId(field).write(os); + idMan.getObjectId(field).write(os); JdwpString.writeString(os, field.getName()); JdwpString.writeString(os, Signature.computeFieldSignature(field)); os.writeInt(field.getModifiers()); @@ -195,7 +187,7 @@ public class ReferenceTypeCommandSet implements CommandSet for (int i = 0; i < methods.length; i++) { Method method = methods[i]; - idMan.getId(method).write(os); + idMan.getObjectId(method).write(os); JdwpString.writeString(os, method.getName()); JdwpString.writeString(os, Signature.computeMethodSignature(method)); os.writeInt(method.getModifiers()); @@ -212,7 +204,7 @@ public class ReferenceTypeCommandSet implements CommandSet os.writeInt(numFields); // Looks pointless but this is the protocol for (int i = 0; i < numFields; i++) { - ObjectId fieldId = idMan.readId(bb); + ObjectId fieldId = idMan.readObjectId(bb); Field field = (Field) (fieldId.getObject()); Class fieldClazz = field.getDeclaringClass(); @@ -300,7 +292,7 @@ public class ReferenceTypeCommandSet implements CommandSet { ReferenceTypeId refId = idMan.readReferenceTypeId(bb); Class clazz = refId.getType(); - ObjectId clazzObjectId = idMan.getId(clazz); + ObjectId clazzObjectId = idMan.getObjectId(clazz); clazzObjectId.write(os); } diff --git a/gnu/classpath/jdwp/processor/StackFrameCommandSet.java b/gnu/classpath/jdwp/processor/StackFrameCommandSet.java index 20db6e3b7..5f3d3e32f 100644 --- a/gnu/classpath/jdwp/processor/StackFrameCommandSet.java +++ b/gnu/classpath/jdwp/processor/StackFrameCommandSet.java @@ -40,13 +40,10 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; import gnu.classpath.jdwp.VMFrame; -import gnu.classpath.jdwp.IVirtualMachine; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.util.Value; @@ -59,14 +56,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class StackFrameCommandSet implements CommandSet +public class StackFrameCommandSet + extends CommandSet { - // Our hook into the jvm - private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); - - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -104,7 +96,7 @@ public class StackFrameCommandSet implements CommandSet private void executeGetValues(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId tId = idMan.readId(bb); + ObjectId tId = idMan.readObjectId(bb); Thread thread = (Thread) tId.getObject(); // Although Frames look like other ids they are not. First they are not @@ -128,7 +120,7 @@ public class StackFrameCommandSet implements CommandSet private void executeSetValues(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId tId = idMan.readId(bb); + ObjectId tId = idMan.readObjectId(bb); Thread thread = (Thread) tId.getObject(); VMFrame frame = vm.getVMFrame(thread, bb); @@ -145,7 +137,7 @@ public class StackFrameCommandSet implements CommandSet private void executeThisObject(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId tId = idMan.readId(bb); + ObjectId tId = idMan.readObjectId(bb); Thread thread = (Thread) tId.getObject(); VMFrame frame = vm.getVMFrame(thread, bb); diff --git a/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java b/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java index 74b89a218..8f5bc685c 100644 --- a/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java @@ -40,7 +40,6 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; @@ -57,7 +56,8 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class StringReferenceCommandSet implements CommandSet +public class StringReferenceCommandSet + extends CommandSet { public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) @@ -90,7 +90,7 @@ public class StringReferenceCommandSet implements CommandSet private void executeValue(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = Jdwp.getIdManager().readId(bb); + ObjectId oid = idMan.readObjectId(bb); String str = (String) oid.getObject(); JdwpString.writeString(os, str); diff --git a/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java index 28ff860c0..8a11195a7 100644 --- a/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java @@ -39,12 +39,10 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.util.JdwpString; @@ -57,11 +55,9 @@ import java.nio.ByteBuffer; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ThreadGroupReferenceCommandSet implements CommandSet +public class ThreadGroupReferenceCommandSet + extends CommandSet { - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -95,7 +91,7 @@ public class ThreadGroupReferenceCommandSet implements CommandSet private void executeName(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); ThreadGroup group = (ThreadGroup) oid.getObject(); JdwpString.writeString(os, group.getName()); } @@ -103,17 +99,17 @@ public class ThreadGroupReferenceCommandSet implements CommandSet private void executeParent(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); ThreadGroup group = (ThreadGroup) oid.getObject(); ThreadGroup parent = group.getParent(); - ObjectId parentId = idMan.getId(parent); + ObjectId parentId = idMan.getObjectId(parent); parentId.write(os); } private void executeChildren(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ObjectId oid = idMan.readId(bb); + ObjectId oid = idMan.readObjectId(bb); ThreadGroup group = (ThreadGroup) oid.getObject(); ThreadGroup jdwpGroup = Thread.currentThread().getThreadGroup(); @@ -143,7 +139,7 @@ public class ThreadGroupReferenceCommandSet implements CommandSet if (thread == null) break; // No threads after this point if (!thread.getThreadGroup().equals(jdwpGroup)) - idMan.getId(thread).write(os); + idMan.getObjectId(thread).write(os); } int numGroups = group.activeCount(); @@ -172,7 +168,7 @@ public class ThreadGroupReferenceCommandSet implements CommandSet if (tgroup == null) break; // No ThreadGroups after this point if (!tgroup.equals(jdwpGroup)) - idMan.getId(tgroup).write(os); + idMan.getObjectId(tgroup).write(os); } } } diff --git a/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java b/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java index cb02a5ea8..dbb197c4a 100644 --- a/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java +++ b/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java @@ -40,14 +40,11 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; import gnu.classpath.jdwp.VMFrame; -import gnu.classpath.jdwp.IVirtualMachine; -import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.InvalidObjectException; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ThreadId; import gnu.classpath.jdwp.util.JdwpString; @@ -63,14 +60,9 @@ import java.util.ArrayList; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class ThreadReferenceCommandSet implements CommandSet +public class ThreadReferenceCommandSet + extends CommandSet { - // Our hook into the jvm - private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); - - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) throws JdwpException { @@ -131,7 +123,7 @@ public class ThreadReferenceCommandSet implements CommandSet private void executeName(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); JdwpString.writeString(os, thread.getName()); } @@ -139,7 +131,7 @@ public class ThreadReferenceCommandSet implements CommandSet private void executeSuspend(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); vm.suspendThread(thread); } @@ -147,7 +139,7 @@ public class ThreadReferenceCommandSet implements CommandSet private void executeResume(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); vm.suspendThread(thread); } @@ -155,11 +147,11 @@ public class ThreadReferenceCommandSet implements CommandSet private void executeStatus(ByteBuffer bb, DataOutputStream os) throws InvalidObjectException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); int threadStatus = vm.getThreadStatus(thread); // There's only one possible SuspendStatus... - int suspendStatus = JdwpConstants.SuspendStatus.SUSPEND_STATUS_SUSPENDED; + int suspendStatus = JdwpConstants.SuspendStatus.SUSPENDED; os.writeInt(threadStatus); os.writeInt(suspendStatus); @@ -168,17 +160,17 @@ public class ThreadReferenceCommandSet implements CommandSet private void executeThreadGroup(ByteBuffer bb, DataOutputStream os) throws InvalidObjectException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); ThreadGroup group = thread.getThreadGroup(); - ObjectId groupId = idMan.getId(group); + ObjectId groupId = idMan.getObjectId(group); groupId.write(os); } private void executeFrames(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); int startFrame = bb.getInt(); int length = bb.getInt(); @@ -197,7 +189,7 @@ public class ThreadReferenceCommandSet implements CommandSet private void executeFrameCount(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); int frameCount = vm.getFrameCount(thread); @@ -226,16 +218,16 @@ public class ThreadReferenceCommandSet implements CommandSet private void executeStop(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); - ObjectId exception = idMan.readId(bb); + ObjectId exception = idMan.readObjectId(bb); vm.stopThread(thread, (Exception) exception.getObject()); } private void executeInterrupt(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); thread.interrupt(); } @@ -243,7 +235,7 @@ public class ThreadReferenceCommandSet implements CommandSet private void executeSuspendCount(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { - ThreadId tid = (ThreadId) idMan.readId(bb); + ThreadId tid = (ThreadId) idMan.readObjectId(bb); Thread thread = (Thread) tid.getObject(); int suspendCount = vm.getSuspendCount(thread); os.writeInt(suspendCount); diff --git a/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java b/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java index 938e1e060..368534ebd 100644 --- a/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java +++ b/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java @@ -39,13 +39,11 @@ exception statement from your version. */ package gnu.classpath.jdwp.processor; -import gnu.classpath.jdwp.IVirtualMachine; import gnu.classpath.jdwp.Jdwp; import gnu.classpath.jdwp.JdwpConstants; import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpInternalErrorException; import gnu.classpath.jdwp.exception.NotImplementedException; -import gnu.classpath.jdwp.id.IdManager; import gnu.classpath.jdwp.id.ObjectId; import gnu.classpath.jdwp.id.ReferenceTypeId; import gnu.classpath.jdwp.util.JdwpString; @@ -63,14 +61,9 @@ import java.util.Properties; * * @author Aaron Luchko <aluchko@redhat.com> */ -public class VirtualMachineCommandSet implements CommandSet +public class VirtualMachineCommandSet + extends CommandSet { - // Our hook into the jvm - private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); - - // Manages all the different ids that are assigned by jdwp - private final IdManager idMan = Jdwp.getIdManager(); - // The Jdwp object private final Jdwp jdwp = Jdwp.getDefault(); @@ -270,7 +263,7 @@ public class VirtualMachineCommandSet implements CommandSet if (thread == null) break; // No threads after this point if (!thread.getThreadGroup().equals(jdwpGroup)) - idMan.getId(thread).write(os); + idMan.getObjectId(thread).write(os); } } @@ -281,7 +274,7 @@ public class VirtualMachineCommandSet implements CommandSet ThreadGroup root = getRootThreadGroup(jdwpGroup); os.writeInt(1); // Just one top level group allowed? - idMan.getId(root); + idMan.getObjectId(root); } private void executeDispose(ByteBuffer bb, DataOutputStream os) @@ -338,7 +331,7 @@ public class VirtualMachineCommandSet implements CommandSet throws JdwpException, IOException { String string = JdwpString.readString(bb); - ObjectId stringId = Jdwp.getIdManager().getId(string); + ObjectId stringId = idMan.getObjectId(string); // Since this string isn't referenced anywhere we'll disable garbage // collection on it so it's still around when the debugger gets back to it. @@ -386,7 +379,7 @@ public class VirtualMachineCommandSet implements CommandSet { // Instead of going through the list of objects they give us it's probably // better just to find the garbage collected objects ourselves - idMan.update(); + //idMan.update(); } private void executeHoldEvents(ByteBuffer bb, DataOutputStream os) |
