summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci.debugger
diff options
context:
space:
mode:
authorRoland Senn <rsx@bluewin.ch>2019-07-18 10:41:44 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-21 05:04:17 -0400
commit32be44613fed3fa7bff7190381acbdaa8ea15cfc (patch)
tree5c2c2fcadafb1d26386acba9d8ffe7d5ea7db256 /testsuite/tests/ghci.debugger
parent67ee741bd6a7017a62719c3c25a5447a0b03191e (diff)
downloadhaskell-32be44613fed3fa7bff7190381acbdaa8ea15cfc.tar.gz
Fix #8487: Debugger confuses variables
To display the free variables for a single breakpoint, GHCi pulls out the information from the fields `modBreaks_breakInfo` and `modBreaks_vars` of the `ModBreaks` data structure. For a specific breakpoint this gives 2 lists of types 'Id` (`Var`) and `OccName`. They are used to create the Id's for the free variables and must be kept in sync: If we remove an element from the Names list, then we also must remove the corresponding element from the OccNames list.
Diffstat (limited to 'testsuite/tests/ghci.debugger')
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T8487.hs11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T8487.script3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T8487.stdout4
-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/T8487.hs b/testsuite/tests/ghci.debugger/scripts/T8487.hs
new file mode 100644
index 0000000000..d77738e3c9
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T8487.hs
@@ -0,0 +1,11 @@
+import Control.Exception
+
+f = do
+ ma <- try $ evaluate a
+ x <- case ma of
+ Right str -> return a
+ Left err -> return $ show (err :: SomeException)
+ putStrLn x
+ where
+ a :: String
+ a = error "hi"
diff --git a/testsuite/tests/ghci.debugger/scripts/T8487.script b/testsuite/tests/ghci.debugger/scripts/T8487.script
new file mode 100644
index 0000000000..628088e954
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T8487.script
@@ -0,0 +1,3 @@
+:l T8487.hs
+:b 5
+f
diff --git a/testsuite/tests/ghci.debugger/scripts/T8487.stdout b/testsuite/tests/ghci.debugger/scripts/T8487.stdout
new file mode 100644
index 0000000000..ab7151a563
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T8487.stdout
@@ -0,0 +1,4 @@
+Breakpoint 0 activated at T8487.hs:(5,8)-(7,53)
+Stopped in Main.f, T8487.hs:(5,8)-(7,53)
+_result :: IO String = _
+ma :: Either SomeException String = Left _
diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T
index 8460fbb809..214222c8c3 100644
--- a/testsuite/tests/ghci.debugger/scripts/all.T
+++ b/testsuite/tests/ghci.debugger/scripts/all.T
@@ -106,6 +106,7 @@ test('T2740', normal, ghci_script, ['T2740.script'])
test('getargs', extra_files(['../getargs.hs']), ghci_script, ['getargs.script'])
test('T7386', normal, ghci_script, ['T7386.script'])
+test('T8487', normal, ghci_script, ['T8487.script'])
test('T8557', normal, ghci_script, ['T8557.script'])
test('T12458', normal, ghci_script, ['T12458.script'])
test('T13825-debugger', when(arch('powerpc64'), expect_broken(14455)),