use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class GpInfoCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
long vmAddress = context.vmAddress;
try {
long j9rasAddress = CommandUtils.followPointerFromStructure(context, "J9JavaVM", vmAddress, "j9ras");
long crashInfoAddress = CommandUtils.followPointerFromStructure(context, "J9RAS", j9rasAddress, "crashInfo");
if (crashInfoAddress != 0l) {
long failingThread = CommandUtils.followPointerFromStructure(context, "J9RASCrashInfo", crashInfoAddress, "failingThread");
long failingThreadID = CommandUtils.followPointerFromStructure(context, "J9RASCrashInfo", crashInfoAddress, "failingThreadID");
long gpinfo = CommandUtils.followPointerFromStructure(context, "J9RASCrashInfo", crashInfoAddress, "gpInfo");
out.println("Failing Thread: !j9vmthread 0x" + Long.toHexString(failingThread));
out.println("Failing Thread ID: 0x" + Long.toHexString(failingThreadID) + " (" + failingThreadID + ")");
out.println("gpInfo:");
out.println(CommandUtils.getCStringAtAddress(context.process, gpinfo));
} else {
out.println("Core does not appear to have been triggered by a gpf. No J9RASCrashInfo found.");
}
} catch (MemoryFault e) {
throw new DDRInteractiveCommandException(e);
} catch (com.ibm.j9ddr.NoSuchFieldException e) {
throw new DDRInteractiveCommandException(e);
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class PluginCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (args.length == 0) {
out.println("\n");
out.println("Error, all plugin commands require one or more parameters, see !plugins help for more information");
return;
}
if (commands.containsKey(args[0])) {
try {
commands.get(args[0]).invoke(this, new Object[] { args, context, out });
} catch (InvocationTargetException e) {
// likely to have originally been a DDRInteractiveCommandException
throw new DDRInteractiveCommandException(e.getCause().getMessage());
} catch (Exception e) {
throw new DDRInteractiveCommandException(e.getMessage());
}
} else {
out.println(COMMAND_NAME + " " + command + " was not recognised, run " + COMMAND_NAME + " " + COMMAND_HELP + " to see all available options");
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class ThreadsCommand method debugEventData.
private void debugEventData(PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9VMThreadPointer mainThread = vm.mainThread();
if (mainThread.notNull()) {
J9VMThreadPointer threadCursor = vm.mainThread();
do {
//
out.append(String.format(" !j9vmthread 0x%s %s %s %s %s %s %s %s %s", Long.toHexString(threadCursor.getAddress()), Long.toHexString(threadCursor.debugEventData1().longValue()), Long.toHexString(threadCursor.debugEventData2().longValue()), Long.toHexString(threadCursor.debugEventData3().longValue()), Long.toHexString(threadCursor.debugEventData4().longValue()), Long.toHexString(threadCursor.debugEventData5().longValue()), Long.toHexString(threadCursor.debugEventData6().longValue()), Long.toHexString(threadCursor.debugEventData7().longValue()), Long.toHexString(threadCursor.debugEventData8().longValue())));
out.append(nl);
threadCursor = threadCursor.linkNext();
} while (!threadCursor.eq(mainThread));
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class CoreInfoCommand method run.
/**
* Run method for !coreinfo extension.
*
* @param command !coreinfo
* @param args args passed by !coreinfo extension.
* @param context Context of current core file.
* @param out PrintStream to print the output to the console.
* @throws DDRInteractiveCommandException
*/
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (0 < args.length) {
out.println("!coreinfo expects no args. Usage :");
printUsage(out);
return;
}
J9JavaVMPointer vm;
try {
J9RASPointer ras = DataType.getJ9RASPointer();
vm = J9RASHelper.getVM(ras);
IProcess process = vm.getProcess();
J9DDRImageProcess ddrProcess = new J9DDRImageProcess(process);
try {
/* Print the command line of a running program that generated core file */
out.println("COMMANDLINE\n" + ddrProcess.getCommandLine() + "\n");
} catch (DataUnavailable e) {
/*For Zos core files, commandline is not available */
out.println("COMMANDLINE is not available\n");
} catch (com.ibm.dtfj.image.CorruptDataException e) {
throw new DDRInteractiveCommandException("CorruptDataException occured while getting the commandline from process");
}
Properties properties = J9JavaVMHelper.getSystemProperties(vm);
/* Print VM service level info */
out.println("JAVA SERVICE LEVEL INFO\n" + ras.serviceLevel().getCStringAtOffset(0));
/* Print Java Version Info */
out.println("JAVA VERSION INFO\n" + properties.get("java.fullversion"));
/* Print Java VM Version Info */
out.println("JAVA VM VERSION\t- " + properties.get("java.vm.version") + "\n");
/* Print Platform Info */
boolean is64BitPlatform = (process.bytesPerPointer() == 8) ? true : false;
ICore core = vm.getProcess().getAddressSpace().getCore();
Platform platform = core.getPlatform();
out.println("PLATFORM INFO");
out.print("Platform Name :\t" + platform.name());
if (is64BitPlatform) {
out.println(" 64Bit");
} else {
out.println(" 32Bit");
}
out.println("OS Level\t: " + ras.osnameEA().getCStringAtOffset(0) + " " + ras.osversionEA().getCStringAtOffset(0));
out.println("Processors -");
out.println(" Architecture\t: " + ras.osarchEA().getCStringAtOffset(0));
out.println(" How Many\t: " + ras.cpus().longValue());
try {
properties = ddrProcess.getEnvironment();
Enumeration processPropEnum = properties.keys();
out.println("\nENVIRONMENT VARIABLES");
while (processPropEnum.hasMoreElements()) {
String key = (String) processPropEnum.nextElement();
out.println(key + "=" + properties.get(key));
}
} catch (com.ibm.dtfj.image.CorruptDataException e) {
throw new DDRInteractiveCommandException("CorruptDataException occured while getting the environment variables from process");
} catch (DataUnavailable e) {
out.println("Environment variables are not available\n");
}
} catch (CorruptDataException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException in project openj9 by eclipse.
the class DumpAllRamClassLinearCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
long nestingThreashold;
if (args.length > 1) {
throw new DDRInteractiveCommandException("This debug extension accepts none or one argument!");
} else if (args.length == 1) {
nestingThreashold = Long.valueOf(args[0]);
} else {
nestingThreashold = 1;
}
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
if (null != vm) {
out.println();
out.println("!j9javavm " + vm.getHexAddress());
} else {
throw new DDRInteractiveCommandException("Unable to find the VM in core dump!");
}
out.println();
ClassSegmentIterator classSegmentIterator = new ClassSegmentIterator(vm.classMemorySegments());
while (classSegmentIterator.hasNext()) {
J9ClassPointer classPointer = (J9ClassPointer) classSegmentIterator.next();
out.println("!dumpramclasslinear " + classPointer.getHexAddress());
// RAM Class 'org/apache/tomcat/util/buf/MessageBytes' at 0x0DCF9008:
out.println(String.format("RAM Class '%s' at %s", J9ClassHelper.getJavaName(classPointer), classPointer.getHexAddress()));
out.println();
ClassWalker classWalker = new RamClassWalker(classPointer, context);
new LinearDumper().gatherLayoutInfo(out, classWalker, nestingThreashold);
out.println();
}
} catch (CorruptDataException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
Aggregations