Search in sources :

Example 16 with ImageAddressSpace

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;
}
Also used : ImageAddressSpace(com.ibm.dtfj.image.ImageAddressSpace) ImageProcess(com.ibm.dtfj.image.ImageProcess) Iterator(java.util.Iterator) JavaObject(com.ibm.dtfj.java.JavaObject)

Example 17 with ImageAddressSpace

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();
}
Also used : ImageAddressSpace(com.ibm.dtfj.image.ImageAddressSpace) Iterator(java.util.Iterator) Vector(java.util.Vector)

Example 18 with ImageAddressSpace

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);
            }
        }
    }
}
Also used : ImageAddressSpace(com.ibm.dtfj.image.ImageAddressSpace) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) ThreadData(com.ibm.jvm.dtfjview.commands.helpers.ThreadData)

Example 19 with ImageAddressSpace

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");
}
Also used : ImageAddressSpace(com.ibm.dtfj.image.ImageAddressSpace) ImagePointer(com.ibm.dtfj.image.ImagePointer) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) MemoryAccessException(com.ibm.dtfj.image.MemoryAccessException)

Example 20 with ImageAddressSpace

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");
}
Also used : ImageAddressSpace(com.ibm.dtfj.image.ImageAddressSpace) ImagePointer(com.ibm.dtfj.image.ImagePointer) CorruptDataException(com.ibm.dtfj.image.CorruptDataException) MemoryAccessException(com.ibm.dtfj.image.MemoryAccessException)

Aggregations

ImageAddressSpace (com.ibm.dtfj.image.ImageAddressSpace)20 ImageProcess (com.ibm.dtfj.image.ImageProcess)11 JavaRuntime (com.ibm.dtfj.java.JavaRuntime)8 Iterator (java.util.Iterator)8 CorruptDataException (com.ibm.dtfj.image.CorruptDataException)7 Image (com.ibm.dtfj.image.Image)7 CorruptData (com.ibm.dtfj.image.CorruptData)5 ImageFactory (com.ibm.dtfj.image.ImageFactory)5 ImagePointer (com.ibm.dtfj.image.ImagePointer)5 MemoryAccessException (com.ibm.dtfj.image.MemoryAccessException)4 J9DDRImageFactory (com.ibm.j9ddr.view.dtfj.image.J9DDRImageFactory)4 IOException (java.io.IOException)4 JavaObject (com.ibm.dtfj.java.JavaObject)3 File (java.io.File)3 DataUnavailable (com.ibm.dtfj.image.DataUnavailable)2 ImageModule (com.ibm.dtfj.image.ImageModule)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 Vector (java.util.Vector)2 ImageSection (com.ibm.dtfj.image.ImageSection)1