summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci.debugger/scripts
diff options
context:
space:
mode:
authorRoland Senn <rsx@bluewin.ch>2021-01-16 17:31:45 +0100
committerBen Gamari <ben@smart-cactus.org>2021-03-10 16:59:05 -0500
commitfcfc66e59c81277c1f7c079ad4e0ccd9a69e1fb6 (patch)
tree378b6b8bebea928fe5fafad2dcf7920253ecbaeb /testsuite/tests/ghci.debugger/scripts
parent115cd3c85a8c38f1fe2a10d4ee515f92c96dd5a2 (diff)
downloadhaskell-fcfc66e59c81277c1f7c079ad4e0ccd9a69e1fb6.tar.gz
Ignore breakpoint for a specified number of iterations. (#19157)
* Implement new debugger command `:ignore` to set an `ignore count` for a specified breakpoint. * Allow new optional parameter on `:continue` command to set an `ignore count` for the current breakpoint. * In the Interpreter replace the current `Word8` BreakArray with an `Int` array. * Change semantics of values in `BreakArray` to: n < 0 : Breakpoint is disabled. n == 0 : Breakpoint is enabled. n > 0 : Breakpoint is enabled, but ignore next `n` iterations. * Rewrite `:enable`/`:disable` processing as a special case of `:ignore`. * Remove references to `BreakArray` from `ghc/UI.hs`.
Diffstat (limited to 'testsuite/tests/ghci.debugger/scripts')
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T19157.hs8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T19157.script20
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T19157.stdout41
-rw-r--r--testsuite/tests/ghci.debugger/scripts/all.T1
4 files changed, 70 insertions, 0 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/T19157.hs b/testsuite/tests/ghci.debugger/scripts/T19157.hs
new file mode 100644
index 0000000000..d844a31e7e
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T19157.hs
@@ -0,0 +1,8 @@
+module T19157 where
+
+mySum :: [Int] -> Int
+mySum lst = go 0 lst
+ where
+ go :: Int -> [Int] -> Int
+ go sum [] = sum
+ go sum (s : ss) = go (sum + s) ss
diff --git a/testsuite/tests/ghci.debugger/scripts/T19157.script b/testsuite/tests/ghci.debugger/scripts/T19157.script
new file mode 100644
index 0000000000..edcad557d5
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T19157.script
@@ -0,0 +1,20 @@
+:l T19157
+:break mySum.go
+putStrLn "---------------------- Test 1"
+mySum [1,2,3,4,5,6]
+:cont 2
+:cont 1
+:cont
+:cont
+putStrLn "---------------------- Test 2"
+:ig 1 1000
+mySum [1..2000]
+putStrLn "---------------------- Test 3"
+:continue q
+:continue -1
+:cont 3 4
+:ig a 5
+:ignore 5 a
+:ignore 0
+:ignore 1 2 3 4
+:ignore 0 -1
diff --git a/testsuite/tests/ghci.debugger/scripts/T19157.stdout b/testsuite/tests/ghci.debugger/scripts/T19157.stdout
new file mode 100644
index 0000000000..f0ac09d7f4
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T19157.stdout
@@ -0,0 +1,41 @@
+Breakpoint 0 activated at T19157.hs:7:17-19
+Breakpoint 1 activated at T19157.hs:8:23-37
+---------------------- Test 1
+Stopped in T19157.mySum.go, T19157.hs:8:23-37
+_result :: Int = _
+go :: Int -> [Int] -> Int = _
+s :: Int = 1
+ss :: [Int] = [2,3,4,5,6]
+sum :: Int = 0
+Stopped in T19157.mySum.go, T19157.hs:8:23-37
+_result :: Int = _
+go :: Int -> [Int] -> Int = _
+s :: Int = 4
+ss :: [Int] = [5,6]
+sum :: Int = _
+Stopped in T19157.mySum.go, T19157.hs:8:23-37
+_result :: Int = _
+go :: Int -> [Int] -> Int = _
+s :: Int = 6
+ss :: [Int] = []
+sum :: Int = _
+Stopped in T19157.mySum.go, T19157.hs:7:17-19
+_result :: Int = _
+sum :: Int = _
+21
+---------------------- Test 2
+Stopped in T19157.mySum.go, T19157.hs:8:23-37
+_result :: Int = _
+go :: Int -> [Int] -> Int = _
+s :: Int = 1001
+ss :: [Int] = _
+sum :: Int = _
+---------------------- Test 3
+Ignore count ‘q’ is not numeric
+Ignore count ‘-1’ must be >= 0
+After ':continue' only one ignore count is allowed
+Breakpoint a not found
+Breakpoint 5 not found
+Syntax: :ignore <breaknum> <count>
+Syntax: :ignore <breaknum> <count>
+Ignore count ‘-1’ must be >= 0
diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T
index 30e5c4312c..489fa89d36 100644
--- a/testsuite/tests/ghci.debugger/scripts/all.T
+++ b/testsuite/tests/ghci.debugger/scripts/all.T
@@ -125,3 +125,4 @@ test('T16700', normal, ghci_script, ['T16700.script'])
test('break029', extra_files(['break029.hs']), ghci_script, ['break029.script'])
test('T2215', normal, ghci_script, ['T2215.script'])
test('T17989', normal, ghci_script, ['T17989.script'])
+test('T19157', normal, ghci_script, ['T19157.script'])