Package javax.tools.diagnostics.image

Examples of javax.tools.diagnostics.image.ImageProcess


 
    // get image  process

   
    ImageProcess process=getProcess();
   
    // get environment
 
      Properties properties=process.getEnvironment();
      String value=properties.getProperty(SetupEnvironmentVariables.KEY1);
      assertEquals(SetupEnvironmentVariables.VALUE,value);
   

 
View Full Code Here


 
    // get image  process

   
    ImageProcess process=getProcess();
   
    // get environment
 
      Properties properties=process.getEnvironment();
      String value=properties.getProperty(SetupEnvironmentVariables.KEY2);
      assertEquals("key2 value should be empty String","",value);
     

 
View Full Code Here

 
    // get image  process

   
    ImageProcess process=getProcess();
   
    // get environment
 
      Properties properties=process.getEnvironment();
      String value=properties.getProperty(SetupEnvironmentVariables.KEY3);
      System.out.println("KEY3 "+SetupEnvironmentVariables.KEY3+" value \""+value+"\"");
      assertNull(value);
     
View Full Code Here

  private ImageProcess getProcess() {
   
    Image image=getImage();
    Iterator addressIterator=image.getAddressSpaces().iterator();
    ImageAddressSpace addressSpace=(ImageAddressSpace) addressIterator.next();
    ImageProcess process=addressSpace.getCurrentProcess();
    return process;
  }
