/[classpath]/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
ViewVC logotype

Diff of /classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by keiths, Thu Aug 25 22:09:49 2005 UTC revision 1.4 by keiths, Fri Sep 2 20:48:25 2005 UTC
# Line 39  exception statement from your version. * Line 39  exception statement from your version. *
39    
40  package gnu.classpath.jdwp.processor;  package gnu.classpath.jdwp.processor;
41    
 import gnu.classpath.jdwp.Jdwp;  
42  import gnu.classpath.jdwp.JdwpConstants;  import gnu.classpath.jdwp.JdwpConstants;
43    import gnu.classpath.jdwp.VMVirtualMachine;
44  import gnu.classpath.jdwp.exception.JdwpException;  import gnu.classpath.jdwp.exception.JdwpException;
45  import gnu.classpath.jdwp.exception.JdwpInternalErrorException;  import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
46  import gnu.classpath.jdwp.exception.NotImplementedException;  import gnu.classpath.jdwp.exception.NotImplementedException;
# Line 64  import java.util.Properties; Line 64  import java.util.Properties;
64  public class VirtualMachineCommandSet  public class VirtualMachineCommandSet
65    extends CommandSet    extends CommandSet
66  {  {
   // The Jdwp object  
   private final Jdwp jdwp = Jdwp.getDefault();  
   
67    public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)    public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
68      throws JdwpException      throws JdwpException
69    {    {
# Line 180  public class VirtualMachineCommandSet Line 177  public class VirtualMachineCommandSet
177      ArrayList allMatchingClasses = new ArrayList();      ArrayList allMatchingClasses = new ArrayList();
178    
179      // This will be an Iterator over all loaded Classes      // This will be an Iterator over all loaded Classes
180      Iterator iter = vm.getAllLoadedClasses();      Iterator iter = VMVirtualMachine.getAllLoadedClasses();
181    
182      while (iter.hasNext())      while (iter.hasNext())
183        {        {
# Line 196  public class VirtualMachineCommandSet Line 193  public class VirtualMachineCommandSet
193          Class clazz = (Class) allMatchingClasses.get(i);          Class clazz = (Class) allMatchingClasses.get(i);
194          ReferenceTypeId id = idMan.getReferenceTypeId(clazz);          ReferenceTypeId id = idMan.getReferenceTypeId(clazz);
195          id.writeTagged(os);          id.writeTagged(os);
196          int status = vm.getStatus(clazz);          int status = VMVirtualMachine.getClassStatus(clazz);
197          os.writeInt(status);          os.writeInt(status);
198        }        }
199    }    }
# Line 207  public class VirtualMachineCommandSet Line 204  public class VirtualMachineCommandSet
204      // Disable garbage collection while we're collecting the info on loaded      // Disable garbage collection while we're collecting the info on loaded
205      // classes so we some classes don't get collected between the time we get      // classes so we some classes don't get collected between the time we get
206      // the count and the time we get the list      // the count and the time we get the list
207      vm.disableGarbageCollection();      //VMVirtualMachine.disableGarbageCollection();
208    
209      int classCount = vm.getAllLoadedClassesCount();      int classCount = VMVirtualMachine.getAllLoadedClassesCount();
210      os.writeInt(classCount);      os.writeInt(classCount);
211    
212      // This will be an Iterator over all loaded Classes      // This will be an Iterator over all loaded Classes
213      Iterator iter = vm.getAllLoadedClasses();      Iterator iter = VMVirtualMachine.getAllLoadedClasses();
214      vm.enableGarbageCollection();      //VMVirtualMachine.enableGarbageCollection();
215      int count = 0;      int count = 0;
216    
217      // Note it's possible classes were created since out classCount so make      // Note it's possible classes were created since out classCount so make
# Line 226  public class VirtualMachineCommandSet Line 223  public class VirtualMachineCommandSet
223          id.writeTagged(os);          id.writeTagged(os);
224          String sig = Signature.computeClassSignature(clazz);          String sig = Signature.computeClassSignature(clazz);
225          JdwpString.writeString(os, sig);          JdwpString.writeString(os, sig);
226          int status = vm.getStatus(clazz);          int status = VMVirtualMachine.getClassStatus(clazz);
227          os.writeInt(status);          os.writeInt(status);
228        }        }
229    }    }
# Line 270  public class VirtualMachineCommandSet Line 267  public class VirtualMachineCommandSet
267    private void executeTopLevelThreadGroups(ByteBuffer bb, DataOutputStream os)    private void executeTopLevelThreadGroups(ByteBuffer bb, DataOutputStream os)
268      throws JdwpException, IOException      throws JdwpException, IOException
269    {    {
270      ThreadGroup jdwpGroup = jdwp.getJdwpThreadGroup();      ThreadGroup jdwpGroup = Thread.currentThread().getThreadGroup ();
271      ThreadGroup root = getRootThreadGroup(jdwpGroup);      ThreadGroup root = getRootThreadGroup(jdwpGroup);
272    
273      os.writeInt(1); // Just one top level group allowed?      os.writeInt(1); // Just one top level group allowed?
# Line 284  public class VirtualMachineCommandSet Line 281  public class VirtualMachineCommandSet
281      // suspended multiple times, we likely need a way to keep track of how many      // suspended multiple times, we likely need a way to keep track of how many
282      // times a thread has been suspended or else a stronger resume method for      // times a thread has been suspended or else a stronger resume method for
283      // this purpose      // this purpose
284      // vm.resumeAllThreadsExcept(jdwp.getJdwpThreadGroup());      // VMVirtualMachine.resumeAllThreads ();
285    
286      // Simply shutting down the jdwp layer will take care of the rest of the      // Simply shutting down the jdwp layer will take care of the rest of the
287      // shutdown other than disabling debugging in the VM      // shutdown other than disabling debugging in the VM
288      // vm.disableDebugging();      // VMVirtualMachine.disableDebugging();
289    
290      // Don't implement this until we're sure how to remove all the debugging      // Don't implement this until we're sure how to remove all the debugging
291      // effects from the VM.      // effects from the VM.
# Line 311  public class VirtualMachineCommandSet Line 308  public class VirtualMachineCommandSet
308    private void executeSuspend(ByteBuffer bb, DataOutputStream os)    private void executeSuspend(ByteBuffer bb, DataOutputStream os)
309      throws JdwpException      throws JdwpException
310    {    {
311      vm.suspendAllThreadsExcept(jdwp.getJdwpThreadGroup());      VMVirtualMachine.suspendAllThreads ();
312    }    }
313    
314    private void executeResume(ByteBuffer bb, DataOutputStream os)    private void executeResume(ByteBuffer bb, DataOutputStream os)
315      throws JdwpException      throws JdwpException
316    {    {
317      vm.resumeAllThreadsExcept(jdwp.getJdwpThreadGroup());      VMVirtualMachine.resumeAllThreads ();
318    }    }
319    
320    private void executeExit(ByteBuffer bb, DataOutputStream os)    private void executeExit(ByteBuffer bb, DataOutputStream os)
321      throws JdwpException, IOException      throws JdwpException, IOException
322    {    {
323      int exitCode = bb.getInt();      int exitCode = bb.getInt();
324      jdwp.setExit(exitCode);      System.exit (exitCode);
325    }    }
326    
327    private void executeCreateString(ByteBuffer bb, DataOutputStream os)    private void executeCreateString(ByteBuffer bb, DataOutputStream os)

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26