sun.jvm.hotspot.utilities.Assert Java Examples

The following examples show how to use sun.jvm.hotspot.utilities.Assert. 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: StackFrameImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public ObjectReference thisObject() {
    validateStackFrame();
    MethodImpl currentMethod = (MethodImpl)location.method();
    if (currentMethod.isStatic() || currentMethod.isNative()) {
        return null;
    }
    if (thisObject == null) {
        StackValueCollection values = saFrame.getLocals();
        if (Assert.ASSERTS_ENABLED) {
            Assert.that(values.size() > 0, "this is missing");
        }
        // 'this' at index 0.
        if (values.get(0).getType() == BasicType.getTConflict()) {
          return null;
        }
        OopHandle handle = values.oopHandleAt(0);
        ObjectHeap heap = vm.saObjectHeap();
        thisObject = vm.objectMirror(heap.newOop(handle));
    }
    return thisObject;
}
 
Example #2
Source File: BasicCDebugInfoDataBase.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** Intended only to be usd by the BasicSym implementation. */
public Sym resolveSym(Sym containingSymbol, Sym targetSym, ResolveListener listener, String detail) {
  if (targetSym == null) return null;
  BasicSym basicTargetSym = (BasicSym) targetSym;
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  if (basicTargetSym.isLazy()) {
    BasicSym resolved = (BasicSym) lazySymMap.get(((LazyBlockSym) targetSym).getKey());
    // FIXME: would like to have an assert here that the target is
    // non-null, but apparently have bugs here
    if (resolved == null) {
      listener.resolveFailed(containingSymbol, (LazyBlockSym) targetSym, detail);
      return targetSym;
    }
    if (resolved.isLazy()) {
      listener.resolveFailed(containingSymbol, (LazyBlockSym) targetSym, detail);
    }
    return resolved;
  }
  return targetSym;
}
 
Example #3
Source File: VirtualMachineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static public VirtualMachineImpl createVirtualMachineForServer(VirtualMachineManager mgr,
                                                            String server,
                                                            int sequenceNumber)
    throws Exception {
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(server != null, "SA VirtualMachineImpl: DebugServer = null is not yet implemented");
    }

    VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
    try {
        myvm.saAgent.attach(server);
        myvm.init();
    } catch (Exception ee) {
        myvm.saAgent.detach();
        throw ee;
    }
    return myvm;
}
 
Example #4
Source File: BasicCDebugInfoDataBase.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Intended only to be usd by the BasicSym implementation. */
public Sym resolveSym(Sym containingSymbol, Sym targetSym, ResolveListener listener, String detail) {
  if (targetSym == null) return null;
  BasicSym basicTargetSym = (BasicSym) targetSym;
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  if (basicTargetSym.isLazy()) {
    BasicSym resolved = (BasicSym) lazySymMap.get(((LazyBlockSym) targetSym).getKey());
    // FIXME: would like to have an assert here that the target is
    // non-null, but apparently have bugs here
    if (resolved == null) {
      listener.resolveFailed(containingSymbol, (LazyBlockSym) targetSym, detail);
      return targetSym;
    }
    if (resolved.isLazy()) {
      listener.resolveFailed(containingSymbol, (LazyBlockSym) targetSym, detail);
    }
    return resolved;
  }
  return targetSym;
}
 
Example #5
Source File: Method.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** Fetch the original non-breakpoint bytecode at the specified
    bci. It is required that there is currently a bytecode at this
    bci. */
public int getOrigBytecodeAt(int bci) {
  BreakpointInfo bp = getMethodHolder().getBreakpoints();
  for (; bp != null; bp = bp.getNext()) {
    if (bp.match(this, bci)) {
      return bp.getOrigBytecode();
    }
  }
  System.err.println("Requested bci " + bci);
  for (; bp != null; bp = bp.getNext()) {
    System.err.println("Breakpoint at bci " + bp.getBCI() + ", bytecode " +
                       bp.getOrigBytecode());
  }
  Assert.that(false, "Should not reach here");
  return -1; // not reached
}
 
Example #6
Source File: DLL.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public CDebugInfoDataBase getDebugInfoDataBase() throws DebuggerException {
  if (db != null) {
    return db;
  }

  // Try to parse
  if (dbg == null) {
    return null; // Need WindbgDebugger
  }

  if (Assert.ASSERTS_ENABLED) {
    Assert.that(fullPathName != null, "Need full path name to build debug info database");
  }

  db = new WindbgCDebugInfoBuilder(dbg).buildDataBase(fullPathName, addr);
  return db;
}
 
