summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorRoland Senn <rsx@bluewin.ch>2019-05-14 09:45:36 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-09 18:44:18 -0400
commit10452959136fbf271ac21eb0740030c046db36e1 (patch)
tree5772061b3ef4c6e9f4ee421aeae80986cfad8833 /docs/users_guide
parenta22e51ea6f7a046c87d57ce30d143eef6abee9ff (diff)
downloadhaskell-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 'docs/users_guide')
-rw-r--r--docs/users_guide/8.10.1-notes.rst5
-rw-r--r--docs/users_guide/ghci.rst45
2 files changed, 41 insertions, 9 deletions
diff --git a/docs/users_guide/8.10.1-notes.rst b/docs/users_guide/8.10.1-notes.rst
index af6e177b2b..fde1451250 100644
--- a/docs/users_guide/8.10.1-notes.rst
+++ b/docs/users_guide/8.10.1-notes.rst
@@ -96,7 +96,7 @@ Compiler
`copyByteArray#` calls that were not optimized before, now will
be. See :ghc-ticket:`16052`.
- GHC's runtime linker no longer uses global state. This allows programs
- that use the GHC API to safely use multiple GHC sessions in a single
+ that use the GHC API to safely use multiple GHC sessions in a single
process, as long as there are no native dependencies that rely on
global state.
@@ -112,6 +112,9 @@ GHCi
- Added a command `:instances` to show the class instances available for a type.
+- Added new debugger commands :ghci-cmd:`:disable` and :ghci-cmd:`:enable` to
+ disable and re-enable breakpoints.
+
Runtime system
~~~~~~~~~~~~~~
diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst
index 5f4b26eeb6..a5d4aa8a3d 100644
--- a/docs/users_guide/ghci.rst
+++ b/docs/users_guide/ghci.rst
@@ -1556,17 +1556,32 @@ breakpoint on a let expression, but there will always be a breakpoint on
its body, because we are usually interested in inspecting the values of
the variables bound by the let.
-Listing and deleting breakpoints
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Managing breakpoints
+^^^^^^^^^^^^^^^^^^^^
-The list of breakpoints currently enabled can be displayed using
+The list of breakpoints currently defined can be displayed using
:ghci-cmd:`:show breaks`:
.. code-block:: none
*Main> :show breaks
- [0] Main qsort.hs:1:11-12
- [1] Main qsort.hs:2:15-46
+ [0] Main qsort.hs:1:11-12 enabled
+ [1] Main qsort.hs:2:15-46 enabled
+
+To disable one or several defined breakpoint, use the :ghci-cmd:`:disable` command with
+one or several blank separated numbers
+given in the output from :ghci-cmd:`:show breaks`:.
+To disable all breakpoints at once, use ``:disable *``.
+
+.. code-block:: none
+
+ *Main> :disable 0
+ *Main> :show breaks
+ [0] Main qsort.hs:1:11-12 disabled
+ [1] Main qsort.hs:2:15-46 enabled
+
+Disabled breakpoints can be (re-)enabled with the :ghci-cmd:`:enable` command.
+The parameters of the :ghci-cmd:`:disable` and :ghci-cmd:`:enable` commands are identical.
To delete a breakpoint, use the :ghci-cmd:`:delete` command with the number
given in the output from :ghci-cmd:`:show breaks`:
@@ -1575,7 +1590,7 @@ given in the output from :ghci-cmd:`:show breaks`:
*Main> :delete 0
*Main> :show breaks
- [1] Main qsort.hs:2:15-46
+ [1] Main qsort.hs:2:15-46 disabled
To delete all breakpoints at once, use ``:delete *``.
@@ -2377,6 +2392,12 @@ commonly used commands.
see the number of each breakpoint). The ``*`` form deletes all the
breakpoints.
+.. ghci-cmd:: :disable; * | ⟨num⟩ ...
+
+ Disable one or more breakpoints by number (use :ghci-cmd:`:show breaks` to
+ see the number and state of each breakpoint). The ``*`` form disables all the
+ breakpoints.
+
.. ghci-cmd:: :doc; ⟨name⟩
(Experimental: This command will likely change significantly in GHC 8.8.)
@@ -2394,6 +2415,12 @@ commonly used commands.
variable, or a default editor on your system if :envvar:`EDITOR` is not
set. You can change the editor using :ghci-cmd:`:set editor`.
+.. ghci-cmd:: :enable; * | ⟨num⟩ ...
+
+ Enable one or more disabled breakpoints by number (use :ghci-cmd:`:show breaks` to
+ see the number and state of each breakpoint). The ``*`` form enables all the
+ disabled breakpoints.
+
.. ghci-cmd:: :etags
See :ghci-cmd:`:ctags`.
@@ -2764,8 +2791,10 @@ commonly used commands.
If a number is given before the command, then the commands are run
when the specified breakpoint (only) is hit. This can be quite
useful: for example, ``:set stop 1 :continue`` effectively disables
- breakpoint 1, by running :ghci-cmd:`:continue` whenever it is hit (although
- GHCi will still emit a message to say the breakpoint was hit). What's more,
+ breakpoint 1, by running :ghci-cmd:`:continue` whenever it is hit
+ In this case GHCi will still emit a message to say the breakpoint was hit.
+ If you don't want such a message, you can use the :ghci-cmd:`:disable`
+ command. What's more,
with cunning use of :ghci-cmd:`:def` and :ghci-cmd:`:cmd` you can use
:ghci-cmd:`:set stop` to implement conditional breakpoints: