sun.jvm.hotspot.utilities.AddressOps Java Examples

The following examples show how to use sun.jvm.hotspot.utilities.AddressOps. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicLineNumberMapping.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Sort the line number information by increasing starting program
    counter. This must be done before any queries are made. */
public void sort() {
  if (infoList == null) return;
  Collections.sort(infoList, new Comparator() {
      public int compare(Object o1, Object o2) {
        BasicLineNumberInfo l1 = (BasicLineNumberInfo) o1;
        BasicLineNumberInfo l2 = (BasicLineNumberInfo) o2;
        Address a1 = l1.getStartPC();
        Address a2 = l2.getStartPC();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });
}
 
Example #2
Source File: BasicLineNumberMapping.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private BasicLineNumberInfo searchLineNumbers(Address addr, int lowIdx, int highIdx) {
  if (highIdx < lowIdx) return null;
  if (lowIdx == highIdx) {
    // Base case: see whether start PC is less than or equal to addr
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else {
      return null;
    }
  } else if (lowIdx == highIdx - 1) {
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else if (check(addr, highIdx)) {
      return get(highIdx);
    } else {
      return null;
    }
  }
  int midIdx = (lowIdx + highIdx) >> 1;
  BasicLineNumberInfo info = get(midIdx);
  if (AddressOps.lt(addr, info.getStartPC())) {
    // Always move search down
    return searchLineNumbers(addr, lowIdx, midIdx);
  } else if (AddressOps.equal(addr, info.getStartPC())) {
    return info;
  } else {
    // Move search up
    return searchLineNumbers(addr, midIdx, highIdx);
  }
}
 
Example #3
Source File: BasicLineNumberMapping.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean check(Address addr, int idx) {
  BasicLineNumberInfo info = get(idx);
  if (AddressOps.lte(info.getStartPC(), addr)) {
    return true;
  } else {
    return false;
  }
}
 
Example #4
Source File: BasicCDebugInfoDataBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void resolve(ResolveListener listener) {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  // Go through all types in lazyTypeMap and types.
  // Resolve all LazyTypes.
  resolveLazyMap(listener);
  for (ListIterator iter = types.listIterator(); iter.hasNext(); ) {
    BasicType t = (BasicType) iter.next();
    BasicType t2 = (BasicType) t.resolveTypes(this, listener);
    if (t != t2) {
      iter.set(t2);
    }
  }
  // Go through all symbols and resolve references to types and
  // references to other symbols
  for (Iterator iter = blocks.iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }
  for (Iterator iter = nameToSymMap.values().iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }

  // Sort blocks in ascending order of starting address (but do not
  // change ordering among blocks with the same starting address)
  Collections.sort(blocks, new Comparator() {
      public int compare(Object o1, Object o2) {
        BlockSym b1 = (BlockSym) o1;
        BlockSym b2 = (BlockSym) o2;
        Address a1 = b1.getAddress();
        Address a2 = b2.getAddress();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });

  state = RESOLVED_STATE;
}
 
Example #5
Source File: WindbgCDebugger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
  // FIXME: could keep sorted list of these to be able to do binary
  // searches, for better scalability
  if (pc == null) {
    return null;
  }
  List objs = getLoadObjectList();
  for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
    LoadObject obj = (LoadObject) iter.next();
    if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {
      return obj;
    }
  }
  return null;
}
 
Example #6
Source File: BasicLineNumberMapping.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** Sort the line number information by increasing starting program
    counter. This must be done before any queries are made. */
