本文整理汇总了Java中com.sun.jdi.event.BreakpointEvent类的典型用法代码示例。如果您正苦于以下问题:Java BreakpointEvent类的具体用法?Java BreakpointEvent怎么用?Java BreakpointEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BreakpointEvent类属于com.sun.jdi.event包,在下文中一共展示了BreakpointEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runTests
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
/********** test core **********/
protected void runTests()
throws Exception
{
/*
* Run to String.<init>
*/
startUp("GetUninitializedStringValueTarg");
BreakpointEvent bpe = resumeTo("java.lang.String", "<init>", "(Ljava/lang/String;)V");
/*
* We've arrived. Look at 'this' - it will be uninitialized (the value field will not be set yet).
*/
StackFrame frame = bpe.thread().frame(0);
StringReference sr = (StringReference)frame.thisObject();
if (!sr.value().equals("")) {
throw new Exception("Unexpected value for the uninitialized String");
}
/*
* resume the target listening for events
*/
listenUntilVMDisconnect();
}
示例2: runTests
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
/********** test core **********/
protected void runTests()
throws Exception
{
startToMain("LambdaBreakpointTestTarg");
// Put a breakpoint on each location in the order they should happen
for (int line : LambdaBreakpointTestTarg.breakpointLines) {
System.out.println("Running to line: " + line);
BreakpointEvent be = resumeTo("LambdaBreakpointTestTarg", line);
int stoppedAt = be.location().lineNumber();
System.out.println("Stopped at line: " + stoppedAt);
if (stoppedAt != line) {
throw new Exception("Stopped on the wrong line: "
+ stoppedAt + " != " + line);
}
}
/*
* resume the target listening for events
*/
listenUntilVMDisconnect();
}
示例3: runTests
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
/********** test core **********/
protected void runTests()
throws Exception
{
startToMain("LambdaBreakpointTestTarg");
// Put a breakpoint on each location in the order they should happen
for (int line : BKPT_LINES) {
System.out.println("Running to line: " + line);
BreakpointEvent be = resumeTo("LambdaBreakpointTestTarg", line);
int stoppedAt = be.location().lineNumber();
System.out.println("Stopped at line: " + stoppedAt);
if (stoppedAt != line) {
throw new Exception("Stopped on the wrong line: "
+ stoppedAt + " != " + line);
}
}
/*
* resume the target listening for events
*/
listenUntilVMDisconnect();
}
示例4: wrap
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
public static F3Event wrap(F3VirtualMachine f3vm, Event evt) {
if (evt == null) {
return null;
}
if (evt instanceof AccessWatchpointEvent) {
return new F3AccessWatchpointEvent(f3vm, (AccessWatchpointEvent)evt);
} else if (evt instanceof BreakpointEvent) {
return new F3BreakpointEvent(f3vm, (BreakpointEvent)evt);
} else if (evt instanceof ClassPrepareEvent) {
return new F3ClassPrepareEvent(f3vm, (ClassPrepareEvent)evt);
} else if (evt instanceof ClassUnloadEvent) {
return new F3ClassUnloadEvent(f3vm, (ClassUnloadEvent)evt);
} else if (evt instanceof ExceptionEvent) {
return new F3ExceptionEvent(f3vm, (ExceptionEvent)evt);
} else if (evt instanceof MethodEntryEvent) {
return new F3MethodEntryEvent(f3vm, (MethodEntryEvent)evt);
} else if (evt instanceof MethodExitEvent) {
return new F3MethodExitEvent(f3vm, (MethodExitEvent)evt);
} else if (evt instanceof ModificationWatchpointEvent) {
return new F3ModificationWatchpointEvent(f3vm, (ModificationWatchpointEvent)evt);
} else if (evt instanceof MonitorContendedEnterEvent) {
return new F3MonitorContendedEnterEvent(f3vm, (MonitorContendedEnterEvent)evt);
} else if (evt instanceof MonitorContendedEnteredEvent) {
return new F3MonitorContendedEnteredEvent(f3vm, (MonitorContendedEnteredEvent)evt);
} else if (evt instanceof MonitorWaitEvent) {
return new F3MonitorWaitEvent(f3vm, (MonitorWaitEvent)evt);
} else if (evt instanceof MonitorWaitedEvent) {
return new F3MonitorWaitedEvent(f3vm, (MonitorWaitedEvent)evt);
} else if (evt instanceof StepEvent) {
return new F3StepEvent(f3vm, (StepEvent)evt);
} else if (evt instanceof ThreadDeathEvent) {
return new F3ThreadDeathEvent(f3vm, (ThreadDeathEvent)evt);
} else if (evt instanceof ThreadStartEvent) {
return new F3ThreadStartEvent(f3vm, (ThreadStartEvent)evt);
} else if (evt instanceof VMDeathEvent) {
return new F3VMDeathEvent(f3vm, (VMDeathEvent)evt);
} else if (evt instanceof VMDisconnectEvent) {
return new F3VMDisconnectEvent(f3vm, (VMDisconnectEvent)evt);
} else if (evt instanceof VMStartEvent) {
return new F3VMStartEvent(f3vm, (VMStartEvent)evt);
} else if (evt instanceof WatchpointEvent) {
return new F3WatchpointEvent(f3vm, (WatchpointEvent)evt);
} else if (evt instanceof LocatableEvent) {
return new F3LocatableEvent(f3vm, (LocatableEvent)evt);
} else {
return new F3Event(f3vm, evt);
}
}
示例5: runTests
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
/********** test core **********/
protected void runTests() throws Exception {
/*
* Get to the top of main()
* to determine targetClass and mainThread
*/
BreakpointEvent bpe = startToMain(targetClassName);
targetClass = bpe.location().declaringType();
mainThread = bpe.thread();
int initialSize = mainThread.frames().size();
resumeTo(targetClassName, "foo3", "()V");
if (!mainThread.frame(0).location().method().name()
.equals("foo3")) {
failure("frame failed");
}
// not F3 frames
for (StackFrame fr : mainThread.frames()) {
Assert.assertEquals(false, ((F3StackFrame)fr).isF3Frame());
}
if (mainThread.frames().size() != (initialSize + 3)) {
failure("frames size failed");
}
if (mainThread.frames().size() != mainThread.frameCount()) {
failure("frames size not equal to frameCount");
}
exceptionTest(-1, 1);
exceptionTest(mainThread.frameCount(), 1);
exceptionTest(0, -1);
exceptionTest(0, -2);
exceptionTest(0, mainThread.frameCount()+1);
nameTest(0, 0);
nameTest(0, 1);
nameTest(0, 4);
nameTest(2, 2);
nameTest(1, 1);
/*
* resume until end
*/
listenUntilVMDisconnect();
/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
println("FramesTest: passed");
} else {
throw new Exception("FramesTest: failed");
}
}
示例6: testHello1
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
@Test(timeout=5000)
public void testHello1() {
try {
compile("LocalVar.f3");
stop("in LocalVar.f3$run$");
f3run();
BreakpointEvent bkpt = resumeToBreakpoint();
// We hide F3 synthetic variables.
F3StackFrame frame = (F3StackFrame) bkpt.thread().frame(0);
LocalVariable var = frame.visibleVariableByName("_$UNUSED$_$ARGS$_");
Assert.assertNull(var);
// underlying (java) frame object exposes this variable.
StackFrame jframe = F3Wrapper.unwrap(frame);
var = jframe.visibleVariableByName("_$UNUSED$_$ARGS$_");
Assert.assertNotNull(var);
resumeToVMDeath();
quit();
} catch (Exception exp) {
exp.printStackTrace();
Assert.fail(exp.getMessage());
}
}
示例7: processBreakpointEvent
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
public void processBreakpointEvent(ObjectReference instance, BreakpointEvent event,
Breakpoint breakpoint, JDIDebugTarget target) {
if (!breakpoint.isTrackingActive()) {
return;
}
long currTime = System.currentTimeMillis();
LineBreakpointHistory history = (LineBreakpointHistory)getHistory(instance, breakpoint, target);
boolean notifyInstanceAdded = history.getAllValues().size() == 0;
boolean eventModificationEvent = event instanceof ModificationWatchpointEvent;
history.addValue(currTime, event.thread());
for (IBreakpointListener listener : listeners) {
if (notifyInstanceAdded) {
listener.notifyInstanceAdded(breakpoint, instance, target);
}
listener.notifyBreakpointHit(breakpoint, instance, target);
}
}
示例8: loop
import com.sun.jdi.event.BreakpointEvent; //导入依赖的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);
}
示例9: resumeTo
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
public BreakpointEvent resumeTo(String clsName, String methodName,
String methodSignature) {
ReferenceType rt = findReferenceType(clsName);
if (rt == null) {
rt = resumeToPrepareOf(clsName).referenceType();
}
Method method = findMethod(rt, methodName, methodSignature);
if (method == null) {
throw new IllegalArgumentException("Bad method name/signature");
}
return resumeTo(method.location());
}
示例10: resumeToBreakpoint
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
public BreakpointEvent resumeToBreakpoint() {
return (BreakpointEvent) resumeToEvent(new EventFilter() {
public boolean match(Event evt) {
return (evt instanceof BreakpointEvent);
}
});
}
示例11: breakpointEvent
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
public void breakpointEvent(BreakpointEvent evt) {
synchronized (listeners) {
for (EventNotifier en : listeners) {
en.breakpointEvent(evt);
}
}
}
示例12: runTests
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
protected void runTests() throws Exception {
startToMain();
BreakpointEvent bpe = resumeTo("f3.lang.Builtins", "println", "(Ljava/lang/Object;)V");
mainThread = bpe.thread();
targetClass = bpe.location().declaringType();
// We are stopped under the on replace for sv2
List<StackFrame> frames = bpe.thread().frames(0,10);
for (StackFrame frame: frames) {
printUser(frame, 1);
}
bpe = resumeTo("f3.lang.Builtins", "println", "(Ljava/lang/Object;)V");
// stopped in the on replace for override1
printUser(bpe.thread().frame(2), 2);
testFailed = !didTestPass();
/*
* resume until end
*/
listenUntilVMDisconnect();
/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
writeActual(testClassName + ": passed");
} else {
throw new Exception(testClassName + ": failed");
}
}
示例13: runTests
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
protected void runTests() throws Exception {
startToMain();
// go to "run" method of F3 class
BreakpointEvent bpe = resumeTo(targetClassName, f3RunMethodName(),
f3RunMethodSignature());
mainThread = bpe.thread();
if (!mainThread.frame(0).location().method().name().equals(f3RunMethodName())) {
failure("frame failed");
}
Assert.assertEquals(true, mainThread.frame(0) instanceof F3StackFrame);
Assert.assertEquals(true, ((F3StackFrame)mainThread.frame(0)).isF3Frame());
/*
* resume until end
*/
listenUntilVMDisconnect();
/*
* deal with results of test
*/
if (!testFailed) {
println("HelloTest: passed");
} else {
throw new Exception("HelloTest: failed");
}
}
示例14: runTests
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
protected void runTests() throws Exception {
startToMain();
BreakpointEvent bpe = resumeTo("f3.lang.Builtins", "println", "(Ljava/lang/Object;)V");
mainThread = bpe.thread();
targetClass = bpe.location().declaringType();
// We are stopped under the on replace for sv2
List<StackFrame> frames = bpe.thread().frames(0,10);
for (StackFrame frame: frames) {
printTop(frame, 1);
}
bpe = resumeTo("f3.lang.Builtins", "println", "(Ljava/lang/Object;)V");
// stopped in the on replace for override1
printTop(bpe.thread().frame(2), 2);
testFailed = !didTestPass();
/*
* resume until end
*/
listenUntilVMDisconnect();
/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
writeActual(testClassName + ": passed");
} else {
throw new Exception(testClassName + ": failed");
}
}
示例15: handleEvent
import com.sun.jdi.event.BreakpointEvent; //导入依赖的package包/类
@Override
public boolean handleEvent(Event event, JDIDebugTarget target,
boolean suspendVote, EventSet eventSet) {
if (event instanceof BreakpointEvent) {
try {
ObjectReference instance = ((BreakpointEvent) event).thread().frame(0).thisObject();
wpMgr.processBreakpointEvent(instance, (BreakpointEvent)event, this, target);
} catch (IncompatibleThreadStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}