use of com.ibm.dtfj.image.ImageModule in project openj9 by eclipse.
the class ImageModuleComparator method testEquals.
// getName()
// getProperties()
// getSections()
// getSymbols()
public void testEquals(Object ddrObject, Object jextractObject, int members) {
ImageModule ddrImageModule = (ImageModule) ddrObject;
ImageModule jextractImageModule = (ImageModule) jextractObject;
// getName()
if ((NAME & members) != 0) {
testJavaEquals(ddrImageModule, jextractImageModule, "getName");
}
// getProperties
if ((PROPERTIES & members) != 0) {
testPropertiesEquals(ddrImageModule, jextractImageModule, "getProperties");
}
// getSections
if ((SECTIONS & members) != 0) {
new ImageSectionComparator().testComparatorIteratorEquals(ddrImageModule, jextractImageModule, "getSections", ImageSection.class);
}
// getSymbols
if ((SYMBOLS & members) != 0) {
new ImageSymbolComparator().testComparatorIteratorEquals(ddrImageModule, jextractImageModule, "getSymbols", ImageSymbol.class);
}
}
use of com.ibm.dtfj.image.ImageModule in project openj9 by eclipse.
the class ImageStackFrame method getProcedureName.
public String getProcedureName() throws CorruptDataException {
if (null == _procedureName) {
ImageModule bestModule = null;
ImageSymbol bestClosest = null;
long bestDelta = Long.MAX_VALUE;
for (Iterator i = this._space.getProcesses(); i.hasNext(); ) {
Object nexti = i.next();
if (nexti instanceof CorruptData)
continue;
ImageProcess process = (ImageProcess) nexti;
if ((_procedureAddress.getAddress() != ((1L << process.getPointerSize()) - 1))) {
try {
ImageModule module = process.getExecutable();
ImageSymbol closest = getClosestSymbolFrom(module);
long delta = getDelta(module, closest);
if (delta >= 0 && delta < bestDelta) {
bestModule = module;
bestClosest = closest;
bestDelta = delta;
}
} catch (DataUnavailable e) {
} catch (CorruptDataException e) {
}
try {
for (Iterator j = process.getLibraries(); j.hasNext(); ) {
Object next = j.next();
if (next instanceof CorruptData)
continue;
ImageModule module = (ImageModule) next;
ImageSymbol closest = getClosestSymbolFrom(module);
long delta = getDelta(module, closest);
if (delta >= 0 && delta < bestDelta) {
bestModule = module;
bestClosest = closest;
bestDelta = delta;
}
}
} catch (DataUnavailable e) {
} catch (CorruptDataException e) {
}
}
}
ImageSymbol closest = bestClosest;
ImageModule module = bestModule;
long delta = bestDelta;
if (null != module) {
String deltaString = "";
if (delta == Long.MAX_VALUE) {
deltaString = "<offset not available>";
} else {
if (delta >= 0) {
deltaString = "+0x" + Long.toHexString(delta);
} else {
deltaString = "-0x" + Long.toHexString(delta);
}
}
if (null != closest) {
_procedureName = module.getName() + "::" + closest.getName() + deltaString;
} else {
_procedureName = module.getName() + deltaString;
}
}
}
// If we haven't found the symbol, we might as well record that fact.
if (null == _procedureName) {
_procedureName = "<unknown location>";
}
return _procedureName;
}
use of com.ibm.dtfj.image.ImageModule in project openj9 by eclipse.
the class XKCommand method printSymbol.
private boolean printSymbol(long pointer, long diff, int pointerSize) {
ImageProcess ip = ctx.getProcess();
Iterator itModule;
try {
itModule = ip.getLibraries();
} catch (CorruptDataException e) {
// FIXME
itModule = null;
} catch (DataUnavailable e) {
// FIXME
itModule = null;
}
while (null != itModule && itModule.hasNext()) {
ImageModule im = (ImageModule) itModule.next();
Iterator itImageSection = im.getSections();
while (itImageSection.hasNext()) {
ImageSection is = (ImageSection) itImageSection.next();
long startAddr = is.getBaseAddress().getAddress();
long endAddr = startAddr + is.getSize();
if (pointer >= startAddr && pointer < endAddr) {
/* can we find a matching symbol? */
long maxDifference = pointer - startAddr;
ImageSymbol bestSymbol = null;
for (Iterator iter = im.getSymbols(); iter.hasNext(); ) {
Object next = iter.next();
if (next instanceof CorruptData)
continue;
ImageSymbol symbol = (ImageSymbol) next;
long symbolAddress = symbol.getAddress().getAddress();
if (symbolAddress <= pointer && pointer - symbolAddress < maxDifference) {
maxDifference = pointer - symbolAddress;
bestSymbol = symbol;
}
}
try {
out.print(im.getName());
} catch (CorruptDataException e) {
out.print(Exceptions.getCorruptDataExceptionString());
}
out.print("::");
if (bestSymbol == null) {
out.print(is.getName());
} else {
out.print(bestSymbol.getName());
}
out.print("+");
out.print(Long.toString(maxDifference));
// trying to find it elsewhere in the address space
return true;
}
}
}
return false;
}
use of com.ibm.dtfj.image.ImageModule in project openj9 by eclipse.
the class NativeLibrariesCommand method getExeFromDDR.
// we can use the hint mechanism in DTFJ to work out the exe location for elf cores with very long path names
private void getExeFromDDR(Context ctx, PrintStream out) {
try {
ICore core = ctx.process.getAddressSpace().getCore();
if (ILibraryDependentCore.class.isAssignableFrom(core.getClass())) {
ILibraryDependentCore ldcore = (ILibraryDependentCore) core;
J9DDRImageProcess proc = new J9DDRImageProcess(ctx.process);
ImageModule exe = proc.getExecutable();
out.println("exe = " + exe.getName());
ldcore.executablePathHint(exe.getName());
}
} catch (Exception e) {
out.println("Could not determine EXE name using DDR : " + e.getMessage());
}
}
use of com.ibm.dtfj.image.ImageModule in project openj9 by eclipse.
the class PHDImageProcess method processData.
private void processData(ImageAddressSpace space) {
// }
if (metaImageProcess != null) {
try {
for (Iterator it = metaImageProcess.getLibraries(); it.hasNext(); ) {
Object next = it.next();
if (next instanceof CorruptData) {
modules.add(new PHDCorruptImageModule(space, (CorruptData) next));
} else {
try {
ImageModule mod = (ImageModule) next;
modules.add(new PHDImageModule(mod.getName()));
} catch (CorruptDataException e) {
modules.add(new PHDCorruptImageModule(space, e));
}
}
}
} catch (CorruptDataException e) {
modules_cd = new PHDCorruptData(space, e);
} catch (DataUnavailable e) {
// Ignore
}
/*
* Set up the image threads
*/
ImageThread current;
try {
current = metaImageProcess.getCurrentThread();
} catch (CorruptDataException e) {
currentThread = new PHDCorruptImageThread(space, e.getCorruptData());
current = null;
}
for (Iterator it = metaImageProcess.getThreads(); it.hasNext(); ) {
Object next = it.next();
if (next instanceof CorruptData) {
threads.put(next, new PHDCorruptImageThread(space, (CorruptData) next));
} else {
ImageThread thrd = (ImageThread) next;
ImageThread imageThread = getThread(space, thrd);
if (thrd.equals(current)) {
currentThread = imageThread;
}
}
}
}
// pid = getPID(file);
// runtimes = new ArrayList<JavaRuntime>();
// runtimes.add(new PHDJavaRuntime(file, parentImage, space,this,metaRuntime));
}
Aggregations