Debugger getDebugger() { return session.getDebugger(); }
final Debugger getDebugger() { return getSession().getDebugger(); }
DebuggerExecutionLifecycle(DebuggerSession session) { this.session = session; this.lifecycleInstrumenter = session.getDebugger().getEnv().getInstrumenter(); }
/** * {@inheritDoc} * * @since 1.0 */ @Override public void printStackTrace() { printStackTrace(new PrintStream(session.getDebugger().getEnv().err())); }
static ValuePropertiesCollection getProperties(Object value, DebuggerSession session, LanguageInfo language, DebugScope scope) { ValuePropertiesCollection properties = null; if (value instanceof TruffleObject) { TruffleObject object = (TruffleObject) value; Map<Object, Object> map = ObjectStructures.asMap(session.getDebugger().getMessageNodes(), object); if (map != null) { properties = new ValuePropertiesCollection(session, language, object, map, map.entrySet(), scope); } } return properties; }
synchronized boolean install(DebuggerSession d, boolean failOnError) { if (disposed) { if (failOnError) { throw new IllegalArgumentException("Cannot install breakpoint, it is disposed already."); } else { return false; } } if (this.sessions.contains(d)) { if (failOnError) { throw new IllegalStateException("Breakpoint is already installed in the session."); } else { return true; } } install(d.getDebugger()); this.sessions.add(d); sessionsAssumptionInvalidate(); if (enabled) { install(); } return true; }
synchronized boolean install(DebuggerSession d, boolean failOnError) { if (disposed) { if (failOnError) { throw new IllegalArgumentException("Cannot install breakpoint, it is disposed already."); } else { return false; } } if (this.sessions.contains(d)) { if (failOnError) { throw new IllegalStateException("Breakpoint is already installed in the session."); } else { return true; } } install(d.getDebugger()); this.sessions.add(d); sessionsAssumptionInvalidate(); if (enabled) { install(); } return true; }
/** * Get source code location where this exception is to be caught. In case this exception is * going to be caught by guest language code, the catch location is provided. <code>null</code> * is returned for uncaught exceptions. * * @return the catch location, or <code>null</code> in case of uncaught exceptions. * @since 1.0 */ public CatchLocation getCatchLocation() { if (!isCatchNodeComputed) { synchronized (this) { if (!isCatchNodeComputed) { if (exception instanceof TruffleException) { catchLocation = BreakpointExceptionFilter.getCatchNode(session.getDebugger(), throwLocation, exception); if (catchLocation != null) { catchLocation.setSuspendedEvent(suspendedEvent); catchLocation = catchLocation.cloneFor(session); } } isCatchNodeComputed = true; } } } return catchLocation; }
DebugValue wrapHeapValue(Object result) { LanguageInfo language; RootNode root = findCurrentRoot(); if (root != null) { language = root.getLanguageInfo(); } else { language = null; } return new HeapValue(event.getSession().getDebugger(), language, null, result); }
static boolean isEvalRootStackFrame(DebuggerSession session, FrameInstance instance) { CallTarget target = instance.getCallTarget(); RootNode root = null; if (target instanceof RootCallTarget) { root = ((RootCallTarget) target).getRootNode(); } if (root != null && session.getDebugger().getEnv().isEngineRoot(root)) { return true; } return false; }
static boolean isEvalRootStackFrame(DebuggerSession session, FrameInstance instance) { CallTarget target = instance.getCallTarget(); RootNode root = null; if (target instanceof RootCallTarget) { root = ((RootCallTarget) target).getRootNode(); } if (root != null && session.getDebugger().getEnv().isEngineRoot(root)) { return true; } return false; }
@Override boolean step(DebuggerSession steppingSession, EventContext context, SuspendAnchor suspendAnchor) { boolean hit = current.step(steppingSession, context, suspendAnchor); if (hit) { if (current == last) { return true; } else { current = current.next; current.initialize(SuspendedContext.create(context, steppingSession.getDebugger().getEnv()), suspendAnchor); } } return false; }
/** * Get the current inner-most scope. The scope might not provide valid information if the * execution path diverges from this trace element. * * @return the scope, or <code>null</code> when no language is associated with this frame * location, or when no local scope exists. * @since 1.0 */ public DebugScope getScope() { Node node = traceElement.getLocation(); if (node == null) { return null; } RootNode root = node.getRootNode(); if (root.getLanguageInfo() == null) { // no language, no scopes return null; } Frame elementFrame = traceElement.getFrame(); MaterializedFrame frame = (elementFrame != null) ? elementFrame.materialize() : null; Iterable<Scope> scopes = session.getDebugger().getEnv().findLocalScopes(node, frame); Iterator<Scope> it = scopes.iterator(); if (!it.hasNext()) { return null; } return new DebugScope(it.next(), it, session, null, frame, root); }
private static Object evalInContext(SuspendedEvent ev, Node node, MaterializedFrame frame, String code) { RootNode rootNode = node.getRootNode(); if (rootNode == null) { throw new IllegalArgumentException("Cannot evaluate in context using a node that is not yet adopated using a RootNode."); } LanguageInfo info = rootNode.getLanguageInfo(); if (info == null) { throw new IllegalArgumentException("Cannot evaluate in context using a without an associated TruffleLanguage."); } if (!info.isInteractive()) { throw new IllegalStateException("Can not evaluate in a non-interactive language."); } final Source source = Source.newBuilder(info.getId(), code, "eval in context").build(); ExecutableNode fragment = ev.getSession().getDebugger().getEnv().parseInline(source, node, frame); if (fragment != null) { ev.getInsertableNode().setParentOf(fragment); return fragment.execute(frame); } else { return Debugger.ACCESSOR.evalInContext(source, node, frame); } }
TruffleObject argsTO = (TruffleObject) argumentsObj; arguments = DebugValue.getProperties(argumentsObj, session, getLanguage(), this); if (arguments == null && ObjectStructures.isArray(session.getDebugger().getMessageNodes(), argsTO)) { List<Object> array = ObjectStructures.asList(session.getDebugger().getMessageNodes(), argsTO); arguments = new ValueInteropList(session, getLanguage(), array);
Debugger debugger = event.getSession().getDebugger(); MaterializedFrame frame = findTruffleFrame(); Iterable<Scope> scopes = debugger.getEnv().findLocalScopes(node, frame);
MaterializedFrame frame = findTruffleFrame(); try { Iterable<Scope> scopes = session.getDebugger().getEnv().findLocalScopes(node, frame); Iterator<Scope> it = scopes.iterator(); if (!it.hasNext()) {