use of com.ibm.j9ddr.corereaders.memory.IProcess in project openj9 by eclipse.
the class AIXDumpReader method readModules.
//
// // NOTE modules must be read before thread information in order to
// properly support stack traces.
// // Thread information is required before building the process, so the
// following order must be maintained:
// // 1) Read module information.
// // 2) Read thread information.
// // 3) Build process.
// List<J9DDRImageModule> modules = getModules(addressSpace);
// J9DDRImageModule executable = null;
// if (!modules.isEmpty()) {
// executable = modules.get(0);
// }
// List<J9DDRImageThread> threads = readThreads(addressSpace);
// //the current thread is parsed before the rest so it is put first
// J9DDRImageThread currentThread = threads.get(0);
//
// // Get the process environment variables
// Properties environment = new Properties();
// //on AIX, we should truse the env var pointer found in the core and
// ignore whatever the XML told us it is since this internal value is more
// likely correct
// environment = getEnvironmentVariables(reg5);
//
// J9DDRImageProcess process = new J9DDRImageProcess(String.valueOf(pid),
// commandLine, environment, currentThread, threads, executable, modules,
// pointerSize());
// process.setAddressSpace(addressSpace);
// process.setMemory(getMemory());
// return process;
// }
private void readModules() throws IOException {
int next = 0;
long current = _loaderOffset;
if (coreFile == null) {
resolver = LibraryResolverFactory.getResolverForCoreFile(_fileReader);
} else {
resolver = LibraryResolverFactory.getResolverForCoreFile(coreFile);
}
IProcess proc = getProcess();
boolean firstModule = true;
do {
current += next;
seek(current);
next = readInt();
// Ignore flags
readLoaderInfoFlags();
// Ignore dataOffset
readAddress();
long textVirtualAddress = readAddress();
long textSize = readAddress();
long dataVirtualAddress = readAddress();
long dataSize = readAddress();
String fileName = readString();
String objectName = readString();
String moduleName = fileName;
if (0 < objectName.length()) {
moduleName += "(" + objectName + ")";
}
loadModule(resolver, proc, textVirtualAddress, textSize, dataVirtualAddress, dataSize, fileName, objectName, moduleName, firstModule);
firstModule = false;
} while (0 != next && current + next < _loaderOffset + _loaderSize);
}
use of com.ibm.j9ddr.corereaders.memory.IProcess in project openj9 by eclipse.
the class MemoryRangesCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
IProcess process = context.process;
String format = "0x%0" + (process.bytesPerPointer() * 2) + "x%" + (16 - process.bytesPerPointer()) + "s";
Collection<? extends IMemoryRange> ranges = process.getMemoryRanges();
if (ranges != null && !ranges.isEmpty()) {
out.println("Base Top Size");
for (IMemoryRange range : ranges) {
out.print(String.format(format, range.getBaseAddress(), " "));
out.print(String.format(format, range.getTopAddress(), " "));
out.print(String.format(format, range.getSize(), " "));
out.print("\n");
}
} else {
out.println("No memory ranges found (Note: this has not yet been implemented for execution from a native debugger such as gdb)");
}
}
use of com.ibm.j9ddr.corereaders.memory.IProcess in project openj9 by eclipse.
the class VMRegMapHelper method printRegisters.
/**
* This method find out which platform core file is generated
* and calls the method that prints that specific platforms registers.
* @param vm J9JavaVMPointer instance of vm from core file.
* @param level Level of registers to be printed.
* @param out PrintStream to print the output to the console.
* @throws UnknownArchitectureException In the case of unidentified platform of core file.
*/
public static void printRegisters(J9JavaVMPointer vm, int level, PrintStream out) throws UnknownArchitectureException {
IProcess process = vm.getProcess();
ICore core = process.getAddressSpace().getCore();
Platform platform = core.getPlatform();
boolean is64BitPlatform = (process.bytesPerPointer() == 8) ? true : false;
switch(platform) {
case AIX:
if (is64BitPlatform) {
printRegistersForAIX64BitPPC(level, out);
} else {
printRegistersForAIX32BitPPC(level, out);
}
break;
case LINUX:
String processorType = core.getProperties().getProperty(ICore.PROCESSOR_TYPE_PROPERTY);
if (is64BitPlatform) {
if (processorType.equals("amd64")) {
printRegistersForLinux64BitAMD64(level, out);
} else if (processorType.equals("ppc")) {
printRegistersForLinux64BitPPC(level, out);
} else if (processorType.equals("s390")) {
printRegistersForLinux64BitS390(level, out);
}
} else {
if (processorType.equals("x86")) {
printRegistersForLinux32BitX86(level, out);
} else if (processorType.equals("ppc")) {
printRegistersForLinux32BitPPC(level, out);
} else if (processorType.equals("s390")) {
printRegistersForLinux32BitS390(level, out);
}
}
break;
case WINDOWS:
if (is64BitPlatform) {
printRegistersForWindows64Bit(level, out);
} else {
printRegistersForWindows32Bit(level, out);
}
break;
case ZOS:
if (is64BitPlatform) {
printRegistersForZOS64BitS390(level, out);
} else {
printRegistersForZOS32BitS390(level, out);
}
break;
default:
throw new UnknownArchitectureException(process, "Could not determine platform of core file.");
}
}
Aggregations