/** * 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; }