View Full Code Here

    while ( asIt.hasNext( ) )
    {
      ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
      Iterator prIt = as.getProcesses( ).iterator();
      while ( prIt.hasNext( ) ){
        ImageProcess process = (ImageProcess) prIt.next( );

        Iterator runTimesIt = process.getRuntimes( ).iterator();
        while ( runTimesIt.hasNext( ) )
        {
          JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
          List<JavaMonitor> jms = javaRT.getMonitors();
          for (JavaMonitor jm: jms){
View Full Code Here

    while ( asIt.hasNext( ) )
    {
      ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
      Iterator prIt = as.getProcesses( ).iterator();
      while ( prIt.hasNext( ) ){
        ImageProcess process = (ImageProcess) prIt.next( );

        Iterator runTimesIt = process.getRuntimes( ).iterator();
        while ( runTimesIt.hasNext( ) )
        {
          JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
          Iterator classLoaders = javaRT.getJavaClassLoaders().iterator();
          while (classLoaders.hasNext()){
View Full Code Here

      ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
      Iterator prIt = as.getProcesses( ).iterator();

      while ( prIt.hasNext( ) )
      {
        ImageProcess process = (ImageProcess) prIt.next( );
        Iterator runTimesIt = process.getRuntimes( ).iterator();
        while ( runTimesIt.hasNext( ) )
        {
          JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
          Iterator thds = javaRT.getThreads().iterator();
          while(thds.hasNext()){
View Full Code Here

      ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
      Iterator prIt = as.getProcesses( ).iterator();

      while ( prIt.hasNext( ) )
      {
        ImageProcess process = (ImageProcess) prIt.next( );
        Iterator runTimesIt = process.getRuntimes( ).iterator();
        while ( runTimesIt.hasNext( ) )
        {
          JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
          Iterator thds = javaRT.getThreads().iterator();
          while(thds.hasNext()){
View Full Code Here

      while ( asIt.hasNext( ) )
      {
        ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
        Iterator prIt = as.getProcesses( ).iterator();
        while ( prIt.hasNext( ) ){
          ImageProcess process = (ImageProcess) prIt.next( );

          Iterator runTimesIt = process.getRuntimes( ).iterator();
          while ( runTimesIt.hasNext( ) )
          {
            JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
            //Since there doesn't seem to be a matching Kato call to get
            //the information for JDWP, lets call NOT_IMPLEMENTED, but really
            //attach some information back
            ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
            String description = "JDI Post Mortem Debugger"; //$NON-NLS-1$
            String vmVersion = javaRT.getVersion();
            String vmName = "JDI PMD"; //$NON-NLS-1$

            int jdwpMajor = 1;
            int jdwpMinor = 4;

            //We now have all the information for the reply.  Put it all together
            Vector<Byte> vctr = new Vector<Byte>();
            addStringToVector(vctr, description);
            addIntToVector(vctr, jdwpMajor);
            addIntToVector(vctr, jdwpMinor);
            addStringToVector(vctr, vmVersion);
            addStringToVector(vctr, vmName);
            rpckt.setData(vectorToByte(vctr));
            return rpckt;

          }
        }
      }

    }else if (cpckt.getCommand() == VIRTUAL_MACHINE_CLASS_PATHS){
     
      logr.log(JDILogger.LEVEL_VERYVERBOSE, "This does not return the actual class path, simply allows JDB to work.");
      Vector<Byte> vctr = new Vector<Byte>();
      addStringToVector(vctr, "");
      addIntToVector(vctr, 0);
      addIntToVector(vctr, 0);
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
      rpckt.setData(vectorToByte(vctr));
      return rpckt;
    } else if (cpckt.getCommand() == VIRTUAL_MACHINE_CLASSES_BY_SIGNATURE){
      Vector<Byte> vctr = new Vector<Byte>();
      byte []inData = cpckt.getByteData();
      String signature = getStringFromBytes(inData, 0);
      if (signature.charAt(0) == 'L'){
        signature = signature.substring(1, signature.length() - 1);
      }
      logr.log(JDILogger.LEVEL_VERBOSE, "ClassesBySignature(" + signature + ")"); //$NON-NLS-1$ //$NON-NLS-2$
      int count = 0;
      Iterator <JavaClass> javaClasses = classes.values().iterator();
      while (javaClasses.hasNext()){
        JavaClass javaClass = javaClasses.next();
        String searched = javaClass.getName();

        if (searched.equals(signature)){
          count++;
          if (javaClass.isArray()){
            vctr.add((byte)3);
          }else if (isInterface(javaClass.getID().getAddress())){
            vctr.add((byte)2);
          }else{
            vctr.add((byte)1);
          }
          //vctr.add((byte)1);
          addLongToVector(vctr, javaClass.getID().getAddress());
          //Verified Prepared and Initialized
          addIntToVector(vctr, 1 | 2 | 4);
          logr.log(JDILogger.LEVEL_VERYVERBOSE, "Match: " + javaClass.getName() +" " + Long.toHexString(javaClass.getID().getAddress())); //$NON-NLS-1$
        }else{
          String mangledName = "" + searched + ""; //$NON-NLS-1$ //$NON-NLS-2$
          if (mangledName.equals(signature)){
            count++;
            if (javaClass.isArray()){
              vctr.add((byte)3);
            }else if (isInterface(javaClass.getID().getAddress())){
              vctr.add((byte)2);
            }else{
              vctr.add((byte)1);
            }
            //vctr.add((byte)1);
            addLongToVector(vctr, javaClass.getID().getAddress());
            //Verified Prepared and Initialized
            addIntToVector(vctr, 1 | 2 | 4);
            logr.log(JDILogger.LEVEL_VERYVERBOSE, "Mangled Match: " + javaClass.getName()); //$NON-NLS-1$
          }else{
            String secondMangle = "[" + searched + ";"; //$NON-NLS-1$ //$NON-NLS-2$
            if (secondMangle.equals(signature)){
              count++;
              if (javaClass.isArray()){
                vctr.add((byte)3);
              }else if (isInterface(javaClass.getID().getAddress())){
                vctr.add((byte)2);
              }else{
                vctr.add((byte)1);
              }
              //vctr.add((byte)1);
              addLongToVector(vctr, javaClass.getID().getAddress());
              //Verified Prepared and Initialized
              addIntToVector(vctr, 1 | 2 | 4);
              logr.log(JDILogger.LEVEL_VERYVERBOSE, "Really mangled match: " + javaClass.getName()); //$NON-NLS-1$
            }
          }
        }

      }
      //Add the count to the front of the vector
      addIntToVectorFront(vctr, count);
      logr.log(JDILogger.LEVEL_VERYVERBOSE, count+" matches"); //$NON-NLS-1$
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
      rpckt.setData(vectorToByte(vctr));
      return rpckt;
    }else if (cpckt.getCommand() == VIRTUAL_MACHINE_ALL_CLASSES){
      logr.log(JDILogger.LEVEL_VERBOSE, "AllClasses()"); //$NON-NLS-1$
      Vector<Byte> vctr = new Vector<Byte>();
      int count = 0;
      Iterator <JavaClass> classList = classes.values().iterator();
      while(classList.hasNext()){
        JavaClass javaClass = (JavaClass)classList.next();
        long typeID = javaClass.getID().getAddress();
        String signature;

        if (javaClass.isArray()){
          vctr.add((byte)3);
          signature = "" + javaClass.getName() + ""; //$NON-NLS-1$ //$NON-NLS-2$
        }else if (isInterface(typeID)){
          vctr.add((byte)2);
          signature = "L" + javaClass.getName() + ";"; //$NON-NLS-1$ //$NON-NLS-2$
        }else{
          vctr.add((byte)1);
          signature = "L" + javaClass.getName() + ";"; //$NON-NLS-1$ //$NON-NLS-2$
        }
       
        int status = 7;
        addLongToVector(vctr, typeID);
        addStringToVector(vctr, signature);
        addIntToVector(vctr, status);
        count++;
       

      }

      logr.log(JDILogger.LEVEL_VERYVERBOSE, "  " + count +" class(es) found"); //$NON-NLS-1$ //$NON-NLS-2$
      addIntToVectorFront(vctr, count);
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
      rpckt.setData(vectorToByte(vctr));
      return rpckt;
    }else if (cpckt.getCommand() == VIRTUAL_MACHINE_ALL_THREADS){
      logr.log(JDILogger.LEVEL_VERBOSE, "AllThreads()"); //$NON-NLS-1$
      Iterator asIt = image.getAddressSpaces( ).iterator();
      while ( asIt.hasNext( ) )
      {
        ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
        Iterator prIt = as.getProcesses( ).iterator();

        while ( prIt.hasNext( ) )
        {
          ImageProcess process = (ImageProcess) prIt.next( );
          Iterator runTimesIt = process.getRuntimes( ).iterator();
          while ( runTimesIt.hasNext( ) )
          {
            JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
            Iterator thds = javaRT.getThreads().iterator();
            Vector<Byte> vctr = new Vector<Byte>();
View Full Code Here

        ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
        Iterator prIt = as.getProcesses( ).iterator();

        while ( prIt.hasNext( ) )
        {
          ImageProcess process = (ImageProcess) prIt.next( );
          Iterator runTimesIt = process.getRuntimes( ).iterator();
          while ( runTimesIt.hasNext( ) )
          {
            JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
            Iterator thds = javaRT.getThreads().iterator();
            while(thds.hasNext()){
View Full Code Here

TOP

Related Classes of javax.tools.diagnostics.image.ImageProcess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.