public void sort() {
  if (infoList == null) return;
  Collections.sort(infoList, new Comparator() {
      public int compare(Object o1, Object o2) {
        BasicLineNumberInfo l1 = (BasicLineNumberInfo) o1;
        BasicLineNumberInfo l2 = (BasicLineNumberInfo) o2;
        Address a1 = l1.getStartPC();
        Address a2 = l2.getStartPC();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });
}
 
Example #7
Source File: BasicLineNumberMapping.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private BasicLineNumberInfo searchLineNumbers(Address addr, int lowIdx, int highIdx) {
  if (highIdx < lowIdx) return null;
  if (lowIdx == highIdx) {
    // Base case: see whether start PC is less than or equal to addr
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else {
      return null;
    }
  } else if (lowIdx == highIdx - 1) {
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else if (check(addr, highIdx)) {
      return get(highIdx);
    } else {
      return null;
    }
  }
  int midIdx = (lowIdx + highIdx) >> 1;
  BasicLineNumberInfo info = get(midIdx);
  if (AddressOps.lt(addr, info.getStartPC())) {
    // Always move search down
    return searchLineNumbers(addr, lowIdx, midIdx);
  } else if (AddressOps.equal(addr, info.getStartPC())) {
    return info;
  } else {
    // Move search up
    return searchLineNumbers(addr, midIdx, highIdx);
  }
}
 
Example #8
Source File: BasicLineNumberMapping.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean check(Address addr, int idx) {
  BasicLineNumberInfo info = get(idx);
  if (AddressOps.lte(info.getStartPC(), addr)) {
    return true;
  } else {
    return false;
  }
}
 
Example #9
Source File: BasicCDebugInfoDataBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void resolve(ResolveListener listener) {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  // Go through all types in lazyTypeMap and types.
  // Resolve all LazyTypes.
  resolveLazyMap(listener);
  for (ListIterator iter = types.listIterator(); iter.hasNext(); ) {
    BasicType t = (BasicType) iter.next();
    BasicType t2 = (BasicType) t.resolveTypes(this, listener);
    if (t != t2) {
      iter.set(t2);
    }
  }
  // Go through all symbols and resolve references to types and
  // references to other symbols
  for (Iterator iter = blocks.iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }
  for (Iterator iter = nameToSymMap.values().iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }

  // Sort blocks in ascending order of starting address (but do not
  // change ordering among blocks with the same starting address)
  Collections.sort(blocks, new Comparator() {
      public int compare(Object o1, Object o2) {
        BlockSym b1 = (BlockSym) o1;
        BlockSym b2 = (BlockSym) o2;
        Address a1 = b1.getAddress();
        Address a2 = b2.getAddress();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });

  state = RESOLVED_STATE;
}
 
Example #10
Source File: WindbgCDebugger.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
  // FIXME: could keep sorted list of these to be able to do binary
  // searches, for better scalability
  if (pc == null) {
    return null;
  }
  List objs = getLoadObjectList();
  for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
    LoadObject obj = (LoadObject) iter.next();
    if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {
      return obj;
    }
  }
  return null;
}
 
Example #11
Source File: BasicLineNumberMapping.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Sort the line number information by increasing starting program
    counter. This must be done before any queries are made. */