Example #7
Source File: StackFrameImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public ObjectReference thisObject() {
    validateStackFrame();
    MethodImpl currentMethod = (MethodImpl)location.method();
    if (currentMethod.isStatic() || currentMethod.isNative()) {
        return null;
    }
    if (thisObject == null) {
        StackValueCollection values = saFrame.getLocals();
        if (Assert.ASSERTS_ENABLED) {
            Assert.that(values.size() > 0, "this is missing");
        }
        // 'this' at index 0.
        if (values.get(0).getType() == BasicType.getTConflict()) {
          return null;
        }
        OopHandle handle = values.oopHandleAt(0);
        ObjectHeap heap = vm.saObjectHeap();
        thisObject = vm.objectMirror(heap.newOop(handle));
    }
    return thisObject;
}
 
Example #8
Source File: DLL.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public CDebugInfoDataBase getDebugInfoDataBase() throws DebuggerException {
  if (db != null) {
    return db;
  }

  // Try to parse
  if (dbg == null) {
    return null; // Need WindbgDebugger
  }

  if (Assert.ASSERTS_ENABLED) {
    Assert.that(fullPathName != null, "Need full path name to build debug info database");
  }

  db = new WindbgCDebugInfoBuilder(dbg).buildDataBase(fullPathName, addr);
  return db;
}
 
Example #9
Source File: Method.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Fetch the original non-breakpoint bytecode at the specified
    bci. It is required that there is currently a bytecode at this
    bci. */
public int getOrigBytecodeAt(int bci) {
  BreakpointInfo bp = getMethodHolder().getBreakpoints();
  for (; bp != null; bp = bp.getNext()) {
    if (bp.match(this, bci)) {
      return bp.getOrigBytecode();
    }
  }
  System.err.println("Requested bci " + bci);
  for (; bp != null; bp = bp.getNext()) {
    System.err.println("Breakpoint at bci " + bp.getBCI() + ", bytecode " +
                       bp.getOrigBytecode());
  }
  Assert.that(false, "Should not reach here");
  return -1; // not reached
}
 
Example #10
Source File: VirtualMachineImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static public VirtualMachineImpl createVirtualMachineForCorefile(VirtualMachineManager mgr,
                                                                 String javaExecutableName,
                                                                 String coreFileName,
                                                                 int sequenceNumber)
    throws Exception {
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(coreFileName != null, "SA VirtualMachineImpl: core filename = null is not yet implemented");
    }
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(javaExecutableName != null, "SA VirtualMachineImpl: java executable = null is not yet implemented");
    }

    VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
    try {
        myvm.saAgent.attach(javaExecutableName, coreFileName);
        myvm.init();
    } catch (Exception ee) {
        myvm.saAgent.detach();
        throw ee;
    }
    return myvm;
}
 
Example #11
Source File: VirtualMachineImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static public VirtualMachineImpl createVirtualMachineForServer(VirtualMachineManager mgr,
                                                            String server,
                                                            int sequenceNumber)
    throws Exception {
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(server != null, "SA VirtualMachineImpl: DebugServer = null is not yet implemented");
    }

    VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
    try {
        myvm.saAgent.attach(server);
        myvm.init();
    } catch (Exception ee) {
        myvm.saAgent.detach();
        throw ee;
    }
    return myvm;
}
 
Example #12
Source File: BasicCDebugInfoDataBase.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** Supports lazy instantiation and references between types and
    symbols via insertion using arbitrary Object keys that are
    wrapped by LazyTypes. Once the database has been fully
    constructed and all types are present, one should call
    resolveTypes(), which will resolve all LazyTypes down to
    concrete types (and signal an error if some lazy types were
    unresolved). */
public void beginConstruction() {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == INITIALIZED_STATE, "wrong state");
  }
  state   = CONSTRUCTION_STATE;

  // Types
  lazyTypeMap  = new HashMap();
  types        = new ArrayList();

  // Symbols
  lazySymMap   = new HashMap();
  blocks       = new ArrayList();
  nameToSymMap = new HashMap();

  // Line numbers
  lineNumbers  = new BasicLineNumberMapping();
}
 
Example #13
Source File: VirtualMachineImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static public VirtualMachineImpl createVirtualMachineForServer(VirtualMachineManager mgr,
                                                            String server,
                                                            int sequenceNumber)
    throws Exception {
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(server != null, "SA VirtualMachineImpl: DebugServer = null is not yet implemented");
    }

    VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
    try {
        myvm.saAgent.attach(server);
        myvm.init();
    } catch (Exception ee) {
        myvm.saAgent.detach();
        throw ee;
    }
    return myvm;
}
 
