当前位置: 首页>>代码示例>>Java>>正文


Java MethodEntryRequest类代码示例

本文整理汇总了Java中com.sun.jdi.request.MethodEntryRequest的典型用法代码示例。如果您正苦于以下问题:Java MethodEntryRequest类的具体用法?Java MethodEntryRequest怎么用?Java MethodEntryRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MethodEntryRequest类属于com.sun.jdi.request包,在下文中一共展示了MethodEntryRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stopOnEntry

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:34,代码来源:DebugUtility.java

示例2: perform

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
@Override
    public void perform(String[] argv, Context ctx) {

        EventRequestManager manager = ctx.getVm().eventRequestManager();
        MethodEntryRequest mer = manager.createMethodEntryRequest();
        mer.setSuspendPolicy(EventRequest.SUSPEND_NONE);
        mer.enable();

        ctx.register(mer, new EventCallback() {
            @Override
            public void handleEvent(Event event) {
                MethodEntryEvent mee = (MethodEntryEvent) event;
                Method method = mee.method();
                System.out.println("--" + method.name());
//                mee.thread().resume();
            }
        });
    }
 
开发者ID:CvvT,项目名称:andbg,代码行数:19,代码来源:track.java

示例3: createRequest

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
public void createRequest(DebugProcessImpl debugProcess) {
  DebuggerManagerThreadImpl.assertIsManagerThread();
  if (!shouldCreateRequest(debugProcess)) {
    return;
  }
  try {
    RequestManagerImpl requestManager = debugProcess.getRequestsManager();
    if (isWatchEntry()) {
      MethodEntryRequest entryRequest = MethodBreakpoint.findRequest(debugProcess, MethodEntryRequest.class, this);
      if (entryRequest == null) {
        entryRequest = requestManager.createMethodEntryRequest(this);
      }
      else {
        entryRequest.disable();
      }
      entryRequest.addClassFilter(getClassPattern());
      debugProcess.getRequestsManager().enableRequest(entryRequest);
    }
    if (isWatchExit()) {
      MethodExitRequest exitRequest = MethodBreakpoint.findRequest(debugProcess, MethodExitRequest.class, this);
      if (exitRequest == null) {
        exitRequest = requestManager.createMethodExitRequest(this);
      }
      else {
        exitRequest.disable();
      }
      exitRequest.addClassFilter(getClassPattern());
      debugProcess.getRequestsManager().enableRequest(exitRequest);
    }
  }
  catch (Exception e) {
    LOG.debug(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:WildcardMethodBreakpoint.java

示例4: wrapMethodEntryRequests

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
public static List<MethodEntryRequest> wrapMethodEntryRequests(
        F3VirtualMachine f3vm, List<MethodEntryRequest> reqs) {
    if (reqs == null) {
        return null;
    }
    List<MethodEntryRequest> result = new ArrayList<MethodEntryRequest>();
    for (MethodEntryRequest req : reqs) {
        result.add(wrap(f3vm, req));
    }
    return result;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:12,代码来源:F3EventRequest.java

示例5: createRequest

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
public void createRequest(DebugProcessImpl debugProcess) {
  DebuggerManagerThreadImpl.assertIsManagerThread();
  if (!ENABLED || !debugProcess.isAttached() || debugProcess.areBreakpointsMuted() || !debugProcess.getRequestsManager().findRequests(this).isEmpty()) {
    return;
  }
  try {
    RequestManagerImpl requestManager = debugProcess.getRequestsManager();
    if (WATCH_ENTRY) {
      MethodEntryRequest entryRequest = (MethodEntryRequest)findRequest(debugProcess, MethodEntryRequest.class);
      if (entryRequest == null) {
        entryRequest = requestManager.createMethodEntryRequest(this);
      }
      else {
        entryRequest.disable();
      }
      entryRequest.addClassFilter(myClassPattern);
      debugProcess.getRequestsManager().enableRequest(entryRequest);
    }
    if (WATCH_EXIT) {
      MethodExitRequest exitRequest = (MethodExitRequest)findRequest(debugProcess, MethodExitRequest.class);
      if (exitRequest == null) {
        exitRequest = requestManager.createMethodExitRequest(this);
      }
      else {
        exitRequest.disable();
      }
      exitRequest.addClassFilter(myClassPattern);
      debugProcess.getRequestsManager().enableRequest(exitRequest);
    }
  }
  catch (Exception e) {
    LOG.debug(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:WildcardMethodBreakpoint.java

示例6: methodEntryRequests

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
private static MethodEntryRequest methodEntryRequests(
        EventRequestManager manager,
        String classpattern) {
    MethodEntryRequest mereq = manager.createMethodEntryRequest();
    mereq.addClassFilter(classpattern);
    mereq.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
    return mereq;
}
 
开发者ID:HotswapProjects,项目名称:HotswapAgent,代码行数:9,代码来源:HotSwapperJpda.java

示例7: setEventRequests

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
/**
* Create the desired event requests, and enable
* them so that we will get events.
* @param excludes Class patterns for which we don't want events
* @param watchFields Do we want to watch assignments to fields
*/
   
   void setEventRequests() {
           
   	EventRequestManager mgr = vm.eventRequestManager();
       ExceptionRequest excReq = mgr.createExceptionRequest(null,true, true);
       excReq.setSuspendPolicy(EventRequest.SUSPEND_ALL);
       excReq.enable();

       MethodEntryRequest menr = mgr.createMethodEntryRequest();
       for (int i=0; i<excludes.size(); ++i) {
           menr.addClassExclusionFilter(excludes.get(i));
       }
       
       menr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
       menr.enable();

       MethodExitRequest mexr = mgr.createMethodExitRequest();
       for (int i=0; i<excludes.size(); ++i) {
           mexr.addClassExclusionFilter(excludes.get(i));
       }
       mexr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
       mexr.enable();
       
       ThreadDeathRequest tdr = mgr.createThreadDeathRequest();
       tdr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
       tdr.enable();
      
   }
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:35,代码来源:EventThread.java

示例8: addExcludes

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
static void addExcludes(MethodEntryRequest request) {
    for (String pattern : excludes()) {
        request.addClassExclusionFilter(pattern);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:Env.java

示例9: createMethodEntryRequest

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
public MethodEntryRequest createMethodEntryRequest() {
    return new MethodEntryRequestImpl();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:EventRequestManagerImpl.java

示例10: methodEntryRequests

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
public List<MethodEntryRequest> methodEntryRequests() {
    return (List<MethodEntryRequest>)unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:EventRequestManagerImpl.java

示例11: createRequestForPreparedClass

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
protected void createRequestForPreparedClass(@NotNull DebugProcessImpl debugProcess, @NotNull ReferenceType classType) {
  try {
    boolean hasMethod = false;
    for (Iterator iterator = classType.allMethods().iterator(); iterator.hasNext();) {
      Method method = (Method)iterator.next();
      String signature = method.signature();
      String name = method.name();

      if (getMethodName().equals(name) && mySignature.getName(debugProcess).equals(signature)) {
        hasMethod = true;
        break;
      }
    }

    if(!hasMethod) {
      debugProcess.getRequestsManager().setInvalid(
        this, DebuggerBundle.message("error.invalid.breakpoint.method.not.found", classType.name())
      );
      return;
    }

    RequestManagerImpl requestManager = debugProcess.getRequestsManager();
    if (isWatchEntry()) {
      MethodEntryRequest entryRequest = findRequest(debugProcess, MethodEntryRequest.class, this);
      if (entryRequest == null) {
        entryRequest = requestManager.createMethodEntryRequest(this);
      }
      else {
        entryRequest.disable();
      }
      //entryRequest.addClassFilter(myClassQualifiedName);
      // use addClassFilter(ReferenceType) in order to stop on subclasses also!
      entryRequest.addClassFilter(classType);
      debugProcess.getRequestsManager().enableRequest(entryRequest);
    }
    if (isWatchExit()) {
      MethodExitRequest exitRequest = findRequest(debugProcess, MethodExitRequest.class, this);
      if (exitRequest == null) {
        exitRequest = requestManager.createMethodExitRequest(this);
      }
      else {
        exitRequest.disable();
      }
      //exitRequest.addClassFilter(myClassQualifiedName);
      exitRequest.addClassFilter(classType);
      debugProcess.getRequestsManager().enableRequest(exitRequest);
    }
  }
  catch (Exception e) {
    LOG.debug(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:53,代码来源:MethodBreakpoint.java

示例12: F3MethodEntryRequest

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
public F3MethodEntryRequest(F3VirtualMachine f3vm, MethodEntryRequest underlying) {
    super(f3vm, underlying);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:F3MethodEntryRequest.java

示例13: underlying

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
@Override
protected MethodEntryRequest underlying() {
    return (MethodEntryRequest) super.underlying();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3MethodEntryRequest.java

示例14: methodEntryRequests

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
public List<MethodEntryRequest> methodEntryRequests() {
    return F3EventRequest.wrapMethodEntryRequests(virtualMachine(),
            underlying().methodEntryRequests());
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3EventRequestManager.java

示例15: wrap

import com.sun.jdi.request.MethodEntryRequest; //导入依赖的package包/类
public static F3EventRequest wrap(F3VirtualMachine f3vm, EventRequest req) {
    if (req == null) {
        return null;
    }

    if (req instanceof AccessWatchpointRequest) {
        return new F3AccessWatchpointRequest(f3vm, (AccessWatchpointRequest)req);
    } else if (req instanceof BreakpointRequest) {
        return new F3BreakpointRequest(f3vm, (BreakpointRequest)req);
    } else if (req instanceof ClassPrepareRequest) {
        return new F3ClassPrepareRequest(f3vm, (ClassPrepareRequest)req);
    } else if (req instanceof ClassUnloadRequest) {
        return new F3ClassUnloadRequest(f3vm, (ClassUnloadRequest)req);
    } else if (req instanceof ExceptionRequest) {
        return new F3ExceptionRequest(f3vm, (ExceptionRequest)req);
    } else if (req instanceof MethodEntryRequest) {
        return new F3MethodEntryRequest(f3vm, (MethodEntryRequest)req);
    } else if (req instanceof MethodExitRequest) {
        return new F3MethodExitRequest(f3vm, (MethodExitRequest)req);
    } else if (req instanceof ModificationWatchpointRequest) {
        return new F3ModificationWatchpointRequest(f3vm, (ModificationWatchpointRequest)req);
    } else if (req instanceof MonitorContendedEnterRequest) {
        return new F3MonitorContendedEnterRequest(f3vm, (MonitorContendedEnterRequest)req);
    } else if (req instanceof MonitorContendedEnteredRequest) {
        return new F3MonitorContendedEnteredRequest(f3vm, (MonitorContendedEnteredRequest)req);
    } else if (req instanceof MonitorWaitRequest) {
        return new F3MonitorWaitRequest(f3vm, (MonitorWaitRequest)req);
    } else if (req instanceof MonitorWaitedRequest) {
        return new F3MonitorWaitedRequest(f3vm, (MonitorWaitedRequest)req);
    } else if (req instanceof StepRequest) {
        return new F3StepRequest(f3vm, (StepRequest)req);
    } else if (req instanceof ThreadDeathRequest) {
        return new F3ThreadDeathRequest(f3vm, (ThreadDeathRequest)req);
    } else if (req instanceof ThreadStartRequest) {
        return new F3ThreadStartRequest(f3vm, (ThreadStartRequest)req);
    } else if (req instanceof VMDeathRequest) {
        return new F3VMDeathRequest(f3vm, (VMDeathRequest)req);
    } else if (req instanceof WatchpointRequest) {
        return new F3WatchpointRequest(f3vm, (WatchpointRequest)req);
    } else {
        return new F3EventRequest(f3vm, req);
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:44,代码来源:F3EventRequest.java


注:本文中的com.sun.jdi.request.MethodEntryRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。