diff options
author | Roland Senn <rsx@bluewin.ch> | 2019-05-14 09:45:36 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-06-09 18:44:18 -0400 |
commit | 10452959136fbf271ac21eb0740030c046db36e1 (patch) | |
tree | 5772061b3ef4c6e9f4ee421aeae80986cfad8833 /testsuite/tests/ghci.debugger | |
parent | a22e51ea6f7a046c87d57ce30d143eef6abee9ff (diff) | |
download | haskell-10452959136fbf271ac21eb0740030c046db36e1.tar.gz |
Add disable/enable commands to ghci debugger #2215
This patch adds two new commands `:enable` and `:disable` to the GHCi debugger.
Opposite to `:set stop <n> :continue` a breakpoint disabled with `:disable` will
not loose its previously set stop command.
A new field breakEnabled is added to the BreakLocation data structure to
track the enable/disable state. When a breakpoint is disabled with a `:disable`
command, the following happens:
The corresponding BreakLocation data element is searched dictionary of the
`breaks` field of the GHCiStateMonad. If the break point is found and not
already in the disabled state, the breakpoint is removed from bytecode.
The BreakLocation data structure is kept in the breaks list and the new
breakEnabled field is set to false.
The `:enable` command works similar.
The breaks field in the GHCiStateMonad was changed from an association list
to int `IntMap`.
Diffstat (limited to 'testsuite/tests/ghci.debugger')
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/T2215.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/T2215.script | 26 | ||||
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/T2215.stdout | 34 | ||||
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/all.T | 1 |
4 files changed, 72 insertions, 0 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/T2215.hs b/testsuite/tests/ghci.debugger/scripts/T2215.hs new file mode 100644 index 0000000000..7b62e031c2 --- /dev/null +++ b/testsuite/tests/ghci.debugger/scripts/T2215.hs @@ -0,0 +1,11 @@ +import System.Environment + +qsort :: [Int] -> [Int] +qsort [] = [] +qsort (a:as) = qsort left ++ [a] ++ qsort right + where (left,right) = (filter (<=a) as, filter (>a) as) + +main :: IO() +main = do + args <- getArgs + print $ qsort $ map read $ args diff --git a/testsuite/tests/ghci.debugger/scripts/T2215.script b/testsuite/tests/ghci.debugger/scripts/T2215.script new file mode 100644 index 0000000000..26267f6ed3 --- /dev/null +++ b/testsuite/tests/ghci.debugger/scripts/T2215.script @@ -0,0 +1,26 @@ +:l T2215.hs +:break 5 +:break 6 +:show breaks +:main 5 21 7 13 8 +:abandon +:disable 0 +:show breaks +:main 5 21 7 13 8 +:abandon +:disable 1 +:disable 1 +:show breaks +:main 5 21 7 13 8 +:enable 0 +:enable 0 +:show breaks +:main 5 21 7 13 8 +:disable 0 +:continue +:enable * +:show breaks +:disable * +:show breaks +:enable 0 1 +:show breaks diff --git a/testsuite/tests/ghci.debugger/scripts/T2215.stdout b/testsuite/tests/ghci.debugger/scripts/T2215.stdout new file mode 100644 index 0000000000..55beaa36ae --- /dev/null +++ b/testsuite/tests/ghci.debugger/scripts/T2215.stdout @@ -0,0 +1,34 @@ +Breakpoint 0 activated at T2215.hs:5:16-47 +Breakpoint 1 activated at T2215.hs:6:24-56 +[0] Main T2215.hs:5:16-47 enabled +[1] Main T2215.hs:6:24-56 enabled +Stopped in Main.qsort, T2215.hs:5:16-47 +_result :: [Int] = _ +a :: Int = _ +left :: [Int] = _ +right :: [Int] = _ +[0] Main T2215.hs:5:16-47 disabled +[1] Main T2215.hs:6:24-56 enabled +Stopped in Main.qsort.(...), T2215.hs:6:24-56 +_result :: ([Int], [Int]) = _ +a :: Int = _ +as :: [Int] = _ +Breakpoint 1 already in desired state +[0] Main T2215.hs:5:16-47 disabled +[1] Main T2215.hs:6:24-56 disabled +[5,7,8,13,21] +Breakpoint 0 already in desired state +[0] Main T2215.hs:5:16-47 enabled +[1] Main T2215.hs:6:24-56 disabled +Stopped in Main.qsort, T2215.hs:5:16-47 +_result :: [Int] = _ +a :: Int = _ +left :: [Int] = _ +right :: [Int] = _ +[5,7,8,13,21] +[0] Main T2215.hs:5:16-47 enabled +[1] Main T2215.hs:6:24-56 enabled +[0] Main T2215.hs:5:16-47 disabled +[1] Main T2215.hs:6:24-56 disabled +[0] Main T2215.hs:5:16-47 enabled +[1] Main T2215.hs:6:24-56 enabled diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T index 5708b631fb..bc3d025dcd 100644 --- a/testsuite/tests/ghci.debugger/scripts/all.T +++ b/testsuite/tests/ghci.debugger/scripts/all.T @@ -111,3 +111,4 @@ test('T13825-debugger', when(arch('powerpc64'), expect_broken(14455)), test('T16700', normal, ghci_script, ['T16700.script']) test('break029', extra_files(['break029.hs']), ghci_script, ['break029.script']) +test('T2215', normal, ghci_script, ['T2215.script']) |