com.sun.jdi.request.MethodEntryRequest Java Examples

The following examples show how to use com.sun.jdi.request.MethodEntryRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DebugUtility.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Suspend the main thread when the program enters the main method of the specified main class.
 * @param debugSession
 *                  the debug session.
 * @param mainClass
 *                  the fully qualified name of the main class.
 * @return
 *        a {@link CompletableFuture} that contains the suspended main thread id.
 */
public static CompletableFuture<Long> stopOnEntry(IDebugSession debugSession, String mainClass) {
    CompletableFuture<Long> future = new CompletableFuture<>();

    EventRequestManager manager = debugSession.getVM().eventRequestManager();
    MethodEntryRequest request = manager.createMethodEntryRequest();
    request.addClassFilter(mainClass);
    request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);

    debugSession.getEventHub().events().filter(debugEvent -> {
        return debugEvent.event instanceof MethodEntryEvent && request.equals(debugEvent.event.request());
    }).subscribe(debugEvent -> {
        Method method = ((MethodEntryEvent) debugEvent.event).method();
        if (method.isPublic() && method.isStatic() && method.name().equals("main")
                && method.signature().equals("([Ljava/lang/String;)V")) {
            deleteEventRequestSafely(debugSession.getVM().eventRequestManager(), request);
            debugEvent.shouldResume = false;
            ThreadReference bpThread = ((MethodEntryEvent) debugEvent.event).thread();
            future.complete(bpThread.uniqueID());
        }
    });
    request.enable();

    return future;
}
 
Example #2
Source File: HotSwapper.java    From HotswapAgent with GNU General Public License v2.0 5 votes vote down vote up
private static MethodEntryRequest methodEntryRequests(
                            EventRequestManager manager,
                            String classpattern) {
    MethodEntryRequest mereq = manager.createMethodEntryRequest();
    mereq.addClassFilter(classpattern);
    mereq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
    return mereq;
}
 
Example #3
Source File: HotSwapperJpda.java    From HotswapAgent with GNU General Public License v2.0 5 votes vote down vote up
private static MethodEntryRequest methodEntryRequests(
        EventRequestManager manager,
        String classpattern) {
    MethodEntryRequest mereq = manager.createMethodEntryRequest();
    mereq.addClassFilter(classpattern);
    mereq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
    return mereq;
}
 
Example #4
Source File: Env.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #5
Source File: HotSwapper.java    From HotswapAgent with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private void deleteEventRequest(EventRequestManager manager,
                                MethodEntryRequest request) {
    manager.deleteEventRequest(request);
}
 
Example #6
Source File: HotSwapperJpda.java    From HotswapAgent with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private void deleteEventRequest(EventRequestManager manager,
                                MethodEntryRequest request) {
    manager.deleteEventRequest(request);
}
 
Example #7
Source File: Env.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #8
Source File: Env.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #9
Source File: Env.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #10
Source File: Env.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #11
Source File: Env.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #12
Source File: Env.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #13
Source File: Env.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #14
Source File: Env.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #15
Source File: Env.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #16
Source File: Env.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #17
Source File: Env.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
Example #18
Source File: Env.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}