Example #14
Source File: VirtualMachineImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static public VirtualMachineImpl createVirtualMachineForCorefile(VirtualMachineManager mgr,
                                                                 String javaExecutableName,
                                                                 String coreFileName,
                                                                 int sequenceNumber)
    throws Exception {
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(coreFileName != null, "SA VirtualMachineImpl: core filename = null is not yet implemented");
    }
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(javaExecutableName != null, "SA VirtualMachineImpl: java executable = null is not yet implemented");
    }

    VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
    try {
        myvm.saAgent.attach(javaExecutableName, coreFileName);
        myvm.init();
    } catch (Exception ee) {
        myvm.saAgent.detach();
        throw ee;
    }
    return myvm;
}
 
Example #15
Source File: BasicCDebugInfoDataBase.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** Supports lazy instantiation and references between types and
    symbols via insertion using arbitrary Object keys that are
    wrapped by LazyTypes. Once the database has been fully
    constructed and all types are present, one should call
    resolveTypes(), which will resolve all LazyTypes down to
    concrete types (and signal an error if some lazy types were
    unresolved). */
public void beginConstruction() {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == INITIALIZED_STATE, "wrong state");
  }
  state   = CONSTRUCTION_STATE;

  // Types
  lazyTypeMap  = new HashMap();
  types        = new ArrayList();

  // Symbols
  lazySymMap   = new HashMap();
  blocks       = new ArrayList();
  nameToSymMap = new HashMap();

  // Line numbers
  lineNumbers  = new BasicLineNumberMapping();
}
 
Example #16
Source File: StackFrameImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public ObjectReference thisObject() {
    validateStackFrame();
    MethodImpl currentMethod = (MethodImpl)location.method();
    if (currentMethod.isStatic() || currentMethod.isNative()) {
        return null;
    }
    if (thisObject == null) {
        StackValueCollection values = saFrame.getLocals();
        if (Assert.ASSERTS_ENABLED) {
            Assert.that(values.size() > 0, "this is missing");
        }
        // 'this' at index 0.
        if (values.get(0).getType() == BasicType.getTConflict()) {
          return null;
        }
        OopHandle handle = values.oopHandleAt(0);
        ObjectHeap heap = vm.saObjectHeap();
        thisObject = vm.objectMirror(heap.newOop(handle));
    }
    return thisObject;
}
 
Example #17
Source File: Method.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** Fetch the original non-breakpoint bytecode at the specified
    bci. It is required that there is currently a bytecode at this
    bci. */
public int getOrigBytecodeAt(int bci) {
  BreakpointInfo bp = getMethodHolder().getBreakpoints();
  for (; bp != null; bp = bp.getNext()) {
    if (bp.match(this, bci)) {
      return bp.getOrigBytecode();
    }
  }
  System.err.println("Requested bci " + bci);
  for (; bp != null; bp = bp.getNext()) {
    System.err.println("Breakpoint at bci " + bp.getBCI() + ", bytecode " +
                       bp.getOrigBytecode());
  }
  Assert.that(false, "Should not reach here");
  return -1; // not reached
}
 
Example #18
Source File: DLL.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public CDebugInfoDataBase getDebugInfoDataBase() throws DebuggerException {
  if (db != null) {
    return db;
  }

  // Try to parse
  if (dbg == null) {
    return null; // Need WindbgDebugger
  }

  if (Assert.ASSERTS_ENABLED) {
    Assert.that(fullPathName != null, "Need full path name to build debug info database");
  }

  db = new WindbgCDebugInfoBuilder(dbg).buildDataBase(fullPathName, addr);
  return db;
}
 
Example #19
Source File: VirtualMachineImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static public VirtualMachineImpl createVirtualMachineForCorefile(VirtualMachineManager mgr,
                                                                 String javaExecutableName,
                                                                 String coreFileName,
                                                                 int sequenceNumber)
    throws Exception {
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(coreFileName != null, "SA VirtualMachineImpl: core filename = null is not yet implemented");
    }
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(javaExecutableName != null, "SA VirtualMachineImpl: java executable = null is not yet implemented");
    }

    VirtualMachineImpl myvm = new VirtualMachineImpl(mgr, sequenceNumber);
    try {
        myvm.saAgent.attach(javaExecutableName, coreFileName);
        myvm.init();
    } catch (Exception ee) {
        myvm.saAgent.detach();
        throw ee;
    }
    return myvm;
}
 
