hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java
Print this page
rev 611 : Merge
@@ -1,7 +1,7 @@
/*
- * Copyright 2001-2002 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -35,10 +35,11 @@
<P> NOTE that much of the code sharing is achieved by having this
class implement many of the methods in the Win32Debugger and
DbxDebugger interfaces. </P> */
public abstract class DebuggerBase implements Debugger {
+
// May be set lazily, but must be set before calling any of the read
// routines below
protected MachineDescription machDesc;
protected DebuggerUtilities utils;
// Java primitive type sizes, set during bootstrapping. Do not call
@@ -50,10 +51,15 @@
protected long jfloatSize;
protected long jintSize;
protected long jlongSize;
protected long jshortSize;
protected boolean javaPrimitiveTypesConfigured;
+ // heap data.
+ protected long oopSize;
+ protected long heapOopSize;
+ protected long heapBase; // heap base for compressed oops.
+ protected long logMinObjAlignmentInBytes; // Used to decode compressed oops.
// Should be initialized if desired by calling initCache()
private PageCache cache;
// State for faster accessors that don't allocate memory on each read
private boolean useFastAccessors;
@@ -151,10 +157,16 @@
(jshortSize == 2));
javaPrimitiveTypesConfigured = true;
}
+ public void putHeapConst(long heapBase, long heapOopSize, long logMinObjAlignmentInBytes) {
+ this.heapBase = heapBase;
+ this.heapOopSize = heapOopSize;
+ this.logMinObjAlignmentInBytes = logMinObjAlignmentInBytes;
+ }
+
/** May be called by subclasses if desired to initialize the page
cache but may not be overridden */
protected final void initCache(long pageSize, long maxNumPages) {
cache = new PageCache(pageSize, maxNumPages, new Fetcher());
if (machDesc != null) {
@@ -440,10 +452,20 @@
protected long readAddressValue(long address)
throws UnmappedAddressException, UnalignedAddressException {
return readCInteger(address, machDesc.getAddressSize(), true);
}
+ protected long readCompOopAddressValue(long address)
+ throws UnmappedAddressException, UnalignedAddressException {
+ long value = readCInteger(address, getHeapOopSize(), true);
+ if (value != 0) {
+ // See oop.inline.hpp decode_heap_oop
+ value = (long)(heapBase + (long)(value << logMinObjAlignmentInBytes));
+ }
+ return value;
+ }
+
protected void writeAddressValue(long address, long value)
throws UnmappedAddressException, UnalignedAddressException {
writeCInteger(address, machDesc.getAddressSize(), value);
}
@@ -516,6 +538,17 @@
}
public long getJShortSize() {
return jshortSize;
}
+
+ public long getHeapOopSize() {
+ return heapOopSize;
+ }
+
+ public long getHeapBase() {
+ return heapBase;
+ }
+ public long getLogMinObjAlignmentInBytes() {
+ return logMinObjAlignmentInBytes;
+ }
}