public void sort() {
  if (infoList == null) return;
  Collections.sort(infoList, new Comparator() {
      public int compare(Object o1, Object o2) {
        BasicLineNumberInfo l1 = (BasicLineNumberInfo) o1;
        BasicLineNumberInfo l2 = (BasicLineNumberInfo) o2;
        Address a1 = l1.getStartPC();
        Address a2 = l2.getStartPC();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });
}
 
Example #12
Source File: BasicLineNumberMapping.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private BasicLineNumberInfo searchLineNumbers(Address addr, int lowIdx, int highIdx) {
  if (highIdx < lowIdx) return null;
  if (lowIdx == highIdx) {
    // Base case: see whether start PC is less than or equal to addr
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else {
      return null;
    }
  } else if (lowIdx == highIdx - 1) {
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else if (check(addr, highIdx)) {
      return get(highIdx);
    } else {
      return null;
    }
  }
  int midIdx = (lowIdx + highIdx) >> 1;
  BasicLineNumberInfo info = get(midIdx);
  if (AddressOps.lt(addr, info.getStartPC())) {
    // Always move search down
    return searchLineNumbers(addr, lowIdx, midIdx);
  } else if (AddressOps.equal(addr, info.getStartPC())) {
    return info;
  } else {
    // Move search up
    return searchLineNumbers(addr, midIdx, highIdx);
  }
}
 
Example #13
Source File: BasicLineNumberMapping.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean check(Address addr, int idx) {
  BasicLineNumberInfo info = get(idx);
  if (AddressOps.lte(info.getStartPC(), addr)) {
    return true;
  } else {
    return false;
  }
}
 
Example #14
Source File: BasicCDebugInfoDataBase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void resolve(ResolveListener listener) {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  // Go through all types in lazyTypeMap and types.
  // Resolve all LazyTypes.
  resolveLazyMap(listener);
  for (ListIterator iter = types.listIterator(); iter.hasNext(); ) {
    BasicType t = (BasicType) iter.next();
    BasicType t2 = (BasicType) t.resolveTypes(this, listener);
    if (t != t2) {
      iter.set(t2);
    }
  }
  // Go through all symbols and resolve references to types and
  // references to other symbols
  for (Iterator iter = blocks.iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }
  for (Iterator iter = nameToSymMap.values().iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }

  // Sort blocks in ascending order of starting address (but do not
  // change ordering among blocks with the same starting address)
  Collections.sort(blocks, new Comparator() {
      public int compare(Object o1, Object o2) {
        BlockSym b1 = (BlockSym) o1;
        BlockSym b2 = (BlockSym) o2;
        Address a1 = b1.getAddress();
        Address a2 = b2.getAddress();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });

  state = RESOLVED_STATE;
}
 
Example #15
Source File: WindbgCDebugger.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
  // FIXME: could keep sorted list of these to be able to do binary
  // searches, for better scalability
  if (pc == null) {
    return null;
  }
  List objs = getLoadObjectList();
  for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
    LoadObject obj = (LoadObject) iter.next();
    if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {
      return obj;
    }
  }
  return null;
}
 
Example #16
Source File: BasicLineNumberMapping.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Sort the line number information by increasing starting program
    counter. This must be done before any queries are made. */
public void sort() {
  if (infoList == null) return;
  Collections.sort(infoList, new Comparator() {
      public int compare(Object o1, Object o2) {
        BasicLineNumberInfo l1 = (BasicLineNumberInfo) o1;
        BasicLineNumberInfo l2 = (BasicLineNumberInfo) o2;
        Address a1 = l1.getStartPC();
        Address a2 = l2.getStartPC();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });
}
 
Example #17
Source File: BasicLineNumberMapping.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private BasicLineNumberInfo searchLineNumbers(Address addr, int lowIdx, int highIdx) {
  if (highIdx < lowIdx) return null;
  if (lowIdx == highIdx) {
    // Base case: see whether start PC is less than or equal to addr
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else {
      return null;
    }
  } else if (lowIdx == highIdx - 1) {
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else if (check(addr, highIdx)) {
      return get(highIdx);
    } else {
      return null;
    }
  }
  int midIdx = (lowIdx + highIdx) >> 1;
  BasicLineNumberInfo info = get(midIdx);
  if (AddressOps.lt(addr, info.getStartPC())) {
    // Always move search down
    return searchLineNumbers(addr, lowIdx, midIdx);
  } else if (AddressOps.equal(addr, info.getStartPC())) {
    return info;
  } else {
    // Move search up
    return searchLineNumbers(addr, midIdx, highIdx);
  }
}
 
Example #18
Source File: BasicLineNumberMapping.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean check(Address addr, int idx) {
  BasicLineNumberInfo info = get(idx);
  if (AddressOps.lte(info.getStartPC(), addr)) {
    return true;
  } else {
    return false;
  }
}
 
Example #19
Source File: BasicCDebugInfoDataBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void resolve(ResolveListener listener) {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  // Go through all types in lazyTypeMap and types.
  // Resolve all LazyTypes.
  resolveLazyMap(listener);
  for (ListIterator iter = types.listIterator(); iter.hasNext(); ) {
    BasicType t = (BasicType) iter.next();
    BasicType t2 = (BasicType) t.resolveTypes(this, listener);
    if (t != t2) {
      iter.set(t2);
    }
  }
  // Go through all symbols and resolve references to types and
  // references to other symbols
  for (Iterator iter = blocks.iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }
  for (Iterator iter = nameToSymMap.values().iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }

  // Sort blocks in ascending order of starting address (but do not
  // change ordering among blocks with the same starting address)
  Collections.sort(blocks, new Comparator() {
      public int compare(Object o1, Object o2) {
        BlockSym b1 = (BlockSym) o1;
        BlockSym b2 = (BlockSym) o2;
        Address a1 = b1.getAddress();
        Address a2 = b2.getAddress();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });

  state = RESOLVED_STATE;
}
 
Example #20
Source File: WindbgCDebugger.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
  // FIXME: could keep sorted list of these to be able to do binary
  // searches, for better scalability
  if (pc == null) {
    return null;
  }
  List objs = getLoadObjectList();
  for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
    LoadObject obj = (LoadObject) iter.next();
    if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {
      return obj;
    }
  }
  return null;
}
 
