use of com.ibm.dtfj.image.ImageAddressSpace in project openj9 by eclipse.
the class Utils method _extractAddressSpace.
// CMVC 175488 : fixed so that this function returns an address space which contains a process
// rather than the first address space it finds.
public static ImageAddressSpace _extractAddressSpace(Image loadedImage) {
ImageAddressSpace space = null;
Iterator spaces = loadedImage.getAddressSpaces();
// object returned through DTFJ iterators
Object obj = null;
while (spaces.hasNext()) {
obj = spaces.next();
if (obj instanceof ImageAddressSpace) {
space = (ImageAddressSpace) obj;
Iterator procs = space.getProcesses();
while (procs.hasNext()) {
obj = procs.next();
if (obj instanceof ImageProcess) {
return space;
}
}
}
}
// failed to find an address space which contains a process.
return null;
}
use of com.ibm.dtfj.image.ImageAddressSpace in project openj9 by eclipse.
the class Utils method getAddressSapceSectionInfo.
public static Iterator getAddressSapceSectionInfo(Image loadedImage) {
Iterator itAddressSpace = loadedImage.getAddressSpaces();
Vector vSections = new Vector();
while (itAddressSpace.hasNext()) {
ImageAddressSpace imageAddressSpace = (ImageAddressSpace) itAddressSpace.next();
Iterator iSections = imageAddressSpace.getImageSections();
while (iSections.hasNext()) {
vSections.add(iSections.next());
}
}
return vSections.iterator();
}
use of com.ibm.dtfj.image.ImageAddressSpace in project openj9 by eclipse.
the class InfoThreadCommand method printAddressSpaceInfo.
private void printAddressSpaceInfo(String id, Map threads) {
Iterator itAddressSpace;
ImageAddressSpace ias;
int asnum = 0;
if (id == null) {
// omit header line if we are only printing one thread
out.print("native threads for address space\n");
}
printProcessInfo(id, threads);
if (!threads.isEmpty()) {
out.print("\nJava threads not associated with known native threads:\n\n");
// retrieve any orphaned Java threads from the hashmap
ArrayList ta = (ArrayList) threads.remove(null);
if (ta != null) {
for (int i = 0; i < ta.size(); i++) {
ThreadData td = (ThreadData) ta.get(i);
printJavaThreadInfo(td.getThread(), false);
}
}
// If that still hasn't emptied the list we've managed to find id's for threads
if (!threads.isEmpty()) {
Iterator remainingThreads = threads.values().iterator();
while (remainingThreads.hasNext()) {
ThreadData td = (ThreadData) remainingThreads.next();
if (td == null) {
continue;
}
printJavaThreadInfo(td.getThread(), false);
}
}
}
}
use of com.ibm.dtfj.image.ImageAddressSpace in project openj9 by eclipse.
the class XDCommand method doCommand.
public void doCommand(String[] args) {
String param = args[0];
Long address;
address = Utils.longFromStringWithPrefix(param);
if (null == address) {
out.println("invalid hex address specified; address must be specified as " + "\"0x<hex_address>\"");
return;
}
out.print("\n");
boolean found = false;
for (int index = 0; index < argUnitNumber; index++) {
long currAddr = address.longValue() + (index * argUnitSize);
out.print("\t");
out.print(Utils.toHex(currAddr));
out.print(": ");
ImageAddressSpace ias = ctx.getAddressSpace();
ImagePointer ip = ias.getPointer(currAddr);
byte b = 0;
short s = 0;
int i = 0;
long l = 0;
try {
switch(argUnitSize) {
case 1:
b = ip.getByteAt(0);
break;
case 2:
s = ip.getShortAt(0);
break;
case 4:
i = ip.getIntAt(0);
break;
case 8:
l = ip.getLongAt(0);
break;
}
found = true;
} catch (CorruptDataException e) {
found = false;
} catch (MemoryAccessException e) {
found = false;
}
if (found) {
switch(argUnitSize) {
case 1:
out.print(Byte.toString(b));
break;
case 2:
out.print(Short.toString(s));
break;
case 4:
out.print(Integer.toString(i));
break;
case 8:
out.print(Long.toString(l));
break;
}
}
out.print("\n");
}
if (!found) {
out.print("<address not found in any address space>");
}
out.print("\n");
}
use of com.ibm.dtfj.image.ImageAddressSpace in project openj9 by eclipse.
the class XKCommand method doCommand.
public void doCommand(String[] args) {
String param = args[0];
Long address = Utils.longFromStringWithPrefix(param);
if (null == address) {
out.println("invalid hex address specified; address must be specified as " + "\"0x<hex_address>\"");
return;
}
ImageAddressSpace ias = ctx.getAddressSpace();
int pointerSize = getIASPointerSize(ias);
int unitSize;
if (pointerSize > 32)
unitSize = 8;
else
unitSize = 4;
out.print("\n");
for (int index = 0; index < argUnitNumber; index++) {
boolean found = false;
long currAddr = address.longValue() + (index * unitSize);
ImagePointer ip = ias.getPointer(currAddr);
out.print("\t");
out.print(Utils.toHex(currAddr));
out.print(" ");
long l = 0;
try {
l = ip.getPointerAt(0).getAddress();
found = true;
} catch (CorruptDataException e) {
found = false;
} catch (MemoryAccessException e) {
found = false;
}
if (found) {
long pointer = l;
out.print(toAdjustedHex(l, pointerSize));
out.print(" ");
if (31 == pointerSize) {
pointer = (int) (pointer & (((long) 1) << pointerSize) - 1);
}
if (printSymbol(pointer, l - currAddr, pointerSize)) {
} else if (printStackPointer(pointer, l - currAddr, pointerSize, ias)) {
}
out.print("\n");
} else {
out.print("<address not found in any address space or exception occurred>\n");
}
}
out.print("\n");
}
Aggregations