Add disable/enable commands to ghci debugger #2215
authorRoland Senn <rsx@bluewin.ch>
Tue, 14 May 2019 07:45:36 +0000 (09:45 +0200)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Sun, 9 Jun 2019 22:44:18 +0000 (18:44 -0400)
commit10452959136fbf271ac21eb0740030c046db36e1
tree5772061b3ef4c6e9f4ee421aeae80986cfad8833
parenta22e51ea6f7a046c87d57ce30d143eef6abee9ff
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`.
docs/users_guide/8.10.1-notes.rst
docs/users_guide/ghci.rst
ghc/GHCi/UI.hs
ghc/GHCi/UI/Monad.hs
testsuite/tests/ghci.debugger/scripts/T2215.hs [new file with mode: 0644]
testsuite/tests/ghci.debugger/scripts/T2215.script [new file with mode: 0644]
testsuite/tests/ghci.debugger/scripts/T2215.stdout [new file with mode: 0644]
testsuite/tests/ghci.debugger/scripts/all.T