summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci.debugger
diff options
context:
space:
mode:
authorRoland Senn <rsx@bluewin.ch>2019-05-15 20:55:16 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-19 22:15:04 -0400
commit39c758e1426c9e5b00de2207ad53bb4377c1e6a6 (patch)
tree90dc87fe483ba729632a824efccd1d5fae33c363 /testsuite/tests/ghci.debugger
parent9d58554f7b19c52896796e8c3b6de20c154a67b2 (diff)
downloadhaskell-39c758e1426c9e5b00de2207ad53bb4377c1e6a6.tar.gz
Fix #1620: ModBreaks.modBreaks_array not initialised
After a :cd command and after setting some package flags, GHCi unloads all loaded modules by resetting the list of targets. This patch deletes eventually defined debugger breakpoints, before GHCi resets the target list. The common code is factored out into the new function clearAllTargets.
Diffstat (limited to 'testsuite/tests/ghci.debugger')
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T1620.script18
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T1620.stdout9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/T1620/T1620.hs5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/all.T2
4 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/T1620.script b/testsuite/tests/ghci.debugger/scripts/T1620.script
new file mode 100644
index 0000000000..17d38d5530
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T1620.script
@@ -0,0 +1,18 @@
+-- Test 1: No hanging breakpoints after :cd
+:cd T1620
+:l T1620.hs
+:break 2
+:cd ..
+:break 2
+:show breaks
+:cd T1620
+:l T1620.hs
+:main
+:l T1620.hs
+-- Test 2: Non hanging breakpoints after :set <some-package-flag>
+:break 2
+:set -no-user-package-db
+:show breaks
+:l T1620.hs
+:main
+:l T1620.hs
diff --git a/testsuite/tests/ghci.debugger/scripts/T1620.stdout b/testsuite/tests/ghci.debugger/scripts/T1620.stdout
new file mode 100644
index 0000000000..fc453c2b60
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T1620.stdout
@@ -0,0 +1,9 @@
+Breakpoint 0 activated at T1620.hs:2:16-47
+Warning: changing directory causes all loaded modules to be unloaded,
+because the search path has changed.
+No modules are loaded with debugging support.
+No active breakpoints.
+[1,3,4,7,10]
+Breakpoint 1 activated at T1620.hs:2:16-47
+No active breakpoints.
+[1,3,4,7,10]
diff --git a/testsuite/tests/ghci.debugger/scripts/T1620/T1620.hs b/testsuite/tests/ghci.debugger/scripts/T1620/T1620.hs
new file mode 100644
index 0000000000..7c97826676
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/T1620/T1620.hs
@@ -0,0 +1,5 @@
+qsort [] = []
+qsort (a:as) = qsort left ++ [a] ++ qsort right
+ where (left,right) = (filter (<=a) as, filter (>a) as)
+
+main = print $ qsort [4, 1, 7, 10, 3]
diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T
index bc3d025dcd..8460fbb809 100644
--- a/testsuite/tests/ghci.debugger/scripts/all.T
+++ b/testsuite/tests/ghci.debugger/scripts/all.T
@@ -100,6 +100,8 @@ test('hist001', [extra_files(['../Test3.hs']), extra_run_opts('+RTS -I0')],
test('hist002', [extra_files(['../Test3.hs']), extra_run_opts('+RTS -I0')],
ghci_script, ['hist002.script'])
+test('T1620', extra_files(['T1620/', 'T1620/T1620.hs']),
+ ghci_script, ['T1620.script'])
test('T2740', normal, ghci_script, ['T2740.script'])
test('getargs', extra_files(['../getargs.hs']), ghci_script, ['getargs.script'])