Example #21
Source File: BasicLineNumberMapping.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** Sort the line number information by increasing starting program
    counter. This must be done before any queries are made. */
public void sort() {
  if (infoList == null) return;
  Collections.sort(infoList, new Comparator() {
      public int compare(Object o1, Object o2) {
        BasicLineNumberInfo l1 = (BasicLineNumberInfo) o1;
        BasicLineNumberInfo l2 = (BasicLineNumberInfo) o2;
        Address a1 = l1.getStartPC();
        Address a2 = l2.getStartPC();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });
}
 
Example #22
Source File: BasicLineNumberMapping.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private BasicLineNumberInfo searchLineNumbers(Address addr, int lowIdx, int highIdx) {
  if (highIdx < lowIdx) return null;
  if (lowIdx == highIdx) {
    // Base case: see whether start PC is less than or equal to addr
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else {
      return null;
    }
  } else if (lowIdx == highIdx - 1) {
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else if (check(addr, highIdx)) {
      return get(highIdx);
    } else {
      return null;
    }
  }
  int midIdx = (lowIdx + highIdx) >> 1;
  BasicLineNumberInfo info = get(midIdx);
  if (AddressOps.lt(addr, info.getStartPC())) {
    // Always move search down
    return searchLineNumbers(addr, lowIdx, midIdx);
  } else if (AddressOps.equal(addr, info.getStartPC())) {
    return info;
  } else {
    // Move search up
    return searchLineNumbers(addr, midIdx, highIdx);
  }
}
 
Example #23
Source File: BasicLineNumberMapping.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean check(Address addr, int idx) {
  BasicLineNumberInfo info = get(idx);
  if (AddressOps.lte(info.getStartPC(), addr)) {
    return true;
  } else {
    return false;
  }
}
 
Example #24
Source File: BasicCDebugInfoDataBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void resolve(ResolveListener listener) {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  // Go through all types in lazyTypeMap and types.
  // Resolve all LazyTypes.
  resolveLazyMap(listener);
  for (ListIterator iter = types.listIterator(); iter.hasNext(); ) {
    BasicType t = (BasicType) iter.next();
    BasicType t2 = (BasicType) t.resolveTypes(this, listener);
    if (t != t2) {
      iter.set(t2);
    }
  }
  // Go through all symbols and resolve references to types and
  // references to other symbols
  for (Iterator iter = blocks.iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }
  for (Iterator iter = nameToSymMap.values().iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }

  // Sort blocks in ascending order of starting address (but do not
  // change ordering among blocks with the same starting address)
  Collections.sort(blocks, new Comparator() {
      public int compare(Object o1, Object o2) {
        BlockSym b1 = (BlockSym) o1;
        BlockSym b2 = (BlockSym) o2;
        Address a1 = b1.getAddress();
        Address a2 = b2.getAddress();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });

  state = RESOLVED_STATE;
}
 
Example #25
Source File: WindbgCDebugger.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
  // FIXME: could keep sorted list of these to be able to do binary
  // searches, for better scalability
  if (pc == null) {
    return null;
  }
  List objs = getLoadObjectList();
  for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
    LoadObject obj = (LoadObject) iter.next();
    if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {
      return obj;
    }
  }
  return null;
}
 
