Пример #1
0
  public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
    if (pc == null) {
      return null;
    }
    List objs = getLoadObjectList();
    Object[] arr = objs.toArray();
    // load objects are sorted by base address, do binary search
    int mid = -1;
    int low = 0;
    int high = arr.length - 1;

    while (low <= high) {
      mid = (low + high) >> 1;
      LoadObject midVal = (LoadObject) arr[mid];
      long cmp = pc.minus(midVal.getBase());
      if (cmp < 0) {
        high = mid - 1;
      } else if (cmp > 0) {
        long size = midVal.getSize();
        if (cmp >= size) {
          low = mid + 1;
        } else {
          return (LoadObject) arr[mid];
        }
      } else { // match found
        return (LoadObject) arr[mid];
      }
    }
    // no match found.
    return null;
  }
Пример #2
0
  /**
   * Return a List of SA Fields for all the java fields in this class, including all inherited
   * fields. This includes hidden fields. Thus the returned list can contain fields with the same
   * name. Return an empty list if there are no fields. Only designed for use in a debugging system.
   */
  public List getAllFields() {
    // Contains a Field for each field in this class, including immediate
    // fields and inherited fields.
    List allFields = getImmediateFields();

    // transitiveInterfaces contains all interfaces implemented
    // by this class and its superclass chain with no duplicates.

    ObjArray interfaces = getTransitiveInterfaces();
    int n = (int) interfaces.getLength();
    for (int i = 0; i < n; i++) {
      InstanceKlass intf1 = (InstanceKlass) interfaces.getObjAt(i);
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(intf1.isInterface(), "just checking type");
      }
      allFields.addAll(intf1.getImmediateFields());
    }

    // Get all fields in the superclass, recursively.  But, don't
    // include fields in interfaces implemented by superclasses;
    // we already have all those.
    if (!isInterface()) {
      InstanceKlass supr;
      if ((supr = (InstanceKlass) getSuper()) != null) {
        allFields.addAll(supr.getImmediateFields());
      }
    }

    return allFields;
  }
Пример #3
0
 // Get list of Java threads that have called Object.wait on the specified monitor.
 public List getWaitingThreads(ObjectMonitor monitor) {
   List pendingThreads = new ArrayList();
   for (JavaThread thread = first(); thread != null; thread = thread.next()) {
     ObjectMonitor waiting = thread.getCurrentWaitingMonitor();
     if (monitor.equals(waiting)) {
       pendingThreads.add(thread);
     }
   }
   return pendingThreads;
 }
Пример #4
0
  /**
   * Return a List of SA Fields for the fields declared in this class. Inherited fields are not
   * included. Return an empty list if there are no fields declared in this class. Only designed for
   * use in a debugging system.
   */
  public List getImmediateFields() {
    // A list of Fields for each field declared in this class/interface,
    // not including inherited fields.
    TypeArray fields = getFields();

    int length = (int) fields.getLength();
    List immediateFields = new ArrayList(length / NEXT_OFFSET);
    for (int index = 0; index < length; index += NEXT_OFFSET) {
      immediateFields.add(getFieldByIndex(index));
    }

    return immediateFields;
  }
Пример #5
0
 // refer to Threads::get_pending_threads
 // Get list of Java threads that are waiting to enter the specified monitor.
 public List getPendingThreads(ObjectMonitor monitor) {
   List pendingThreads = new ArrayList();
   for (JavaThread thread = first(); thread != null; thread = thread.next()) {
     if (thread.isCompilerThread() || thread.isCodeCacheSweeperThread()) {
       continue;
     }
     ObjectMonitor pending = thread.getCurrentPendingMonitor();
     if (monitor.equals(pending)) {
       pendingThreads.add(thread);
     }
   }
   return pendingThreads;
 }
Пример #6
0
  /**
   * Return a List containing an SA InstanceKlass for each interface named in this class's
   * 'implements' clause.
   */
  public List getDirectImplementedInterfaces() {
    // Contains an InstanceKlass for each interface in this classes
    // 'implements' clause.

    ObjArray interfaces = getLocalInterfaces();
    int length = (int) interfaces.getLength();
    List directImplementedInterfaces = new ArrayList(length);

    for (int index = 0; index < length; index++) {
      directImplementedInterfaces.add(interfaces.getObjAt(index));
    }

    return directImplementedInterfaces;
  }
 public SimpleTreeNode getChild(int index) {
   LivenessPathElement lpe = (LivenessPathElement) children.get(index);
   IndexableFieldIdentifier ifid = new IndexableFieldIdentifier(index);
   Oop oop = lpe.getObj();
   if (oop != null) {
     return new OopTreeNodeAdapter(oop, ifid, getTreeTableMode());
   } else {
     NamedFieldIdentifier nfi = (NamedFieldIdentifier) lpe.getField();
     return new RootTreeNodeAdapter(nfi.getName(), ifid, getTreeTableMode());
   }
 }
 public int getChildCount() {
   return children != null ? children.size() : 0;
 }