Search in sources :

Example 11 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class ThreadsCommand method getThreadName.

public static String getThreadName(J9VMThreadPointer thread) throws CorruptDataException {
    U8Pointer threadName = thread.omrVMThread().threadName();
    StringBuffer sb = new StringBuffer();
    if (threadName.isNull()) {
        sb.append("<NULL>");
    } else {
        while (!threadName.at(0).eq(0)) {
            U8 at = threadName.at(0);
            sb.append((char) at.intValue());
            threadName = threadName.add(1);
        }
    }
    return sb.toString();
}
Also used : U8(com.ibm.j9ddr.vm29.types.U8) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Example 12 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class ThreadsCommand method search.

private void search(PrintStream out, UDATA tid) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9VMThreadPointer mainThread = vm.mainThread();
        if (mainThread.notNull()) {
            J9VMThreadPointer threadCursor = vm.mainThread();
            do {
                if (threadCursor.osThread().tid().eq(tid)) {
                    out.println(String.format("\t!stack 0x%08x\t!j9vmthread 0x%08x\t!j9thread 0x%08x\ttid 0x%x (%d) // %s", threadCursor.getAddress(), threadCursor.getAddress(), threadCursor.osThread().getAddress(), threadCursor.osThread().tid().longValue(), threadCursor.osThread().tid().longValue(), getThreadName(threadCursor)));
                    break;
                }
                threadCursor = threadCursor.linkNext();
            } while (!threadCursor.eq(mainThread));
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 13 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class ThreadsCommand method flags.

private void flags(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 publicFlags=%s privateFlags=%s // %s", Long.toHexString(threadCursor.getAddress()), Long.toHexString(threadCursor.publicFlags().longValue()), Long.toHexString(threadCursor.privateFlags().longValue()), getThreadName(threadCursor)));
                out.append(nl);
                threadCursor = threadCursor.linkNext();
            } while (!threadCursor.eq(mainThread));
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 14 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class ThreadsCommand method trace.

private void trace(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("    !stack 0x%s  !j9vmthread 0x%s  !j9thread 0x%s  tid 0x%s (%d) !utthreaddata 0x%s // %s", Long.toHexString(threadCursor.getAddress()), Long.toHexString(threadCursor.getAddress()), Long.toHexString(threadCursor.osThread().getAddress()), Long.toHexString(threadCursor.osThread().tid().longValue()), threadCursor.osThread().tid().longValue(), Long.toHexString(threadCursor.omrVMThread()._trace$uteThread().getAddress()), getThreadName(threadCursor)));
                out.append(nl);
                threadCursor = threadCursor.linkNext();
            } while (!threadCursor.eq(mainThread));
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 15 with J9VMThreadPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer in project openj9 by eclipse.

the class ThreadsCommand method stack.

private void stack(PrintStream out, Context context, String command) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9VMThreadPointer mainThread = vm.mainThread();
        StackWalkCommand walkCommand = new StackWalkCommand();
        if (mainThread.notNull()) {
            J9VMThreadPointer threadCursor = vm.mainThread();
            do {
                out.println(String.format("\t!stack 0x%08x\t!j9vmthread 0x%08x\t!j9thread 0x%08x\ttid 0x%x (%d) // %s", threadCursor.getAddress(), threadCursor.getAddress(), threadCursor.osThread().getAddress(), threadCursor.osThread().tid().longValue(), threadCursor.osThread().tid().longValue(), getThreadName(threadCursor)));
                out.append(nl);
                walkCommand.run(command, new String[] { Long.toString(threadCursor.getAddress()) }, context, out);
                out.append(nl);
                threadCursor = threadCursor.linkNext();
            } while (!threadCursor.eq(mainThread));
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) StackWalkCommand(com.ibm.j9ddr.vm29.tools.ddrinteractive.commands.StackWalkCommand) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Aggregations

J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)39 CorruptDataException (com.ibm.j9ddr.CorruptDataException)28 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)16 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)15 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)13 J9ThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer)9 WalkState (com.ibm.j9ddr.vm29.j9.stackwalker.WalkState)7 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)6 UDATA (com.ibm.j9ddr.vm29.types.UDATA)6 BaseStackWalkerCallbacks (com.ibm.j9ddr.vm29.j9.stackwalker.BaseStackWalkerCallbacks)5 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)5 StackWalkResult (com.ibm.j9ddr.vm29.j9.stackwalker.StackWalkResult)4 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)4 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)4 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)3 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)3 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)3 J9ThreadLibraryPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadLibraryPointer)3 LinkedList (java.util.LinkedList)3 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)2