Example #20
Source File: BasicCDebugInfoDataBase.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void endConstruction() {
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == RESOLVED_STATE, "wrong state");
  }
  // Move all types to type list
  for (Iterator iter = lazyTypeMap.values().iterator(); iter.hasNext(); ) {
    types.add(iter.next());
  }
  // Build name-to-type map
  nameToTypeMap = new HashMap();
  for (Iterator iter = types.iterator(); iter.hasNext(); ) {
    Type t = (Type) iter.next();
    if (!t.isConst() && !t.isVolatile()) {
      nameToTypeMap.put(t.getName(), t);
    }
  }
  // Lose lazy maps
  lazyTypeMap = null;
  lazySymMap  = null;
  // Sort and finish line number information
  lineNumbers.sort();
  // FIXME: on some platforms it might not be necessary to call
  // recomputeEndPCs(). Will have to see what stabs information
  // looks like. Should make configurable whether we make this call
  // or not.
  lineNumbers.recomputeEndPCs();

  state = COMPLETE_STATE;
}
 
Example #21
Source File: COFFFileParser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public int getBlockEndOffset() {
  symSeek(4);
  int offs = readInt();
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(offs != 0, "should not have null end offset for block symbols");
  }
  return base + offs;
}
 
Example #22
Source File: ReferenceTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected ReferenceTypeImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Klass klass) {
    super(aVm);
    saKlass = klass;
    typeNameSymbol = saKlass.getName();
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(typeNameSymbol != null, "null type name for a Klass");
    }
}
 
Example #23
Source File: CommandProcessor.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        Assert.ASSERTS_ENABLED = Boolean.valueOf(t.nextToken()).booleanValue();
    }
}
 
Example #24
Source File: CommandProcessor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void doit(Tokens t) {
    if (t.countTokens() != 1) {
        usage();
    } else {
        Assert.ASSERTS_ENABLED = Boolean.valueOf(t.nextToken()).booleanValue();
    }
}
 
Example #25
Source File: ReferenceTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected ReferenceTypeImpl(VirtualMachine aVm, sun.jvm.hotspot.oops.Klass klass) {
    super(aVm);
    saKlass = klass;
    typeNameSymbol = saKlass.getName();
    if (Assert.ASSERTS_ENABLED) {
        Assert.that(typeNameSymbol != null, "null type name for a Klass");
    }
}
 
Example #26
Source File: COFFFileParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public int getBlockEndOffset() {
  symSeek(4);
  int offs = readInt();
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(offs != 0, "should not have null end offset for block symbols");
  }
  return base + offs;
}
 
Example #27
Source File: COFFFileParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public int getThunkEndOffset() {
  symSeek(4);
  int offs = readInt();
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(offs != 0, "should not have null end offset for thunk symbols");
  }
  return base + offs;
}
 
Example #28
Source File: COFFFileParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public int getLGProcEndOffset() {
  symSeek(4);
  int offs = readInt();
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(offs != 0, "should not have null end offset for procedure symbols");
  }
  return base + offs;
}
 
Example #29
Source File: BasicCDebugInfoDataBase.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** Intended only to be usd by the BasicSym implementation. */
public Type resolveType(Sym containingSymbol, Type targetType, ResolveListener listener, String detail) {
  BasicType basicTargetType = (BasicType) targetType;
  if (Assert.ASSERTS_ENABLED) {
    Assert.that(state == CONSTRUCTION_STATE, "wrong state");
  }
  if (basicTargetType.isLazy()) {
    BasicType resolved = (BasicType) lazyTypeMap.get(((LazyType) targetType).getKey());
    // FIXME: would like to have an assert here that the target is
    // non-null, but apparently have bugs here
    if (resolved == null) {
      listener.resolveFailed(containingSymbol, (LazyType) targetType, detail);
      return targetType;
    }
    if (resolved.isLazy()) {
      // Might happen for const/var variants for forward references
      if (resolved.isConst() || resolved.isVolatile()) {
        resolved = (BasicType) resolved.resolveTypes(this, listener);
      }
      if (resolved.isLazy()) {
        listener.resolveFailed(containingSymbol, (LazyType) targetType, detail);
      }
    }
    return resolved;
  }
  return targetType;
}
 
Example #30
Source File: BasicBitType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
Type resolveTypes(BasicCDebugInfoDataBase db, ResolveListener listener) {
  super.resolveTypes(db, listener);
  underlyingType = db.resolveType(this, underlyingType, listener, "resolving bit type");
  setName(underlyingType.getName());
  if (Assert.ASSERTS_ENABLED) {
    BasicType b = (BasicType) underlyingType;
    Assert.that(b.isLazy() || b.isInt(),
                "Underlying type of bitfield must be integer type (or unresolved due to error)");
  }
  return this;
}