Example #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;
  }
Example #2
0
 public void run(PrintStream out, Debugger dbg) {
   CDebugger cdbg = dbg.getCDebugger();
   if (cdbg != null) {
     List l = cdbg.getLoadObjectList();
     for (Iterator itr = l.iterator(); itr.hasNext(); ) {
       LoadObject lo = (LoadObject) itr.next();
       out.print(lo.getBase() + "\t");
       out.print(lo.getSize() / 1024 + "K\t");
       out.println(lo.getName());
     }
   } else {
     if (getDebugeeType() == DEBUGEE_REMOTE) {
       out.println("remote configuration is not yet implemented");
     } else {
       out.println("not yet implemented (debugger does not support CDebugger)!");
     }
   }
 }