Examples of JavaStackFrame


Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

   
    while(frames.hasNext()) {
      Object next = frames.next();
     
      if(next instanceof JavaStackFrame) {
        JavaStackFrame frame = (JavaStackFrame) next;
       
        JavaLocation location = frame.getLocation();
       
        if (location != null) {
          JavaMethod method = location.getMethod();
         
          if(method != null) {
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

    if (contrivedThread == null) {
      fail("Couldn't find thread "+SetupJavaStackFrame_getHeapRoots.threadName);
    }

    Iterator frames = contrivedThread.getStackFrames().iterator();
    JavaStackFrame currentFrame = null;
    while (frames.hasNext() && frame == null) {
      Object next = frames.next();

      if (next instanceof JavaStackFrame) {
        currentFrame = (JavaStackFrame) next;
        try {
          JavaLocation location = currentFrame.getLocation();
          String methodName = location.getMethod().getName();
//          System.out.println("Method is: " + methodName + " "+ location.getFilename() + "@" + location.getLineNumber());
          if ("methodA".equals(methodName)) {
            frame = currentFrame;
          }
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

   
    List allThreads = getJavaRuntime().getThreads();
   
    JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
    Iterator i=t1.getStackFrames().iterator();
    JavaStackFrame frame=(JavaStackFrame) i.next();
    JavaLocation location=frame.getLocation();
    JavaMethod  method=location.getMethod();
    assertNotNull(method);
   
   
  }
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

   
    List allThreads = getJavaRuntime().getThreads();
   
    JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
    Iterator i=t1.getStackFrames().iterator();
    JavaStackFrame frame=(JavaStackFrame) i.next();
    JavaLocation location=frame.getLocation();
    JavaMethod  method=location.getMethod();
    String name=method.getName();
    assertEquals(name,"sleep");
   
   
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

    while (frames.hasNext()) {
      Object next = frames.next();

      if (next instanceof JavaStackFrame) {
        JavaStackFrame frame = (JavaStackFrame) next;

        JavaLocation location = frame.getLocation();
       
        if ((methodIndex < SetupJavaThread_getStackFrames.methodNames.length)
            && SetupJavaThread_getStackFrames.methodNames[methodIndex].equals(location.getMethod().getName())) {
          methodIndex++;
        }
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

              //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){
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

              //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){
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

                //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 (jClass.getID().getAddress() == refType){
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

                //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()){
              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){
View Full Code Here

Examples of javax.tools.diagnostics.runtime.java.JavaStackFrame

                  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()){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.