本文整理汇总了Java中com.sun.jdi.request.ClassPrepareRequest.addClassFilter方法的典型用法代码示例。如果您正苦于以下问题:Java ClassPrepareRequest.addClassFilter方法的具体用法?Java ClassPrepareRequest.addClassFilter怎么用?Java ClassPrepareRequest.addClassFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jdi.request.ClassPrepareRequest
的用法示例。
在下文中一共展示了ClassPrepareRequest.addClassFilter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deferBreakpoint
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
private void deferBreakpoint(String className, Breakpoint breakpoint) throws DebuggerException {
List<Breakpoint> newList = new ArrayList<>();
List<Breakpoint> list = deferredBreakpoints.putIfAbsent(className, newList);
if (list == null) {
list = newList;
}
list.add(breakpoint);
// start listening for the load of the type
if (!classPrepareRequests.containsKey(className)) {
ClassPrepareRequest request = getEventManager().createClassPrepareRequest();
// set class filter in order to reduce the amount of event traffic sent from the target VM to
// the debugger VM
request.addClassFilter(className);
request.enable();
classPrepareRequests.put(className, request);
}
LOG.debug("Deferred breakpoint: {}", breakpoint.getLocation().toString());
}
示例2: createPrepareRequest
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
@Override
public ClassPrepareRequest createPrepareRequest() {
ClassPrepareRequest request =
Env.vm().eventRequestManager().createClassPrepareRequest();
request.addClassFilter(classId);
request.addCountFilter(1);
return request;
}
示例3: addClassWatch
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
private static void addClassWatch(VirtualMachine vm) {
EventRequestManager erm = vm.eventRequestManager();
ClassPrepareRequest classPrepareRequest = erm
.createClassPrepareRequest();
classPrepareRequest.addClassFilter(CLASS_NAME);
classPrepareRequest.setEnabled(true);
}
示例4: addClassWatch
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
private static void addClassWatch(VirtualMachine vm) {
EventRequestManager erm = vm.eventRequestManager();
ClassPrepareRequest classPrepareRequest = erm
.createClassPrepareRequest();
classPrepareRequest.addClassFilter(CLASS_NAME);
classPrepareRequest.setEnabled(true);
}
示例5: createPrepareRequest
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
public ClassPrepareRequest createPrepareRequest() {
ClassPrepareRequest request =
env.vm().eventRequestManager().createClassPrepareRequest();
request.addClassFilter(classId);
request.addCountFilter(1);
return request;
}
示例6: resumeToPrepareOf
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
public ClassPrepareEvent resumeToPrepareOf(String className) {
final ClassPrepareRequest request =
eventRequestManager().createClassPrepareRequest();
request.addClassFilter(className);
request.addCountFilter(1);
request.enable();
return (ClassPrepareEvent)resumeToEvent(request);
}
示例7: init
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void init(String[] args) throws Exception {
/*
* TODO As currently jdb just supports "jdb -attach [port]" command,
* more work to do to parse the jdb launching command option
*/
if (args.length >= 2 && args[0].equals("-attach")) {
SocketAttachingConnectorImpl sac =
new SocketAttachingConnectorImpl(
(VirtualMachineManagerImpl) Bootstrap.
virtualMachineManager());
Map argMap = sac.defaultArguments();
Connector.Argument value;
value = (Connector.Argument) argMap.get("hostname");
value.setValue("localhost");
value = (Connector.Argument) argMap.get("port");
value.setValue(args[1]);
debuggee = sac.attach(argMap);
//VMProcess = debuggee.process();
} else {
System.out.println("Wrong command option. " +
"The jdb currently only support jdb -attach [port].");
System.exit(0);
}
eventRequestManager = debuggee.eventRequestManager();
// Enable class prepare request for all classes
ClassPrepareRequest classPrepareRequest
= eventRequestManager.createClassPrepareRequest();
classPrepareRequest.addClassFilter("*");
classPrepareRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
classPrepareRequest.enable();
// Enable thread start request for all threads
ThreadStartRequest threadStartRequest
= eventRequestManager.createThreadStartRequest();
threadStartRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
threadStartRequest.enable();
}
示例8: watchBuggyClass
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
private void watchBuggyClass() {
EventRequestManager erm = vm.eventRequestManager();
ClassPrepareRequest classPrepareRequest = erm.createClassPrepareRequest();
classPrepareRequest.addClassFilter(location.getContainingClassName());
classPrepareRequest.setEnabled(true);
}
示例9: createJVM
import com.sun.jdi.request.ClassPrepareRequest; //导入方法依赖的package包/类
public VMRemoteTarget createJVM() throws IOException, InterruptedException,
IncompatibleThreadStateException {
Process process = startSecondJVM(VMLocalTarget.class);
sleep(90);
// connect
VirtualMachine vm = new VMAcquirer().connect(debugPort);
ClassPrepareRequest createClassPrepareRequest = vm
.eventRequestManager().createClassPrepareRequest();
createClassPrepareRequest.addClassFilter(VMLocalTarget.class.getName());
createClassPrepareRequest.enable();
vm.resume();
List<ThreadReference> allThreads = vm.allThreads();
for (ThreadReference threadReference : allThreads) {
System.out.println(threadReference+" isSuspended: "+threadReference.isSuspended()+" suspendCount: "+threadReference.suspendCount());
}
// process events
EventQueue eventQueue = vm.eventQueue();
while (true) {
EventSet eventSet = eventQueue.remove();
for (Event event : eventSet) {
if (event instanceof ClassPrepareEvent) {
event.request().disable();
installHaltPoint(vm);
}
if (event instanceof VMDeathEvent
|| event instanceof VMDisconnectEvent) {
return null;
}
if (event instanceof BreakpointEvent) {
event.request().disable();
ThreadReference thread = ((BreakpointEvent) event).thread();
return new VMRemoteTarget(process, vm, thread, debugPort);
}
}
eventSet.resume();
}
}