本文整理汇总了Java中sun.jvm.hotspot.debugger.Address.getAddressAt方法的典型用法代码示例。如果您正苦于以下问题:Java Address.getAddressAt方法的具体用法?Java Address.getAddressAt怎么用?Java Address.getAddressAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.jvm.hotspot.debugger.Address
的用法示例。
在下文中一共展示了Address.getAddressAt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: at
import sun.jvm.hotspot.debugger.Address; //导入方法依赖的package包/类
private HeapRegion at(long index) {
Address arrayAddr = regionsField.getValue(addr);
// Offset of &_region[index]
long offset = index * VM.getVM().getAddressSize();
Address regionAddr = arrayAddr.getAddressAt(offset);
return (HeapRegion) VMObjectFactory.newObject(HeapRegion.class,
regionAddr);
}
示例2: getAddressAt
import sun.jvm.hotspot.debugger.Address; //导入方法依赖的package包/类
protected Address getAddressAt(int index) {
if (index < 0 || index >= length()) throw new ArrayIndexOutOfBoundsException(index);
Type elemType = getElemType();
if (getElemType().isCIntegerType()) throw new RuntimeException("elemType must not be of CInteger type");
Address data = getAddress().addOffsetTo(dataFieldOffset);
long elemSize = elemType.getSize();
return data.getAddressAt(index * elemSize);
}
示例3: at
import sun.jvm.hotspot.debugger.Address; //导入方法依赖的package包/类
private HeapRegion at(long index) {
Address arrayAddr = baseField.getValue(addr);
// Offset of &_base[index]
long offset = index * VM.getVM().getAddressSize();
Address regionAddr = arrayAddr.getAddressAt(offset);
return (HeapRegion) VMObjectFactory.newObject(HeapRegion.class,
regionAddr);
}
示例4: doit
import sun.jvm.hotspot.debugger.Address; //导入方法依赖的package包/类
public void doit(Tokens t) {
if (t.countTokens() != 1) {
usage();
} else {
String arg = t.nextToken();
Matcher m1 = args1.matcher(arg);
Matcher m2 = args2.matcher(arg);
Address start = null;
Address end = null;
String format = "";
int formatSize = (int)VM.getVM().getAddressSize();
if (m1.matches()) {
start = VM.getVM().getDebugger().parseAddress(m1.group(1));
int count = 1;
if (m1.group(2) != null) {
count = Integer.parseInt(m1.group(3));
}
end = start.addOffsetTo(count * formatSize);
} else if (m2.matches()) {
start = VM.getVM().getDebugger().parseAddress(m2.group(1));
end = VM.getVM().getDebugger().parseAddress(m2.group(2));
} else {
usage();
return;
}
int line = 80;
int formatWidth = formatSize * 8 / 4 + 2;
out.print(fill(start, formatWidth));
out.print(": ");
int width = line - formatWidth - 2;
boolean needsPrintln = true;
while (start != null && start.lessThan(end)) {
Address val = start.getAddressAt(0);
out.print(fill(val, formatWidth));
needsPrintln = true;
width -= formatWidth;
start = start.addOffsetTo(formatSize);
if (width <= formatWidth) {
out.println();
needsPrintln = false;
if (start.lessThan(end)) {
out.print(fill(start, formatWidth));
out.print(": ");
width = line - formatWidth - 2;
}
} else {
out.print(" ");
width -= 1;
}
}
if (needsPrintln) {
out.println();
}
}
}
示例5: findDynamicTypeForAddress
import sun.jvm.hotspot.debugger.Address; //导入方法依赖的package包/类
public Type findDynamicTypeForAddress(Address addr, Type baseType) {
// This implementation should be suitably platform-independent; we
// search nearby memory for the vtbl value of the given type.
if (vtblForType(baseType) == null) {
// Type was not polymorphic which is an error of some sort
throw new InternalError(baseType + " does not appear to be polymorphic");
}
// This is a more restricted version of guessTypeForAddress since
// that function has some limitations since it doesn't really know
// where in the hierarchy a virtual type starts and just poking
// around in memory is likely to trip over some vtable address,
// resulting in false positives. Eventually all uses should
// switch to this logic but in the interests of stability it will
// be separate for the moment.
// Assuming that the base type is truly the first polymorphic type
// then the vtbl for all subclasss should be at several defined
// locations so only those locations will be checked. It's also
// required that the caller knows that the static type is at least
// baseType. See the notes in guessTypeForAddress for the logic of
// the locations searched.
Address loc1 = addr.getAddressAt(0);
Address loc2 = null;
Address loc3 = null;
long offset2 = baseType.getSize();
// I don't think this should be misaligned under any
// circumstances, but I'm not sure (FIXME: also not sure which
// way to go here, up or down -- assuming down)
offset2 = offset2 - (offset2 % getAddressSize()) - getAddressSize();
if (offset2 > 0) {
loc2 = addr.getAddressAt(offset2);
}
long offset3 = offset2 - getAddressSize();
if (offset3 > 0) {
loc3 = addr.getAddressAt(offset3);
}
Type loc2Match = null;
Type loc3Match = null;
for (Iterator iter = getTypes(); iter.hasNext(); ) {
Type type = (Type) iter.next();
Type superClass = type;
while (superClass != baseType && superClass != null) {
superClass = superClass.getSuperclass();
}
if (superClass == null) continue;
Address vtblAddr = vtblForType(type);
if (vtblAddr == null) {
// This occurs sometimes for intermediate types that are never
// instantiated.
if (DEBUG) {
System.err.println("null vtbl for " + type);
}
continue;
}
// Prefer loc1 match
if (vtblAddr.equals(loc1)) return type;
if (loc2 != null && loc2Match == null && vtblAddr.equals(loc2)) {
loc2Match = type;
}
if (loc3 != null && loc3Match == null && vtblAddr.equals(loc3)) {
loc3Match = type;
}
}
if (loc2Match != null) return loc2Match;
if (loc3Match != null) return loc3Match;
return null;
}