Package javax.tools.diagnostics.image

Examples of javax.tools.diagnostics.image.ImageProcess


        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()){
              Object tmpobj = thds.next();
              if (tmpobj instanceof CorruptData){
                //ignore this thread
              }else{
                JavaThread thd = (JavaThread) tmpobj;
                Iterator frames = thd.getStackFrames().iterator();
                while(frames.hasNext()){
                  JavaStackFrame jStackFrame = (JavaStackFrame)frames.next();
                  JavaLocation jLocation = jStackFrame.getLocation();
                  JavaMethod jMethod = jLocation.getMethod();
                  JavaClass jClass = jMethod.getDeclaringClass();

                  if (getMethodId(refType, jMethod) == methodID && jClass.getID().getAddress() == refType){
                    int line = -1;
                    try{
                      line = jLocation.getLineNumber();
                    }
                    catch(CorruptDataException exxy){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "  CorruptData for:"); //$NON-NLS-1$
                    }
                    catch(DataUnavailable exxy){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "  DataUnavailable for:"); //$NON-NLS-1$
                    }


                    Vector<Byte> vctr = new Vector<Byte>();
                    if (line > 0){

                      int lowest = findLowestLineRef(refType, methodID) - 1;
                      int highest = findHighestLineRef(refType, methodID) + 1;
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "  (L)" + jClass.getName() + "." + jMethod.getName() + ":" + lowest + "<" + line + ">" + highest); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
                     
//                      //Code index start
//                      addLongToVector(vctr, lowest);
//                      //Code index end
//                      addLongToVector(vctr, highest);
//                      //Number of lines
//                      addIntToVector(vctr, highest - lowest);
//                      for(int i = lowest; i <= highest; i++){
//                        addLongToVector(vctr, i);
//                        addIntToVector(vctr, i);
//                      }
                     
                      //Code index start
                      addLongToVector(vctr, 0);
                      //Code index end
                      addLongToVector(vctr, 99999999); // TODO go through local variable tables looking for highest reference?
                      //Number of lines
                      addIntToVector(vctr, 1);
                      //for(int i = lowest; i <= highest; i++){
                        addLongToVector(vctr, jLocation.getAddress().getAddress()-1);
                        addIntToVector(vctr, jLocation.getLineNumber());
                      //}
                     
                     
                    }else{
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "  (N)" + jClass.getName() + "." + jMethod.getName() + ":" + line); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                      //Code index start
                      addLongToVector(vctr, -1);
                      //Code index end
                      addLongToVector(vctr, -1);
                      //Number of lines
                      //We're native right now.
                      addIntToVector(vctr, 0);
                    }
                    ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
                    rpckt.setData(vectorToByte(vctr));
                    return rpckt;
                  }
                }
              }
            }
          }
        }
      }
     
      Vector<Byte> vctr = new Vector<Byte>();
      addLongToVector(vctr, -1);
      //Code index end
      addLongToVector(vctr, -1);
      //Number of lines
      //We're native right now.
      addIntToVector(vctr, 0);
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
      rpckt.setData(vectorToByte(vctr));
      return rpckt;
    }else if (cpckt.getCommand() == 2){
      byte [] inData = cpckt.getByteData();
      long refType = createLongFromBytes(inData, 0, 8);
      long methodID = createLongFromBytes(inData, 8, 8);
      logr.log(JDILogger.LEVEL_VERBOSE, "Method.VariableTable(" + refType + "," + methodID + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      int slotsUsed = 0;
      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();
            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( );
          try {
            JavaObject jObject = javaRT.getObjectAtAddress(as.getPointer(objectID));
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();

            int count = 0;
            while(thds.hasNext()){
              Object tmpobj = thds.next();
              if (tmpobj instanceof CorruptData){
                //ignore this thread
              }else{
                count++;
                JavaThread thd = (JavaThread)tmpobj;
                if (thread == thd.getObject().getID().getAddress()){
                  Vector<Byte> vctr = new Vector<Byte>();
                  addStringToVector(vctr, thd.getName());
                  ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
                  rpckt.setData(vectorToByte(vctr));
                  return rpckt;
                }
              }
            }
          }
        }
      }
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_INVALID_THREAD);
      return rpckt;
    }else if (cpckt.getCommand() == 2){
      logr.log(JDILogger.LEVEL_VERBOSE, "Suspend()"); //$NON-NLS-1$
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
      return rpckt;
    }else if (cpckt.getCommand() == 3){
      logr.log(JDILogger.LEVEL_VERBOSE, "Resume()"); //$NON-NLS-1$
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
      return rpckt;
    }else if (cpckt.getCommand() == 4){
      byte []inData = cpckt.getByteData();
      long thread = createLongFromBytes(inData, 0, 8);
      logr.log(JDILogger.LEVEL_VERBOSE, "Status("+thread+")"); //$NON-NLS-1$ //$NON-NLS-2$
      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>();
            while(thds.hasNext()){
              Object tmpobj = thds.next();
              if (tmpobj instanceof CorruptData){
                //ignore this thread
              }else{
                JavaThread thd = (JavaThread) tmpobj;
                if (thd.getObject().getID().getAddress() == thread){
                  int threadStatus = 1;

                  logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread Status: "+thd.getState()); //$NON-NLS-1$
                  logr.log(JDILogger.LEVEL_VERYVERBOSE, "  Thread Name: " + thd.getName()); //$NON-NLS-1$
                  if ((thd.getState() & JavaThread.STATE_TERMINATED) > 0){
                    threadStatus = 0;
                    logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is terminated"); //$NON-NLS-1$
                  }else if ((thd.getState() & JavaThread.STATE_SLEEPING) > 0){
                    threadStatus = 2;
                    logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is sleeping"); //$NON-NLS-1$
                  }else if ((thd.getState() & JavaThread.STATE_IN_OBJECT_WAIT) > 0 || (thd.getState() & JavaThread.STATE_WAITING) > 0 || (thd.getState() & JavaThread.STATE_WAITING_INDEFINITELY) > 0 || (thd.getState() & JavaThread.STATE_WAITING_WITH_TIMEOUT) > 0){
                    threadStatus = 4;
                    logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is waiting"); //$NON-NLS-1$
                  }else if ((thd.getState() & JavaThread.STATE_BLOCKED_ON_MONITOR_ENTER) > 0){
                    threadStatus = 3;
                    logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is monitor"); //$NON-NLS-1$
                  }else{
                    threadStatus = 1;
                    logr.log(JDILogger.LEVEL_VERBOSE, "Thread is other (running)"); //$NON-NLS-1$
                    if ((thd.getState() & JavaThread.STATE_ALIVE) > 0){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is alive"); //$NON-NLS-1$
                    }
                    if ((thd.getState() & JavaThread.STATE_IN_NATIVE) > 0){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is in native"); //$NON-NLS-1$
                    }
                    if ((thd.getState() & JavaThread.STATE_PARKED) > 0){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is parked"); //$NON-NLS-1$
                    }
                    if ((thd.getState() & JavaThread.STATE_INTERRUPTED) > 0){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is interrupted"); //$NON-NLS-1$
                    }
                    if ((thd.getState() & JavaThread.STATE_VENDOR_1) > 0){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is vendor 1"); //$NON-NLS-1$
                    }
                    if ((thd.getState() & JavaThread.STATE_VENDOR_3) > 0){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is vendor 2"); //$NON-NLS-1$
                    }
                    if ((thd.getState() & JavaThread.STATE_VENDOR_2) > 0){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is vendor 3"); //$NON-NLS-1$
                    }
                    if ((thd.getState() & JavaThread.STATE_RUNNABLE) > 0){
                      logr.log(JDILogger.LEVEL_VERYVERBOSE, "Thread is runnable"); //$NON-NLS-1$
                    }


                  }
                  //The thread always starts in Eclipse as running
                  //Even if it isn't (See bug #161781)
                  int suspendStatus = 1;
                  threadStatus = 2;
                  addIntToVector(vctr, threadStatus);
                  addIntToVector(vctr, suspendStatus);
                  ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
                  rpckt.setData(vectorToByte(vctr));
                  return rpckt;

                }
              }

            }



          }

        }
      }
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_INVALID_OBJECT);
      return rpckt;
    }else if (cpckt.getCommand() == 5){

      //ThreadGroup
      //This call returns the group of the input thread.
      //TODO - Since this doesn't seem available in Kato, let's fake it with 0
      // Lets fake it with 1 ...
      byte [] inData = cpckt.getByteData();
      long thread = createLongFromBytes(inData, 0, 8);
      logr.log(JDILogger.LEVEL_VERBOSE, "ThreadGroup("+thread+")"); //$NON-NLS-1$ //$NON-NLS-2$
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
      Vector<Byte> vctr = new Vector<Byte>();
      addLongToVector(vctr, 1);
      rpckt.setData(vectorToByte(vctr));
      return rpckt;
    }else if (cpckt.getCommand() == 6){
      //List all the frames from the thread

      byte []inData = cpckt.getByteData();
      long thread = createLongFromBytes(inData, 0, 8);
      int startFrame = createIntFromBytes(inData, 8, 4);
      int length = createIntFromBytes(inData, 12, 4);
      logr.log(JDILogger.LEVEL_VERBOSE, "Frames(" + thread + "," + startFrame + "," + length + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

      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();
            while(thds.hasNext()){
              Object tmpobj = thds.next();
              if (tmpobj instanceof CorruptData){
                //ignore this thread
              }else{
                JavaThread thd = (JavaThread) tmpobj;
                if (thd.getObject().getID().getAddress() == thread){
                  int currentFrame = 0;
                  int count = 0;
                  Iterator frames = thd.getStackFrames().iterator();
                  Vector<Byte> vctr = new Vector<Byte>();
                  int count2 = 0;
                  while(frames.hasNext()){
                    count2++;
                    if (length > 0){
                      if (currentFrame >= startFrame && currentFrame <= startFrame + length){
                        JavaStackFrame jStackFrame = (JavaStackFrame)frames.next();
                        addLongToVector(vctr, jStackFrame.getBasePointer().getAddress());

                        JavaLocation jLoc = jStackFrame.getLocation();

                        JavaMethod jMethod = jLoc.getMethod();

                        JavaClass jClass = jMethod.getDeclaringClass();

                        if (jClass.isArray()){
                          vctr.add((byte)3);
                        }else if(isInterface(jClass.getID().getAddress())){
                          vctr.add((byte)2);
                        }else{
                          vctr.add((byte)1);
                        }

                        addLongToVector(vctr, jClass.getID().getAddress());
                        addLongToVector(vctr, getMethodId(jClass.getID().getAddress(), jMethod));

                        //This is the current memory address.
                        addLongToVector(vctr, jLoc.getAddress().getAddress());
                        try{
                          logr.log(JDILogger.LEVEL_VERYVERBOSE, "  " + jLoc.getFilename() + "@" + jLoc.getMethod().getDeclaringClass().getName() + "{"+jLoc.getMethod().getDeclaringClass().getID().getAddress()+"}." + jLoc.getMethod().getName() + "{"+getMethodId(jClass.getID().getAddress(), jLoc.getMethod())+"}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
                          try{
                            logr.log(JDILogger.LEVEL_VERYVERBOSE, "    :" + jLoc.getLineNumber()); //$NON-NLS-1$
                          }catch(Exception exxy){
                          }

                        }catch (Exception exxy){}
                        count++;
                      }
                    }else{
                      if (currentFrame >= startFrame){
                        JavaStackFrame jStackFrame = (JavaStackFrame)frames.next();
                        addLongToVector(vctr, jStackFrame.getBasePointer().getAddress());

                        JavaLocation jLoc = jStackFrame.getLocation();

                        JavaMethod jMethod = jLoc.getMethod();

                        JavaClass jClass = jMethod.getDeclaringClass();
                        if (jClass.isArray()){
                          vctr.add((byte)3);
                        }else if(isInterface(jClass.getID().getAddress())){
                          vctr.add((byte)2);
                        }else{
                          vctr.add((byte)1);
                        }

                        addLongToVector(vctr, jClass.getID().getAddress());
                        addLongToVector(vctr, getMethodId(jClass.getID().getAddress(), jMethod));

                        //Location is 8 bytes (2 ints)
                        //We pad with 4 bytes of zeros
                        try{
                          addLongToVector(vctr, jLoc.getAddress().getAddress());
                        }
                        catch(Exception exxy){
                          addLongToVector(vctr, -1);
                        }
                        try{
                          logr.log(JDILogger.LEVEL_VERYVERBOSE, "  " + jLoc.getFilename() + "@" + jLoc.getMethod().getDeclaringClass().getName() + "{"+jLoc.getMethod().getDeclaringClass().getID().getAddress()+"}." + jLoc.getMethod().getName() + "{"+getMethodId(jClass.getID().getAddress(),jLoc.getMethod())+"}"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
                          try{
                            logr.log(JDILogger.LEVEL_VERYVERBOSE, "    :" + jLoc.getLineNumber()); //$NON-NLS-1$
                          }catch(Exception exxy){
                          }

                        }catch (Exception exxy){}

                        count++;
                      }
                    }
                  }
                  logr.log(JDILogger.LEVEL_VERYVERBOSE, count + " frames found (of " +count2 + ")"); //$NON-NLS-1$ //$NON-NLS-2$
                  ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
                  addIntToVectorFront(vctr, count);
                  rpckt.setData(vectorToByte(vctr));
                  return rpckt;

                }
              }
            }
          }
        }
      }
      ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_INVALID_OBJECT);
      return rpckt;
    }else if (cpckt.getCommand() == 7){
      //List all the frames from the thread

      byte []inData = cpckt.getByteData();
      long thread = createLongFromBytes(inData, 0, 8);
      logr.log(JDILogger.LEVEL_VERBOSE, "FrameCount(" + thread + ")"); //$NON-NLS-1$ //$NON-NLS-2$

      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();
            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()){
              Object tmpobj = thds.next();
              if (tmpobj instanceof CorruptData){
                //ignore this thread
              }else{
                JavaThread thd = (JavaThread) tmpobj;
                if (thd.getObject().getID().getAddress() == threadID){
                  Iterator frames = thd.getStackFrames().iterator();

                  while(frames.hasNext()){
                    JavaStackFrame jFrame = (JavaStackFrame)frames.next();
                    if (jFrame.getBasePointer().getAddress() == frameID){
//                      vctr.add((byte)'L');
//                      addLongToVector(vctr,jFrame.getLocation().getMethod().getDeclaringClass().getID().getAddress());
//                      logr.log(JDILogger.LEVEL_VERBOSE, "  " + jFrame.getLocation().getMethod().getDeclaringClass().getID().getAddress()); //$NON-NLS-1$
                      // Get slot number and type of each requested variable.                     
GETVALUESLOTS:                for (int i=0; i < slots; i++) {
                        int slot = createIntFromBytes(inData, 20+5*i, 4);
                        byte type = inData[20+5*i+4];
                       
                        Object value = jFrame.getVariable(slot);
                        logr.log(JDILogger.LEVEL_VERYVERBOSE, "OBJECT("+value+")");
                        switch(type) {
                        case TAG_ARRAY:
                          long arrayAddress = 0L;
                          vctr.add((byte)TAG_ARRAY);
                          if (value instanceof JavaObject) {
                            JavaObject obj = (JavaObject) value;                           
                            if (obj.isArray()) {
                              arrayAddress = obj.getID().getAddress();                                                                                             
                            }
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " Array in slot=" + slot + " value="+arrayAddress);
                          addLongToVector(vctr, arrayAddress );
                          break;
                        case TAG_BYTE:
                          byte byteVal = -1;
                          vctr.add((byte)TAG_BYTE);
                          if (value instanceof Number) {
                            Number num = (Number) value;
                            byteVal = num.byteValue();
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " byte in slot=" + slot + " value="+byteVal);
                          vctr.add(byteVal);
                          break;
                        case TAG_CHAR:
                          char charVal = (char) -1;
                          vctr.add((byte)TAG_CHAR);
                          if (value instanceof Character) {                           
                            charVal = (Character) value;
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " byte in slot=" + slot + " value="+charVal);
                          addCharToVector(vctr, charVal);
                          break;
                        case TAG_OBJECT:
                          long objectAddress = 0L;
                          byte typeTag = (byte)TAG_OBJECT;
                         
                          if (value instanceof JavaObject) {
                            JavaObject obj = (JavaObject) value;                           
                            objectAddress = obj.getID().getAddress();   
                            if (obj != null){
                              if (obj.getJavaClass().getName().equals("java/lang/String")){
                                typeTag = (byte)TAG_STRING;
                              }
                            }
                          }
                          vctr.add(typeTag);
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " Object in slot=" + slot + " value="+objectAddress);
                          addLongToVector(vctr, objectAddress );
                          break
                        case TAG_FLOAT:
                          float floatVal = -1;
                          vctr.add((byte)TAG_FLOAT);
                          if (value instanceof Number) {
                            Number num = (Number) value;
                            floatVal = num.floatValue();
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " float in slot=" + slot + " value="+floatVal);
                          addIntToVector(vctr, Float.floatToIntBits(floatVal));
                          break;
                        case TAG_DOUBLE:
                          double doubleVal = -1;
                          vctr.add((byte)TAG_DOUBLE);
                          if (value instanceof Number) {
                            Number num = (Number) value;
                            doubleVal = num.doubleValue();
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " double in slot=" + slot + " value="+doubleVal);
                          addLongToVector(vctr, Double.doubleToLongBits(doubleVal));
                         
                          break;
                        case TAG_INT:
                          int intVal = -1;
                          vctr.add((byte)TAG_INT);
                          if (value instanceof Number) {
                            Number num = (Number) value;
                            intVal = num.intValue();
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " int in slot=" + slot + " value="+intVal);
                          addIntToVector(vctr, intVal);
                          break;
                        case TAG_LONG:
                          long longVal = -1;
                          vctr.add((byte)TAG_LONG);
                          if (value instanceof Number) {
                            Number num = (Number) value;
                            longVal = num.longValue();
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " long in slot=" + slot + " value="+longVal);
                          addLongToVector(vctr, longVal);
                         
                          break;
                        case TAG_SHORT:
                          short shortVal = -1;
                          vctr.add((byte)TAG_SHORT);
                          if (value instanceof Number) {
                            Number num = (Number) value;
                            shortVal = num.shortValue();
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " short in slot=" + slot + " value="+shortVal);
                          addShortToVector(vctr, shortVal);
                         
                          break;
                        case TAG_BOOLEAN:
                          boolean booleanVal = false;
                          vctr.add((byte)TAG_BOOLEAN);
                          if (value instanceof Boolean) {
                            booleanVal = ((Boolean) value);
                          }
                         
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " boolean in slot=" + slot + " value="+booleanVal);
                         
                          vctr.add(booleanVal ? (byte) 1 : (byte) 0);
                          break;
                        case TAG_STRING:
                          String stringVal= "";
                          vctr.add((byte)TAG_STRING);
                          if (value instanceof JavaObject) {
                            stringVal = javaObjectToString( (JavaObject) value);
                          }
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " string in slot=" + slot + " value=\""+stringVal+"\"");
                          addStringToVector(vctr, stringVal);                         
                          break;
                        default:
                          logr.log(JDILogger.LEVEL_VERBOSE, "  " +jFrame.getLocation() + " unable to handle type "+type+" in "+jFrame.getLocation());
                          rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
                          vctr = new Vector<Byte>();
                          break GETVALUESLOTS;
                        }
                       
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      rpckt.setData(vectorToByte(vctr));
      return rpckt;



    }else if (cpckt.getCommand() == 3){
      byte []inData = cpckt.getByteData();
      long threadID = createLongFromBytes(inData, 0, 8);
      long frameID = createLongFromBytes(inData, 8, 8);
      //TODO - Get this to work
      logr.log(JDILogger.LEVEL_VERBOSE, "ThisObject(" + threadID + "," + frameID + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

      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();
            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();
            Vector<Byte> vctr = new Vector<Byte>();
View Full Code Here

  public JavaRuntime getJavaRuntime(File file) throws IOException {
     Image i=getImage(file);
     if(i==null) return null;
    
    for(ImageAddressSpace space:i.getAddressSpaces()) {
      ImageProcess process=space.getCurrentProcess();
      for(ManagedRuntime r : process.getRuntimes()) {
        if(r instanceof JavaRuntime) return (JavaRuntime) r;
      }
    }
    return null;
  }
View Full Code Here

          id = it.getID();
        else
        {
          out.print("\n\tNo current (failing) thread, try specifying a native thread ID or '*'\n");
         
          ImageProcess ip = ias.getCurrentProcess();
          if (ip!=null){
            printThreadSummary(ip , out);
          }
         
          return;
View Full Code Here

  }
 
  private void printProcessInfo(ImageAddressSpace ias, Output out, String id, Map threads)
  {
    Iterator itProcess;
    ImageProcess ip;
    boolean found = false;
   
    itProcess = ias.getProcesses().iterator();
    while (itProcess.hasNext())
    {
      ip = (ImageProcess)itProcess.next();
      pointerSize = ip.getPointerSize();
     
      out.print("\t process id: ");
      try {
        out.print(ip.getID());
      } catch (DataUnavailable d) {
        out.print(Exceptions.getDataUnavailableString());
      } catch (CorruptDataException e) {
        out.print(Exceptions.getCorruptDataExceptionString());
      }
View Full Code Here

  public JavaRuntime getJavaRuntime(File file) throws IOException {
     Image i=getImage(file);
     if(i==null) return null;
    
    for(ImageAddressSpace space:i.getAddressSpaces()) {
      ImageProcess process=space.getCurrentProcess();
      for(ManagedRuntime r : process.getRuntimes()) {
        if(r instanceof JavaRuntime) return (JavaRuntime) r;
      }
    }
    return null;
  }
View Full Code Here

     
      Iterator itProcess = ias.getProcesses().iterator();
     
      // iterate through the processes
      while (itProcess.hasNext())  {
        ImageProcess ip = (ImageProcess)itProcess.next();
       
        out.print("\t process id: ");
        try {
          out.print(ip.getID());
        } catch (DataUnavailable du) {
          out.print(Exceptions.getDataUnavailableString());
        } catch (CorruptDataException cde) {
          out.print(Exceptions.getCorruptDataExceptionString());
        }
        out.print("\n\n");
       
        Iterator iLibs;
        try {
          iLibs = ip.getLibraries().iterator();
        } catch (DataUnavailable du) {
          iLibs = null;
          out.println(Exceptions.getDataUnavailableString());
        } catch (CorruptDataException cde) {
          iLibs = null;
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.