本文整理汇总了Java中com.sun.jdi.request.BreakpointRequest.enable方法的典型用法代码示例。如果您正苦于以下问题:Java BreakpointRequest.enable方法的具体用法?Java BreakpointRequest.enable怎么用?Java BreakpointRequest.enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jdi.request.BreakpointRequest
的用法示例。
在下文中一共展示了BreakpointRequest.enable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBreakpoint
import com.sun.jdi.request.BreakpointRequest; //导入方法依赖的package包/类
private static void addBreakpoint(VirtualMachine vm, ReferenceType refType) {
Location breakpointLocation = null;
List<Location> locs;
try {
locs = refType.allLineLocations();
for (Location loc: locs) {
if (loc.method().name().equals(METHOD_NAME)) {
breakpointLocation = loc;
break;
}
}
} catch (AbsentInformationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (breakpointLocation != null) {
EventRequestManager evtReqMgr = vm.eventRequestManager();
BreakpointRequest bReq = evtReqMgr.createBreakpointRequest(breakpointLocation);
bReq.setSuspendPolicy(BreakpointRequest.SUSPEND_ALL);
bReq.enable();
}
}
示例2: loop
import com.sun.jdi.request.BreakpointRequest; //导入方法依赖的package包/类
private void loop(BreakpointRequest br, Field contextField) throws Exception {
int lineNumber = br.location().lineNumber();
br.setSuspendPolicy(BreakpointRequest.SUSPEND_EVENT_THREAD);
br.enable();
EventQueue evtQueue = vm.eventQueue();
boolean run = true;
while (run) {
EventSet evtSet = evtQueue.remove();
EventIterator evtIter = evtSet.eventIterator();
while (evtIter.hasNext()) {
try {
Event evt = evtIter.next();
EventRequest evtReq = evt.request();
if (evtReq instanceof BreakpointRequest
&& ((BreakpointRequest) evtReq).location().lineNumber() == lineNumber) {
new BreakpointProcessor(missingPerms)
.processBreakpoint(contextField, (BreakpointEvent) evt);
// TODO: 12/20/17 Remove when full loop processing is restored
// run = false;
System.out.println(missingPerms);
missingPerms.clear();
}
} finally {
evtSet.resume();
}
}
}
// System.out.println(missingPerms);
// printPerms(missingPerms);
}
示例3: run
import com.sun.jdi.request.BreakpointRequest; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
final String run(String[] args) throws Exception {
String[] params = args[2].split(":");
List<ReferenceType> classes =
jdb.debuggee.classesByName(params[0]);
if (classes.isEmpty()) {
if (!jdb.deferringLineBreakpoint.containsKey(params[0])) {
jdb.deferringLineBreakpoint.put(
params[0], new ArrayList<Integer>());
}
jdb.deferringLineBreakpoint.get(
params[0]).add(Integer.parseInt(params[1]));
return String.format(
"Deferring breakpoint %s\n" +
"it will be set after the class is loaded.",
args[2]);
} else {
List<Location> locations = classes.get(0).
locationsOfLine(Integer.parseInt(params[1]));
if (!locations.isEmpty()) {
Location loc = locations.get(0);
BreakpointRequest breakpointRequest =
jdb.eventRequestManager.
createBreakpointRequest(loc);
breakpointRequest.setSuspendPolicy(
EventRequest.SUSPEND_ALL);
breakpointRequest.enable();
jdb.breakpointRegisterMap.put(
loc.toString(), breakpointRequest);
return String.format("Breakpoint set: " + loc);
} else {
return EMPTY_MSG;
}
}
}
示例4: installHaltPoint
import com.sun.jdi.request.BreakpointRequest; //导入方法依赖的package包/类
private void installHaltPoint(VirtualMachine vm) {
List<ReferenceType> targetClasses = vm
.classesByName(VMLocalTarget.class.getName());
ReferenceType classRef = targetClasses.get(0);
Method meth = classRef.methodsByName("haltPoint").get(0);
BreakpointRequest req = vm.eventRequestManager()
.createBreakpointRequest(meth.location());
req.setSuspendPolicy(BreakpointRequest.SUSPEND_EVENT_THREAD);
req.enable();
}
示例5: resumeTo
import com.sun.jdi.request.BreakpointRequest; //导入方法依赖的package包/类
public BreakpointEvent resumeTo(Location loc) {
final BreakpointRequest request = eventRequestManager().createBreakpointRequest(loc);
request.addCountFilter(1);
request.enable();
return (BreakpointEvent)resumeToEvent(request);
}