/** * Adds a new breakpoint to this session and makes it capable of suspending execution. * <p> * The breakpoint suspends execution by making a {@link SuspendedCallback callback} to this * session, together with an event description that includes * {@linkplain SuspendedEvent#getBreakpoints() which breakpoint(s)} were hit. * * @param breakpoint a new breakpoint * @return the installed breakpoint * @throws IllegalStateException if the session has been closed * * @since 0.17 */ public synchronized Breakpoint install(Breakpoint breakpoint) { install(breakpoint, false); return breakpoint; }
/** * Adds a new breakpoint to this session and makes it capable of suspending execution. * <p> * The breakpoint suspends execution by making a {@link SuspendedCallback callback} to this * session, together with an event description that includes * {@linkplain SuspendedEvent#getBreakpoints() which breakpoint(s)} were hit. * * @param breakpoint a new breakpoint * @return the installed breakpoint * @throws IllegalStateException if the session has been closed * * @since 0.17 */ public synchronized Breakpoint install(Breakpoint breakpoint) { install(breakpoint, false); return breakpoint; }
/** * Starts a new {@link DebuggerSession session} provided with a callback that gets notified * whenever the execution is suspended and with a list of source syntax elements on which it is * possible to step. Only steps created with one of these element kinds are accepted in this * session. All specified elements are used by steps by default, if not specified otherwise by * {@link StepConfig.Builder#sourceElements(SourceElement...)}. When no elements are provided, * stepping is not possible and the session itself has no instrumentation overhead. * * @param callback the callback to notify * @param defaultSourceElements a list of source elements, an explicit empty list disables * stepping * @see DebuggerSession * @see SuspendedEvent * @since 0.33 */ public DebuggerSession startSession(SuspendedCallback callback, SourceElement... defaultSourceElements) { DebuggerSession session = new DebuggerSession(this, callback, defaultSourceElements); Breakpoint[] bpts; synchronized (this) { sessions.add(session); bpts = breakpoints.toArray(new Breakpoint[]{}); } for (Breakpoint b : bpts) { session.install(b, true); } session.install(alwaysHaltBreakpoint, true); return session; }
/** * Starts a new {@link DebuggerSession session} provided with a callback that gets notified * whenever the execution is suspended and with a list of source syntax elements on which it is * possible to step. Only steps created with one of these element kinds are accepted in this * session. All specified elements are used by steps by default, if not specified otherwise by * {@link StepConfig.Builder#sourceElements(SourceElement...)}. When no elements are provided, * stepping is not possible and the session itself has no instrumentation overhead. * * @param callback the callback to notify * @param defaultSourceElements a list of source elements, an explicit empty list disables * stepping * @see DebuggerSession * @see SuspendedEvent * @since 0.33 */ public DebuggerSession startSession(SuspendedCallback callback, SourceElement... defaultSourceElements) { DebuggerSession session = new DebuggerSession(this, callback, defaultSourceElements); Breakpoint[] bpts; synchronized (this) { sessions.add(session); bpts = breakpoints.toArray(new Breakpoint[]{}); } for (Breakpoint b : bpts) { session.install(b, true); } session.install(alwaysHaltBreakpoint, true); return session; }
private void assertBreakpoints(Source source, List<Breakpoint> breakpoints, Set<Breakpoint> breakpointsResolved, List<Breakpoint> breakpointsHit) { try (DebuggerSession session = startSession()) { for (Breakpoint breakpoint : breakpoints) { session.install(breakpoint); } startEval(source); while (breakpointsHit.size() != breakpoints.size()) { expectSuspended((SuspendedEvent event) -> { breakpointsHit.addAll(event.getBreakpoints()); event.prepareContinue(); }); } expectDone(); } Assert.assertEquals(breakpoints.size(), breakpointsResolved.size()); Assert.assertEquals(breakpoints.size(), breakpointsHit.size()); }
s.install(breakpoint, true);
s.install(breakpoint, true);
private void assertBreakpoints(Source source, List<Breakpoint> breakpoints, Set<Breakpoint> breakpointsResolved, List<Breakpoint> breakpointsHit) { try (DebuggerSession session = startSession(new SourceElement[0])) { for (Breakpoint breakpoint : breakpoints) { session.install(breakpoint); } startEval(source); while (breakpointsHit.size() != breakpoints.size()) { try { expectSuspended((SuspendedEvent event) -> { breakpointsHit.addAll(event.getBreakpoints()); event.prepareContinue(); }); } catch (Throwable t) { Set<Breakpoint> notHit = new HashSet<>(breakpoints); notHit.removeAll(breakpointsHit); for (Breakpoint b : notHit) { err("Not hit " + b + ": " + b.getLocationDescription()); } err("---"); for (Breakpoint b : breakpointsHit) { err("Hit " + b + ": " + b.getLocationDescription()); } throw t; } } expectDone(); } Assert.assertEquals(breakpoints.size(), breakpointsResolved.size()); Assert.assertEquals(breakpoints.size(), breakpointsHit.size()); }
Breakpoint breakpoint = session.install( Breakpoint.newBuilder(DebuggerTester.getSourceImpl(source)).lineIs(line).columnIs(column).oneShot().resolveListener(new Breakpoint.ResolveListener() { @Override
Breakpoint breakpoint = session.install(Breakpoint.newBuilder(tsource).lineIs(line).oneShot().resolveListener(new Breakpoint.ResolveListener() { @Override public void breakpointResolved(Breakpoint brkp, SourceSection section) {
Breakpoint breakpoint = session.install(Breakpoint.newBuilder(tsource).lineIs(line).oneShot().resolveListener(new Breakpoint.ResolveListener() { @Override public void breakpointResolved(Breakpoint brkp, SourceSection section) {
Breakpoint breakpoint = session.install( Breakpoint.newBuilder(DebuggerTester.getSourceImpl(source)).lineIs(line).columnIs(column).oneShot().resolveListener(new Breakpoint.ResolveListener() { @Override