Example #26
Source File: BasicLineNumberMapping.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** Sort the line number information by increasing starting program
    counter. This must be done before any queries are made. */
public void sort() {
  if (infoList == null) return;
  Collections.sort(infoList, new Comparator() {
      public int compare(Object o1, Object o2) {
        BasicLineNumberInfo l1 = (BasicLineNumberInfo) o1;
        BasicLineNumberInfo l2 = (BasicLineNumberInfo) o2;
        Address a1 = l1.getStartPC();
        Address a2 = l2.getStartPC();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });
}
 
Example #27
Source File: BasicLineNumberMapping.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private BasicLineNumberInfo searchLineNumbers(Address addr, int lowIdx, int highIdx) {
  if (highIdx < lowIdx) return null;
  if (lowIdx == highIdx) {
    // Base case: see whether start PC is less than or equal to addr
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else {
      return null;
    }
  } else if (lowIdx == highIdx - 1) {
    if (check(addr, lowIdx)) {
      return get(lowIdx);
    } else if (check(addr, highIdx)) {
      return get(highIdx);
    } else {
      return null;
    }
  }
  int midIdx = (lowIdx + highIdx) >> 1;
  BasicLineNumberInfo info = get(midIdx);
  if (AddressOps.lt(addr, info.getStartPC())) {
    // Always move search down
    return searchLineNumbers(addr, lowIdx, midIdx);
  } else if (AddressOps.equal(addr, info.getStartPC())) {
    return info;
  } else {
    // Move search up
    return searchLineNumbers(addr, midIdx, highIdx);
  }
}
 
Example #28
Source File: BasicLineNumberMapping.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean check(Address addr, int idx) {
  BasicLineNumberInfo info = get(idx);
  if (AddressOps.lte(info.getStartPC(), addr)) {
    return true;
  } else {
    return false;
  }
}
 
Example #29
Source File: BasicCDebugInfoDataBase.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void resolve(ResolveListener listener) {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  // Go through all types in lazyTypeMap and types.
  // Resolve all LazyTypes.
  resolveLazyMap(listener);
  for (ListIterator iter = types.listIterator(); iter.hasNext(); ) {
    BasicType t = (BasicType) iter.next();
    BasicType t2 = (BasicType) t.resolveTypes(this, listener);
    if (t != t2) {
      iter.set(t2);
    }
  }
  // Go through all symbols and resolve references to types and
  // references to other symbols
  for (Iterator iter = blocks.iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }
  for (Iterator iter = nameToSymMap.values().iterator(); iter.hasNext(); ) {
    ((BasicSym) iter.next()).resolve(this, listener);
  }

  // Sort blocks in ascending order of starting address (but do not
  // change ordering among blocks with the same starting address)
  Collections.sort(blocks, new Comparator() {
      public int compare(Object o1, Object o2) {
        BlockSym b1 = (BlockSym) o1;
        BlockSym b2 = (BlockSym) o2;
        Address a1 = b1.getAddress();
        Address a2 = b2.getAddress();
        if (AddressOps.lt(a1, a2)) { return -1; }
        if (AddressOps.gt(a1, a2)) { return 1; }
        return 0;
      }
    });

  state = RESOLVED_STATE;
}
 
Example #30
Source File: WindbgCDebugger.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
  // FIXME: could keep sorted list of these to be able to do binary
  // searches, for better scalability
  if (pc == null) {
    return null;
  }
  List objs = getLoadObjectList();
  for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
    LoadObject obj = (LoadObject) iter.next();
    if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {
      return obj;
    }
  }
  return null;
}