Search in sources :

Example 16 with Method

use of com.sun.jdi.Method in project intellij-community by JetBrains.

the class NodeManagerImpl method getContextKeyForFrame.

@Nullable
public static String getContextKeyForFrame(final StackFrameProxyImpl frame) {
    if (frame == null) {
        return null;
    }
    try {
        final Location location = frame.location();
        final Method method = DebuggerUtilsEx.getMethod(location);
        if (method == null) {
            return null;
        }
        final ReferenceType referenceType = location.declaringType();
        final StringBuilder builder = StringBuilderSpinAllocator.alloc();
        try {
            return builder.append(referenceType.signature()).append("#").append(method.name()).append(method.signature()).toString();
        } finally {
            StringBuilderSpinAllocator.dispose(builder);
        }
    } catch (EvaluateException ignored) {
    } catch (InternalException ie) {
        if (ie.errorCode() != 23) {
            // INVALID_METHODID
            throw ie;
        }
    }
    return null;
}
Also used : EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) Method(com.sun.jdi.Method) ReferenceType(com.sun.jdi.ReferenceType) Location(com.sun.jdi.Location) InternalException(com.sun.jdi.InternalException) Nullable(org.jetbrains.annotations.Nullable)

Example 17 with Method

use of com.sun.jdi.Method in project otertool by wuntee.

the class Testing method addIntentBreakpoints.

@SuppressWarnings("restriction")
public static void addIntentBreakpoints(VirtualMachine vm) {
    EventRequestManager mgr = vm.eventRequestManager();
    com.sun.jdi.ReferenceType intentClass = vm.classesByName("android.content.Intent").get(0);
    for (Method m : intentClass.methodsByName("<init>")) {
        System.out.println("Breakpoint: " + m.toString());
        Location location = m.location();
        BreakpointRequest bpr = mgr.createBreakpointRequest(location);
        bpr.enable();
    }
    for (Method m : intentClass.methodsByName("putExtra")) {
        System.out.println("Breakpoint: " + m.toString());
        Location location = m.location();
        BreakpointRequest bpr = mgr.createBreakpointRequest(location);
        bpr.enable();
    }
}
Also used : BreakpointRequest(com.sun.jdi.request.BreakpointRequest) Method(com.sun.jdi.Method) EventRequestManager(com.sun.jdi.request.EventRequestManager) Location(com.sun.jdi.Location)

Example 18 with Method

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

the class InvokableTypeImpl method allMethods.

/**
     * Shared implementation of {@linkplain ClassType#allMethods()} and
     * {@linkplain InterfaceType#allMethods()}
     * @return A list of all methods (recursively)
     */
public final List<Method> allMethods() {
    ArrayList<Method> list = new ArrayList<>(methods());
    ClassType clazz = superclass();
    while (clazz != null) {
        list.addAll(clazz.methods());
        clazz = clazz.superclass();
    }
    /*
         * Avoid duplicate checking on each method by iterating through
         * duplicate-free allInterfaces() rather than recursing
         */
    for (InterfaceType interfaze : getAllInterfaces()) {
        list.addAll(interfaze.methods());
    }
    return list;
}
Also used : InterfaceType(com.sun.jdi.InterfaceType) ArrayList(java.util.ArrayList) Method(com.sun.jdi.Method) ClassType(com.sun.jdi.ClassType)

Example 19 with Method

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

the class OomDebugTest method invoke.

void invoke(String methodName, String methodSig, @SuppressWarnings("rawtypes") List args, Value value) throws Exception {
    Method method = findMethod(targetClass, methodName, methodSig);
    if (method == null) {
        failure("FAILED: Can't find method: " + methodName + " for class = " + targetClass);
        return;
    }
    invoke(method, args, value);
}
Also used : Method(com.sun.jdi.Method)

Aggregations

Method (com.sun.jdi.Method)19 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)5 Location (com.sun.jdi.Location)5 ReferenceType (com.sun.jdi.ReferenceType)5 ClassType (com.sun.jdi.ClassType)4 SourcePosition (com.intellij.debugger.SourcePosition)3 Nullable (org.jetbrains.annotations.Nullable)3 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)2 StackFrameProxyImpl (com.intellij.debugger.jdi.StackFrameProxyImpl)2 VirtualMachineProxyImpl (com.intellij.debugger.jdi.VirtualMachineProxyImpl)2 Project (com.intellij.openapi.project.Project)2 AbsentInformationException (com.sun.jdi.AbsentInformationException)2 ClassNotLoadedException (com.sun.jdi.ClassNotLoadedException)2 IncompatibleThreadStateException (com.sun.jdi.IncompatibleThreadStateException)2 InterfaceType (com.sun.jdi.InterfaceType)2 InvocationException (com.sun.jdi.InvocationException)2 ObjectReference (com.sun.jdi.ObjectReference)2 Value (com.sun.jdi.Value)2 BreakpointRequest (com.sun.jdi.request.BreakpointRequest)2 JVMName (com.intellij.debugger.engine.JVMName)1