From 765a5916c5f0cf2286578abf726d3c1a6a98b340 Mon Sep 17 00:00:00 2001
From: Florian Angerer <florian.angerer@oracle.com>
Date: Thu, 18 May 2017 18:38:24 +0200
Subject: [PATCH] Fix: Removed root source section filter to enable step
 debugging for promises.

---
 .../instrumentation/RInstrumentation.java      |  1 -
 .../truffle/r/test/ExpectedTestOutput.test     | 18 ++++++++++++++++++
 .../library/utils/TestInteractiveDebug.java    |  6 ++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RInstrumentation.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RInstrumentation.java
index 80b3544234..4f8856e8c6 100644
--- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RInstrumentation.java
+++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/instrumentation/RInstrumentation.java
@@ -77,7 +77,6 @@ public class RInstrumentation {
         SourceSection fdns = fdn.getSourceSection();
         builder.indexIn(fdns.getCharIndex(), fdns.getCharLength());
         builder.sourceIs(fdns.getSource());
-        builder.rootSourceSectionEquals(fdns);
         return builder;
     }
 
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
index fcc7c6994e..3f97cdba2b 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test
@@ -144653,6 +144653,24 @@ debug: print(x)
 [1] 5
 exiting from: f(5)
 
+##com.oracle.truffle.r.test.library.utils.TestInteractiveDebug.testPromise#Ignored.ImplementationError#
+#fun <- function(x) { cat({ cat(x); cat('<<<NEWLINE>>>') }) }; debug(fun); fun(3)<<<NEWLINE>>><<<NEWLINE>>><<<NEWLINE>>><<<NEWLINE>>><<<NEWLINE>>>
+debugging in: fun(3)
+debug at #1: {
+    cat({
+        cat(x)
+        cat("\n")
+    })
+}
+debug at #1: cat({
+    cat(x)
+    cat("\n")
+})
+debug at #1: cat(x)
+3debug at #1: cat("\n")
+
+exiting from: fun(3)
+
 ##com.oracle.truffle.r.test.library.utils.TestInteractiveDebug.testSimple#
 #f <- function(x) {<<<NEWLINE>>>  t <- x + 1<<<NEWLINE>>>  print(t)<<<NEWLINE>>>  t}<<<NEWLINE>>>debug(f)<<<NEWLINE>>>f(5)<<<NEWLINE>>>x<<<NEWLINE>>>n<<<NEWLINE>>>n<<<NEWLINE>>>t<<<NEWLINE>>>n<<<NEWLINE>>>n
 debugging in: f(5)
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestInteractiveDebug.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestInteractiveDebug.java
index e74647fcf2..0d5d1b076f 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestInteractiveDebug.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestInteractiveDebug.java
@@ -59,6 +59,12 @@ public class TestInteractiveDebug extends TestBase {
         assertEval("bar <- function(x) { for(i in seq(x)) print(x) }; foo <- function(x) { cat('foo entry\\n'); bar(x); cat('foo exit\\n') }; debug(foo); foo(5)\n\n\ns\nn\n\n\nf\n\n");
     }
 
+    @Test
+    public void testPromise() {
+        // TODO enable test as soon as Truffle support is available
+        assertEval(Ignored.ImplementationError, "fun <- function(x) { cat({ cat(x); cat('\n') }) }; debug(fun); fun(3)\n\n\n\n\n");
+    }
+
     @Test
     public void testNestedDebugging() {
         assertEval(Output.IgnoreDebugPath,
-- 
GitLab