use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class ACCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
if (command.equalsIgnoreCase("!acforobject")) {
if (null == heapRegionManager) {
MM_HeapRegionManagerPointer hrmPointer;
hrmPointer = MM_GCExtensionsPointer.cast(vm.gcExtensions()).heapRegionManager();
heapRegionManager = GCHeapRegionManager.fromHeapRegionManager(hrmPointer);
}
if (args.length < 1) {
throw new DDRInteractiveCommandException("Invalid number of arguments specified.");
}
long addr = Long.decode(args[0]);
J9ObjectPointer objectPointer = J9ObjectPointer.cast(addr);
dumpACForObject(vm, objectPointer, out);
} else {
MM_GCExtensionsPointer gcExtensions = MM_GCExtensionsPointer.cast(vm.gcExtensions());
if (args.length < 1) {
throw new DDRInteractiveCommandException("Invalid number of arguments specified.");
}
boolean dumpACExternalReferences = false;
boolean dumpOwnedRegions = false;
for (int i = 1; i < args.length; i++) {
String arg = args[i];
if (arg.equalsIgnoreCase("xrefs")) {
dumpACExternalReferences = true;
} else if (arg.equalsIgnoreCase("ownedRegions")) {
dumpOwnedRegions = true;
} else {
throw new DDRInteractiveCommandException("Unrecognized acforobject subcommand -->" + arg);
}
}
long addr = Long.decode(args[0]);
MM_AllocationContextPointer ac = MM_AllocationContextPointer.cast(addr);
if (dumpACExternalReferences) {
// TODO: handle other AC types
if (GCExtensions.isVLHGC()) {
context.execute("!mm_allocationcontexttarok", new String[] { args[0] }, out);
}
dumpLiveReferences(vm, ac, out);
}
if (dumpOwnedRegions) {
dumpOwnedRegions(vm, ac, out);
}
}
} catch (DDRInteractiveCommandException e) {
throw e;
} catch (Throwable e) {
e.printStackTrace(out);
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class AnalyseRomClassUTF8Command method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
try {
boolean printUTF8WeightList = false;
int maxDistributionPercent = 85;
if ((args.length >= 1) && (args[0].equals("UTF8WeightList"))) {
printUTF8WeightList = true;
}
for (int i = 0; i < args.length; i++) {
if (args[i].endsWith("%")) {
try {
// Parses the maxDistribution string such as 85%
maxDistributionPercent = DecimalFormat.getInstance().parse(args[i]).intValue();
} catch (ParseException e) {
out.println("Usage: !analyseromClassutf8 [UTF8WeightList] [maxDistribution%] maxDistribution defaults to 85%");
}
}
}
Statistics statistics = new Statistics();
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
ROMClassesIterator classSegmentIterator = new ROMClassesIterator(out, vm.classMemorySegments());
J9ObjectPointer bootstraploader = vm.systemClassLoader().classLoaderObject();
while (classSegmentIterator.hasNext()) {
J9ROMClassPointer classPointer = (J9ROMClassPointer) classSegmentIterator.next();
ClassWalker classWalker = new RomClassWalker(classPointer, context);
LinearDumper linearDumper = new LinearDumper();
J9ClassRegionNode allRegionsNode = linearDumper.getAllRegions(classWalker);
statistics.add(allRegionsNode, classSegmentIterator, bootstraploader);
}
statistics.getResult(printUTF8WeightList, maxDistributionPercent, out);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class DumpStringTableCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
Set<J9ObjectPointer> stringTableObjects = null;
try {
stringTableObjects = getStringTableObjects();
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e.getMessage(), e);
}
for (J9ObjectPointer objectPointer : stringTableObjects) {
String value = "**CORRUPT STRING TABLE ELEMENT **";
try {
value = J9ObjectHelper.stringValue(objectPointer);
} catch (CorruptDataException e) {
// ignore
}
String hexAddr = objectPointer.formatShortInteractive();
out.println(String.format("%s value = <%s>", hexAddr, value));
}
out.println("Table Size = " + stringTableObjects.size());
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class CompressedRefMappingCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (args.length == 0) {
printHelp(out);
return;
}
long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
VoidPointer ptr = VoidPointer.cast(address);
if (command.startsWith("!fj9object")) {
J9ObjectPointer mappedValue;
if (J9BuildFlags.gc_compressedPointers) {
mappedValue = ObjectAccessBarrier.convertPointerFromToken(ptr.getAddress());
} else {
mappedValue = J9ObjectPointer.cast(ptr);
}
if (command.startsWith("!fj9objecttoj9object")) {
out.println(String.format("!fj9object %s -> !j9object %s", ptr.getHexAddress(), mappedValue.getHexAddress()));
} else {
context.execute("!j9object", new String[] { mappedValue.getHexAddress() }, out);
}
} else {
long tokenValue;
if (J9BuildFlags.gc_compressedPointers) {
tokenValue = ObjectAccessBarrier.convertTokenFromPointer(J9ObjectPointer.cast(ptr));
} else {
tokenValue = ptr.getAddress();
}
out.println(String.format("!j9object %s -> !fj9object 0x%s\n", ptr.getHexAddress(), Long.toHexString(tokenValue)));
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class HashCodeCommand method run.
public void run(String command, String[] args, Context context, final PrintStream out) throws DDRInteractiveCommandException {
if (args.length != 1) {
throw new DDRInteractiveCommandException("This debug extension needs a single address argument: !hashcode <object addr>");
}
long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
final J9ObjectPointer objectPointer = J9ObjectPointer.cast(address);
try {
J9ClassPointer clazz = J9ObjectHelper.clazz(objectPointer);
if (!J9ClassHelper.hasValidEyeCatcher(clazz)) {
throw new DDRInteractiveCommandException("object class is not valid (eyecatcher is not 0x99669966)");
}
} catch (CorruptDataException cde) {
throw new DDRInteractiveCommandException("memory fault de-referencing address argument", cde);
}
try {
out.println(ObjectModel.getObjectHashCode(objectPointer).getHexValue());
} catch (CorruptDataException cde) {
throw new DDRInteractiveCommandException("error calculating hashcode", cde);
}
}
Aggregations