diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/BrowserInteractNode.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/BrowserInteractNode.java index c5507805b9b2e72728bcb283e51625a1aae0a0d3..78e1c31a97edf0892f3a4415b17439f28a1e4cd7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/BrowserInteractNode.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/BrowserInteractNode.java @@ -131,6 +131,9 @@ public abstract class BrowserInteractNode extends Node { break LW; case "Q": throw new JumpToTopLevelException(); + case "help": + printHelp(ch); + break; case "where": { if (currentCaller.getDepth() > 1) { Object stack = Utils.createTraceback(0); @@ -205,4 +208,15 @@ public abstract class BrowserInteractNode extends Node { private static String browserPrompt(int depth) { return "Browse[" + depth + "]> "; } + + private static void printHelp(ConsoleIO out) { + out.println("n next"); + out.println("s step into"); + out.println("f finish"); + out.println("c or cont continue"); + out.println("Q quit"); + out.println("where show stack"); + out.println("help show help"); + out.println("<expr> evaluate expression"); + } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java index be71516f860f6787c10996a09aee8ef3cf117999..dee1f1b1ac133e00e3c25bba623712bdaedae82d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java @@ -46,6 +46,7 @@ import com.oracle.truffle.r.nodes.control.AbstractLoopNode; import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode; import com.oracle.truffle.r.nodes.instrumentation.RInstrumentation; import com.oracle.truffle.r.nodes.instrumentation.RSyntaxTags; +import com.oracle.truffle.r.nodes.instrumentation.RSyntaxTags.LoopTag; import com.oracle.truffle.r.runtime.JumpToTopLevelException; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RDeparse; @@ -515,7 +516,7 @@ public class DebugHandling { void setFinishing(AbstractLoopNode loopNode) { // Disable every statement listener except that for loopNode for (LoopStatementEventListener lser : loopStatementListeners) { - if (lser.getLoopNode() == loopNode) { + if (lser.handlesLoop(loopNode)) { lser.setFinishing(); } else { lser.disable(); @@ -708,24 +709,24 @@ public class DebugHandling { * The wrapper for the loop node is stable whereas the loop node itself will be replaced * with a specialized node. */ - private final RSyntaxNode loopNode; + private final SourceSection loopSourceSection; private final FunctionStatementsEventListener fser; LoopStatementEventListener(FunctionDefinitionNode functionDefinitionNode, Object text, Object condition, RSyntaxNode loopNode, FunctionStatementsEventListener fser) { super(functionDefinitionNode, text, condition); - this.loopNode = loopNode; + this.loopSourceSection = loopNode.getSourceSection(); this.fser = fser; } @Override public void onEnter(EventContext context, VirtualFrame frame) { - if (!disabled() && context.getInstrumentedNode() == loopNode) { + if (isEnabled(context)) { super.onEnter(context, frame); } } - RSyntaxNode getLoopNode() { - return loopNode; + boolean handlesLoop(RSyntaxNode loop) { + return loopSourceSection != null && loopSourceSection.equals(loop.getSourceSection()); } void setFinishing() { @@ -734,7 +735,7 @@ public class DebugHandling { @Override public void onReturnExceptional(EventContext context, VirtualFrame frame, Throwable exception) { - if (!disabled() && context.getInstrumentedNode() == loopNode) { + if (isEnabled(context)) { CompilerDirectives.transferToInterpreter(); returnCleanup(); } @@ -742,12 +743,16 @@ public class DebugHandling { @Override public void onReturnValue(EventContext context, VirtualFrame frame, Object result) { - if (!disabled() && context.getInstrumentedNode() == loopNode) { + if (isEnabled(context)) { CompilerDirectives.transferToInterpreter(); returnCleanup(); } } + private boolean isEnabled(EventContext ctx) { + return !disabled() && loopSourceSection != null && loopSourceSection.equals(ctx.getInstrumentedNode().getSourceSection()); + } + private void returnCleanup() { if (finishing) { finishing = false; diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index 75301404a2b7ecf7fa910c6160472f49a0425b15..1300d03106e023e3d43c21d76a5e32a5b1000631 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -7,7 +7,7 @@ suite = { { "name" : "truffle", "subdir" : True, - "version" : "e140680ae7ebc4329e5cd96889258a75b6987dfe", + "version" : "b1c4af13e75d2dc839b5050ba020356ec1602788", "urls" : [ {"url" : "https://github.com/graalvm/graal", "kind" : "git"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},