summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/users_guide/ghci.rst5
-rw-r--r--ghc/GHCi/UI.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T14690.hs2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T14690.script6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T14690.stdout10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/all.T1
6 files changed, 27 insertions, 1 deletions
diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst
index 72e2d66e12..d1229ed0d5 100644
--- a/docs/users_guide/ghci.rst
+++ b/docs/users_guide/ghci.rst
@@ -2884,7 +2884,10 @@ commonly used commands.
.. ghci-cmd:: :steplocal
Enable only breakpoints in the current top-level binding and resume
- evaluation at the last breakpoint.
+ evaluation at the last breakpoint. Continuation with
+ :ghci-cmd:`:steplocal` is not possible if this last breakpoint was
+ hit by an error (:ghc-flag:`-fbreak-on-error`) or an
+ exception (:ghc-flag:`-fbreak-on-exception`).
.. ghci-cmd:: :stepmodule
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index e2f51be65f..34bb627238 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -3460,6 +3460,10 @@ stepLocalCmd arg = withSandboxOnly ":steplocal" $ step arg
mb_span <- getCurrentBreakSpan
case mb_span of
Nothing -> stepCmd []
+ Just (UnhelpfulSpan _) -> liftIO $ putStrLn ( -- #14690
+ ":steplocal is not possible." ++
+ "\nCannot determine current top-level binding after " ++
+ "a break on error / exception.\nUse :stepmodule.")
Just loc -> do
md <- fromMaybe (panic "stepLocalCmd") <$> getCurrentBreakModule
current_toplevel_decl <- enclosingTickSpan md loc
diff --git a/testsuite/tests/ghci.debugger/scripts/T14690.hs b/testsuite/tests/ghci.debugger/scripts/T14690.hs
new file mode 100644
index 0000000000..9d59d355cb
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T14690.hs
@@ -0,0 +1,2 @@
+foo :: Int
+foo = error "T14690"
diff --git a/testsuite/tests/ghci.debugger/scripts/T14690.script b/testsuite/tests/ghci.debugger/scripts/T14690.script
new file mode 100644
index 0000000000..f3a503e511
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T14690.script
@@ -0,0 +1,6 @@
+:set -fbreak-on-error
+error "abc"
+:steplocal
+:l T14690.hs
+foo
+:steplocal
diff --git a/testsuite/tests/ghci.debugger/scripts/T14690.stdout b/testsuite/tests/ghci.debugger/scripts/T14690.stdout
new file mode 100644
index 0000000000..26524b7036
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T14690.stdout
@@ -0,0 +1,10 @@
+Stopped in <exception thrown>, <unknown>
+_exception :: e = _
+:steplocal is not possible.
+Cannot determine current top-level binding after a break on error / exception.
+Use :stepmodule.
+Stopped in <exception thrown>, <unknown>
+_exception :: e = _
+:steplocal is not possible.
+Cannot determine current top-level binding after a break on error / exception.
+Use :stepmodule.
diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T
index b6db055127..3814d88cc2 100644
--- a/testsuite/tests/ghci.debugger/scripts/all.T
+++ b/testsuite/tests/ghci.debugger/scripts/all.T
@@ -111,6 +111,7 @@ test('T8557', normal, ghci_script, ['T8557.script'])
test('T12458', normal, ghci_script, ['T12458.script'])
test('T13825-debugger', when(arch('powerpc64'), expect_broken(14455)),
ghci_script, ['T13825-debugger.script'])
+test('T14690', normal, ghci_script, ['T14690.script'])
test('T16700', normal, ghci_script, ['T16700.script'])
test('break029', extra_files(['break029.hs']), ghci_script, ['break029.script'])