Search in sources :

Example 6 with StackFrame

use of com.sun.jdi.StackFrame in project jdk8u_jdk by JetBrains.

the class OomDebugTest method runTests.

@Override
protected void runTests() throws Exception {
    try {
        addListener(new TargetAdapter() {

            @Override
            public void exceptionThrown(ExceptionEvent event) {
                String name = event.exception().referenceType().name();
                System.err.println("DEBUG: Exception thrown in debuggee was: " + name);
            }
        });
        /*
             * Get to the top of entry()
             * to determine targetClass and mainThread
             */
        BreakpointEvent bpe = startTo("OomDebugTestTarget", "entry", "()V");
        targetClass = bpe.location().declaringType();
        mainThread = bpe.thread();
        StackFrame frame = mainThread.frame(0);
        thisObject = frame.thisObject();
        java.lang.reflect.Method m = findTestMethod();
        m.invoke(this);
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
        failure();
    } catch (SecurityException e) {
        e.printStackTrace();
        failure();
    }
    /*
         * resume the target, listening for events
         */
    listenUntilVMDisconnect();
}
Also used : ExceptionEvent(com.sun.jdi.event.ExceptionEvent) BreakpointEvent(com.sun.jdi.event.BreakpointEvent) StackFrame(com.sun.jdi.StackFrame)

Aggregations

StackFrame (com.sun.jdi.StackFrame)6 BreakpointEvent (com.sun.jdi.event.BreakpointEvent)4 AbsentInformationException (com.sun.jdi.AbsentInformationException)3 LocalVariable (com.sun.jdi.LocalVariable)3 IncompatibleThreadStateException (com.sun.jdi.IncompatibleThreadStateException)2 StringReference (com.sun.jdi.StringReference)2 Value (com.sun.jdi.Value)2 InvalidStackFrameException (com.sun.jdi.InvalidStackFrameException)1 Method (com.sun.jdi.Method)1 NativeMethodException (com.sun.jdi.NativeMethodException)1 ThreadReference (com.sun.jdi.ThreadReference)1 VirtualMachine (com.sun.jdi.VirtualMachine)1 Connector (com.sun.jdi.connect.Connector)1 IllegalConnectorArgumentsException (com.sun.jdi.connect.IllegalConnectorArgumentsException)1 EventSet (com.sun.jdi.event.EventSet)1 ExceptionEvent (com.sun.jdi.event.ExceptionEvent)1 StepEvent (com.sun.jdi.event.StepEvent)1 EventRequestManager (com.sun.jdi.request.EventRequestManager)1 SocketAttachingConnector (com.sun.tools.jdi.SocketAttachingConnector)1 IOException (java.io.IOException)1