summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci.debugger
diff options
context:
space:
mode:
authorRoland Senn <rsx@bluewin.ch>2019-10-03 16:37:52 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-26 05:20:14 -0400
commit1be9c35c940e9a1edbb44a0e7dd51b48529ffb9b (patch)
treeb8599dbfc9e5fb57193cd3d46a10908d7543d18d /testsuite/tests/ghci.debugger
parent8916e64e5437c99b82d5610286430328af1d86bc (diff)
downloadhaskell-1be9c35c940e9a1edbb44a0e7dd51b48529ffb9b.tar.gz
Fix #14690 - :steplocal panics after break-on-error
`:steplocal` enables only breakpoints in the current top-level binding. When a normal breakpoint is hit, then the module name and the break id from the `BRK_FUN` byte code allow us to access the corresponding entry in a ModBreak table. From this entry we then get the SrcSpan (see compiler/main/InteractiveEval.hs:bindLocalsAtBreakpoint). With this source-span we can then determine the current top-level binding, needed for the steplocal command. However, if we break at an exception or at an error, we don't have an BRK_FUN byte-code, so we don't have any source information. The function `bindLocalsAtBreakpoint` creates an `UnhelpfulSpan`, which doesn't allow us to determine the current top-level binding. To avoid a `panic`, we have to check for `UnhelpfulSpan` in the function `ghc/GHCi/UI.hs:stepLocalCmd`. Hence a :steplocal command after a break-on-exception or a break-on-error is not possible.
Diffstat (limited to 'testsuite/tests/ghci.debugger')
-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
4 files changed, 19 insertions, 0 deletions
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'])