summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci.debugger/scripts
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/ghci.debugger/scripts
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/ghci.debugger/scripts')
-rw-r--r--testsuite/tests/ghci.debugger/scripts/2740.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/2740.script7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/2740.stdout10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/Break007.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/Break020b.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/Makefile3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/TupleN.hs10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/all.T84
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break001.script14
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break001.stderr7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break001.stdout18
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break002.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break002.stdout2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break003.script10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break003.stderr6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break003.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break004.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break005.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break005.stdout9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break006.script14
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break006.stderr14
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break006.stdout20
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break007.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break007.stdout1
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break008.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break008.stdout3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break009.script7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break009.stdout4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break010.script6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break010.stdout5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break011.script18
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break011.stdout23
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break012.hs5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break012.script9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break012.stdout16
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break013.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break013.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break013.stdout11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break014.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break014.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break014.stdout5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break015.hs3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break015.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break016.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break016.script11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break016.stdout3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break017.script11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break017.stdout12
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break018.script9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break018.stderr3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break018.stdout13
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break019.script3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break019.stderr2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break020.hs15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break020.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break020.stdout42
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break021.script23
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break021.stdout135
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/A.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/B.hs5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/B.hs-boot3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/C.hs5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/Makefile3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/all.T4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/break022.script20
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break022/break022.stdout8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/A.hs2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/B.hs5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/B.hs-boot3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/C.hs5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/Makefile3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/all.T4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/break023.script17
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break023/break023.stdout2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break024.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break024.script16
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break024.stdout19
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break024.stdout-ghc-7.028
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break025.script4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break025.stdout3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break026.hs7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break026.script23
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break026.stdout58
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break027.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break027.stdout9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break028.hs15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break028.script4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break028.stdout5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk001.script22
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk001.stderr4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk001.stdout5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk002.script7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk002.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk003.script2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk003.stdout1
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk004.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk004.stderr3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk004.stdout4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk005.hs5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk005.script13
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk005.stdout11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk007.hs6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk007.script7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk007.stdout11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk008.hs4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk008.script9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk008.stdout15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk009.hs8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk009.script10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/dynbrk009.stdout11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/getargs.script4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/getargs.stdout3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/hist001.script15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/hist001.stdout31
-rw-r--r--testsuite/tests/ghci.debugger/scripts/listCommand001.script13
-rw-r--r--testsuite/tests/ghci.debugger/scripts/listCommand001.stdout15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/listCommand002.hs5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/listCommand002.script4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/listCommand002.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print001.script12
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print001.stdout10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print002.script19
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print002.stdout8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print003.script15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print003.stdout15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print004.script28
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print004.stdout19
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print005.script15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print005.stdout19
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print006.script19
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print006.stdout14
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print007.script30
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print007.stderr3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print007.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print008.script14
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print008.stdout7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print009.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print009.stdout3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print010.script12
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print010.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print011.script13
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print011.stdout7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print012.script11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print012.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print013.script10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print013.stdout3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print014.script9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print014.stdout3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print015.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print015.stdout5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print016.script10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print016.stdout5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print017.script12
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print017.stdout7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print018.script15
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print018.stderr0
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print018.stdout12
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print019.script11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print019.stderr7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print019.stdout9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print020.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print020.stdout14
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print021.hs18
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print021.script3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print021.stdout2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print022.hs11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print022.script9
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print022.stdout10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print023.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print023.stdout2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print024.script10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print024.stdout3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print025.hs2
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print025.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print025.stdout8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print026.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print026.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print027.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print027.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print028.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print028.stdout6
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print029.hs7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print029.script10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print029.stdout8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print030.script10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print030.stdout7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print031.hs7
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print031.script10
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print031.stdout8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print032.script8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print032.stdout8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print033.script5
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print033.stdout1
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print034.script11
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print034.stdout4
-rw-r--r--testsuite/tests/ghci.debugger/scripts/result001.hs3
-rw-r--r--testsuite/tests/ghci.debugger/scripts/result001.script5
197 files changed, 1980 insertions, 0 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/2740.hs b/testsuite/tests/ghci.debugger/scripts/2740.hs
new file mode 100644
index 0000000000..291e7c8c02
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/2740.hs
@@ -0,0 +1,4 @@
+module Test where
+
+f x y z | x<y = z
+ | otherwise = z*y
diff --git a/testsuite/tests/ghci.debugger/scripts/2740.script b/testsuite/tests/ghci.debugger/scripts/2740.script
new file mode 100644
index 0000000000..8cf8c3909b
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/2740.script
@@ -0,0 +1,7 @@
+:l 2740.hs
+:step f 1 2 3
+:step
+:print x
+:print y
+:force x
+:force y
diff --git a/testsuite/tests/ghci.debugger/scripts/2740.stdout b/testsuite/tests/ghci.debugger/scripts/2740.stdout
new file mode 100644
index 0000000000..c7fefaaeb2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/2740.stdout
@@ -0,0 +1,10 @@
+Stopped at 2740.hs:(3,1)-(4,25)
+_result :: a = _
+Stopped at 2740.hs:3:11-13
+_result :: a = _
+x :: a = _
+y :: a = _
+x = (_t1::a)
+y = (_t2::a)
+x = 1
+y = 2
diff --git a/testsuite/tests/ghci.debugger/scripts/Break007.hs b/testsuite/tests/ghci.debugger/scripts/Break007.hs
new file mode 100644
index 0000000000..fc66e943da
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/Break007.hs
@@ -0,0 +1,4 @@
+mymap f [] = []
+mymap f (x:xs) = f x:mymap f xs
+
+main = mapM_ putStrLn $ mymap ('a':) ["hello","bye"]
diff --git a/testsuite/tests/ghci.debugger/scripts/Break020b.hs b/testsuite/tests/ghci.debugger/scripts/Break020b.hs
new file mode 100644
index 0000000000..ca4737ff26
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/Break020b.hs
@@ -0,0 +1,4 @@
+module Break020b where
+
+
+in_another_module _ = return () \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/Makefile b/testsuite/tests/ghci.debugger/scripts/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/ghci.debugger/scripts/TupleN.hs b/testsuite/tests/ghci.debugger/scripts/TupleN.hs
new file mode 100644
index 0000000000..528f0ea238
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/TupleN.hs
@@ -0,0 +1,10 @@
+module TupleN where
+import Language.Haskell.TH
+
+tuple :: Int -> ExpQ
+tuple n = [|\list -> $(tupE (exprs [|list|])) |]
+ where
+ exprs list = id [infixE (Just (list))
+ (varE '(!!))
+ (Just (litE $ integerL (toInteger num)))
+ | num <- [0..(n - 1)]] \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T
new file mode 100644
index 0000000000..8c8cb7c64f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/all.T
@@ -0,0 +1,84 @@
+setTestOpts(composes([extra_run_opts('-ignore-dot-ghci'),
+ if_compiler_profiled(skip),
+ normalise_slashes]))
+
+test('print001', normal, ghci_script, ['print001.script'])
+test('print002', normal, ghci_script, ['print002.script'])
+test('print003', normal, ghci_script, ['print003.script'])
+test('print004', normal, ghci_script, ['print004.script'])
+test('print005', normal, ghci_script, ['print005.script'])
+test('print006', normal, ghci_script, ['print006.script'])
+test('print007', normal, ghci_script, ['print007.script'])
+test('print008', normal, ghci_script, ['print008.script'])
+test('print009', normal, ghci_script, ['print009.script'])
+test('print010', normal, ghci_script, ['print010.script'])
+test('print011', normal, ghci_script, ['print011.script'])
+test('print012', normal, ghci_script, ['print012.script'])
+test('print013', normal, ghci_script, ['print013.script'])
+test('print014', normal, ghci_script, ['print014.script'])
+test('print016', normal, ghci_script, ['print016.script'])
+test('print017', normal, ghci_script, ['print017.script'])
+test('print018', normal, ghci_script, ['print018.script'])
+test('print019', normal, ghci_script, ['print019.script'])
+test('print020', expect_broken(2806), ghci_script, ['print020.script'])
+test('print021', normal, ghci_script, ['print021.script'])
+test('print022', normal, ghci_script, ['print022.script'])
+test('print023', normal, ghci_script, ['print023.script'])
+test('print024', normal, ghci_script, ['print024.script'])
+test('print025', normal, ghci_script, ['print025.script'])
+test('print026', normal, ghci_script, ['print026.script'])
+test('print027', normal, ghci_script, ['print027.script'])
+test('print028', normal, ghci_script, ['print028.script'])
+test('print029', normal, ghci_script, ['print029.script'])
+test('print030', normal, ghci_script, ['print030.script'])
+test('print031', normal, ghci_script, ['print031.script'])
+test('print032', expect_broken(1995), ghci_script, ['print032.script'])
+test('print033', normal, ghci_script, ['print033.script'])
+test('print034', normal, ghci_script, ['print034.script'])
+
+test('break001', normal, ghci_script, ['break001.script'])
+test('break002', normal, ghci_script, ['break002.script'])
+test('break003', normal, ghci_script, ['break003.script'])
+test('break005', normal, ghci_script, ['break005.script'])
+test('break006', normal, ghci_script, ['break006.script'])
+test('break007', extra_clean(['Break007.o', 'Break007.hi']),
+ ghci_script, ['break007.script'])
+test('break008', normal, ghci_script, ['break008.script'])
+test('break009', normal, ghci_script, ['break009.script'])
+test('break010', normal, ghci_script, ['break010.script'])
+test('break011', normal, ghci_script, ['break011.script'])
+test('break012', normal, ghci_script, ['break012.script'])
+test('break013', normal, ghci_script, ['break013.script'])
+test('break014', normal, ghci_script, ['break014.script'])
+test('break015', expect_broken(1532), ghci_script, ['break015.script'])
+test('break016', normal, ghci_script, ['break016.script'])
+test('break017', normal, ghci_script, ['break017.script'])
+test('break018', normal, ghci_script, ['break018.script'])
+test('break019', normal, ghci_script, ['break019.script'])
+test('break020', normal, ghci_script, ['break020.script'])
+test('break021', normal, ghci_script, ['break021.script'])
+test('break024', normal, ghci_script, ['break024.script'])
+test('break025', normal, ghci_script, ['break025.script'])
+test('break026', normal, ghci_script, ['break026.script'])
+test('break027', normal, ghci_script, ['break027.script'])
+test('break028', normal, ghci_script, ['break028.script'])
+
+test('dynbrk001', normal, ghci_script, ['dynbrk001.script'])
+test('dynbrk002', normal, ghci_script, ['dynbrk002.script'])
+test('dynbrk003', normal, ghci_script, ['dynbrk003.script'])
+test('dynbrk004', normal, ghci_script, ['dynbrk004.script'])
+test('dynbrk005', expect_broken(1530), ghci_script, ['dynbrk005.script'])
+test('dynbrk007', normal, ghci_script, ['dynbrk007.script'])
+test('dynbrk008', normal, ghci_script, ['dynbrk008.script'])
+test('dynbrk009', normal, ghci_script, ['dynbrk009.script'])
+
+test('result001', expect_broken(1531), ghci_script, ['result001.script'])
+
+test('listCommand001', normal, ghci_script, ['listCommand001.script'])
+test('listCommand002', normal, ghci_script, ['listCommand002.script'])
+
+test('hist001', normal, ghci_script, ['hist001.script'])
+
+test('2740', normal, ghci_script, ['2740.script'])
+
+test('getargs', normal, ghci_script, ['getargs.script'])
diff --git a/testsuite/tests/ghci.debugger/scripts/break001.script b/testsuite/tests/ghci.debugger/scripts/break001.script
new file mode 100644
index 0000000000..63b5e71a5f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break001.script
@@ -0,0 +1,14 @@
+:l ../Test2
+:b 3
+:b 5
+f 1
+:st
+:st
+:st
+-- Test that the binding for x is now gone
+:show bindings
+y
+:p y
+seq y ()
+:p y
+y
diff --git a/testsuite/tests/ghci.debugger/scripts/break001.stderr b/testsuite/tests/ghci.debugger/scripts/break001.stderr
new file mode 100644
index 0000000000..cb0cc93ac7
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break001.stderr
@@ -0,0 +1,7 @@
+
+<interactive>:1:1:
+ Ambiguous type variable `t' in the constraint:
+ (Show t) arising from a use of `print'
+ Cannot resolve unknown runtime types: t
+ Use :print or :force to determine these types
+ In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci.debugger/scripts/break001.stdout b/testsuite/tests/ghci.debugger/scripts/break001.stdout
new file mode 100644
index 0000000000..e88c2fcc5c
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break001.stdout
@@ -0,0 +1,18 @@
+Breakpoint 0 activated at ../Test2.hs:3:1-9
+Breakpoint 1 activated at ../Test2.hs:5:1-7
+Stopped at ../Test2.hs:3:1-9
+_result :: t = _
+Stopped at ../Test2.hs:3:7-9
+_result :: t = _
+x :: t = _
+Stopped at ../Test2.hs:5:1-7
+_result :: t = _
+Stopped at ../Test2.hs:5:7
+_result :: t = _
+y :: t = _
+_result :: t = _
+y :: t = _
+y = (_t1::t)
+()
+y = 1
+1
diff --git a/testsuite/tests/ghci.debugger/scripts/break002.script b/testsuite/tests/ghci.debugger/scripts/break002.script
new file mode 100644
index 0000000000..0bc2605e4f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break002.script
@@ -0,0 +1,5 @@
+-- can't set breakpoints on non-interpreted things:
+:b Data.List.map
+
+:l ../Test2.hs
+:b Data.List.map
diff --git a/testsuite/tests/ghci.debugger/scripts/break002.stdout b/testsuite/tests/ghci.debugger/scripts/break002.stdout
new file mode 100644
index 0000000000..72e0359c7b
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break002.stdout
@@ -0,0 +1,2 @@
+cannot set breakpoint on map: module GHC.Base is not interpreted
+cannot set breakpoint on map: module GHC.Base is not interpreted
diff --git a/testsuite/tests/ghci.debugger/scripts/break003.script b/testsuite/tests/ghci.debugger/scripts/break003.script
new file mode 100644
index 0000000000..68ca96fcd2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break003.script
@@ -0,0 +1,10 @@
+:l ../Test3
+:b 2
+main
+f
+:q
+
+-- currently gives:
+-- ghc-6.7: panic! (the 'impossible' happened)
+-- (GHC version 6.7 for x86_64-unknown-linux):
+-- ASSERT failed! file typecheck/TcMType.lhs line 362 t{tv aqh} [tv]
diff --git a/testsuite/tests/ghci.debugger/scripts/break003.stderr b/testsuite/tests/ghci.debugger/scripts/break003.stderr
new file mode 100644
index 0000000000..f640cb0fab
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break003.stderr
@@ -0,0 +1,6 @@
+
+<interactive>:1:1:
+ No instance for (Show (t -> a))
+ arising from a use of `print'
+ Possible fix: add an instance declaration for (Show (t -> a))
+ In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci.debugger/scripts/break003.stdout b/testsuite/tests/ghci.debugger/scripts/break003.stdout
new file mode 100644
index 0000000000..ed418836c8
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break003.stdout
@@ -0,0 +1,6 @@
+Breakpoint 0 activated at ../Test3.hs:2:18-31
+Stopped at ../Test3.hs:2:18-31
+_result :: [a] = _
+f :: t -> a = _
+x :: t = _
+xs :: [t] = [_]
diff --git a/testsuite/tests/ghci.debugger/scripts/break004.script b/testsuite/tests/ghci.debugger/scripts/break004.script
new file mode 100644
index 0000000000..e4bb16fd1a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break004.script
@@ -0,0 +1,5 @@
+:l ../Test4.hs
+:b f
+seq (f (+(1::Int)) "abc") ()
+-- We can subvert the Unknown machinery this was and pass the string
+-- to the function expecting Int. ToDo: finish this
diff --git a/testsuite/tests/ghci.debugger/scripts/break005.script b/testsuite/tests/ghci.debugger/scripts/break005.script
new file mode 100644
index 0000000000..b36ebbca2a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break005.script
@@ -0,0 +1,5 @@
+:l ../QSort
+:st qsort [1,2]
+:step
+seq left ()
+:print left
diff --git a/testsuite/tests/ghci.debugger/scripts/break005.stdout b/testsuite/tests/ghci.debugger/scripts/break005.stdout
new file mode 100644
index 0000000000..adf9502b0a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break005.stdout
@@ -0,0 +1,9 @@
+Stopped at ../QSort.hs:(4,1)-(6,55)
+_result :: [a] = _
+Stopped at ../QSort.hs:5:16-51
+_result :: [a] = _
+a :: a = _
+left :: [a] = _
+right :: [a] = _
+()
+left = []
diff --git a/testsuite/tests/ghci.debugger/scripts/break006.script b/testsuite/tests/ghci.debugger/scripts/break006.script
new file mode 100644
index 0000000000..7381490f69
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break006.script
@@ -0,0 +1,14 @@
+:l ../Test3.hs
+:st mymap (+1) [1,2,3]
+:st
+:show bindings
+f x -- should fail, unknown return type
+let y = f x
+y
+:p y
+:force y
+:show bindings
+-- we know the result is Integer now
+f x
+-- should work now
+
diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr
new file mode 100644
index 0000000000..31c3f94f1b
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr
@@ -0,0 +1,14 @@
+
+<interactive>:1:1:
+ Ambiguous type variable `a' in the constraint:
+ (Show a) arising from a use of `print'
+ Cannot resolve unknown runtime types: a
+ Use :print or :force to determine these types
+ In a stmt of an interactive GHCi command: print it
+
+<interactive>:1:1:
+ Ambiguous type variable `a' in the constraint:
+ (Show a) arising from a use of `print'
+ Cannot resolve unknown runtime types: a
+ Use :print or :force to determine these types
+ In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stdout b/testsuite/tests/ghci.debugger/scripts/break006.stdout
new file mode 100644
index 0000000000..42560877d1
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break006.stdout
@@ -0,0 +1,20 @@
+Stopped at ../Test3.hs:(1,1)-(2,31)
+_result :: [a] = _
+Stopped at ../Test3.hs:2:18-31
+_result :: [a] = _
+f :: t -> a = _
+x :: t = _
+xs :: [t] = [_,_]
+_result :: [a] = _
+f :: t -> a = _
+x :: t = _
+xs :: [t] = [_,_]
+y = (_t1::a)
+y = 2
+_result :: [Integer] = _
+_t1 :: Integer = 2
+f :: t -> Integer = _
+x :: t = 1
+xs :: [t] = [_,_]
+y :: Integer = 2
+2
diff --git a/testsuite/tests/ghci.debugger/scripts/break007.script b/testsuite/tests/ghci.debugger/scripts/break007.script
new file mode 100644
index 0000000000..46386ca182
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break007.script
@@ -0,0 +1,5 @@
+:!rm -f Break007.o Break007.hi
+:set -fobject-code
+:l Break007
+:b 1
+-- can't set a breakpoint in a compiled module
diff --git a/testsuite/tests/ghci.debugger/scripts/break007.stdout b/testsuite/tests/ghci.debugger/scripts/break007.stdout
new file mode 100644
index 0000000000..e692d2048f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break007.stdout
@@ -0,0 +1 @@
+No breakpoints found at that location.
diff --git a/testsuite/tests/ghci.debugger/scripts/break008.script b/testsuite/tests/ghci.debugger/scripts/break008.script
new file mode 100644
index 0000000000..0cdf7566e6
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break008.script
@@ -0,0 +1,5 @@
+:l ../Test3
+:b 1
+mymap id []
+-- second load, should discard the breakpoints without blowing up
+:l ../Test3.hs
diff --git a/testsuite/tests/ghci.debugger/scripts/break008.stdout b/testsuite/tests/ghci.debugger/scripts/break008.stdout
new file mode 100644
index 0000000000..6961fa3cec
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break008.stdout
@@ -0,0 +1,3 @@
+Breakpoint 0 activated at ../Test3.hs:1:14-15
+Stopped at ../Test3.hs:1:14-15
+_result :: [a] = _
diff --git a/testsuite/tests/ghci.debugger/scripts/break009.script b/testsuite/tests/ghci.debugger/scripts/break009.script
new file mode 100644
index 0000000000..3e43b07a70
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break009.script
@@ -0,0 +1,7 @@
+:l ../Test6.hs
+:b 5
+main
+-- stopped now
+:l ../Test6.hs
+main
+-- should not break
diff --git a/testsuite/tests/ghci.debugger/scripts/break009.stdout b/testsuite/tests/ghci.debugger/scripts/break009.stdout
new file mode 100644
index 0000000000..cd9436e34a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break009.stdout
@@ -0,0 +1,4 @@
+Breakpoint 0 activated at ../Test6.hs:5:8-11
+Stopped at ../Test6.hs:5:8-11
+_result :: a = _
+*** Exception: Prelude.head: empty list
diff --git a/testsuite/tests/ghci.debugger/scripts/break010.script b/testsuite/tests/ghci.debugger/scripts/break010.script
new file mode 100644
index 0000000000..c4cfe917f2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break010.script
@@ -0,0 +1,6 @@
+:l ../Test6.hs
+:b 5
+main
+:abandon
+main
+-- should not hang here; we abandoned the previous computation
diff --git a/testsuite/tests/ghci.debugger/scripts/break010.stdout b/testsuite/tests/ghci.debugger/scripts/break010.stdout
new file mode 100644
index 0000000000..2751b6d160
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break010.stdout
@@ -0,0 +1,5 @@
+Breakpoint 0 activated at ../Test6.hs:5:8-11
+Stopped at ../Test6.hs:5:8-11
+_result :: a = _
+Stopped at ../Test6.hs:5:8-11
+_result :: a = _
diff --git a/testsuite/tests/ghci.debugger/scripts/break011.script b/testsuite/tests/ghci.debugger/scripts/break011.script
new file mode 100644
index 0000000000..f9ca3fe393
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break011.script
@@ -0,0 +1,18 @@
+-- Testing -fbreak-on-exception
+error "foo"
+:set -fbreak-on-exception
+error "foo"
+:abandon
+:l ../Test7.hs
+:tr main
+:hist
+:back
+:back
+:back
+:forward
+:forward
+:forward
+:force _exception
+:show bindings
+:force _result
+:continue
diff --git a/testsuite/tests/ghci.debugger/scripts/break011.stdout b/testsuite/tests/ghci.debugger/scripts/break011.stdout
new file mode 100644
index 0000000000..7ca63b686a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break011.stdout
@@ -0,0 +1,23 @@
+*** Exception: foo
+Stopped at <exception thrown>
+_exception :: e = _
+Stopped at <exception thrown>
+_exception :: e = _
+-1 : main (../Test7.hs:2:18-28)
+-2 : main (../Test7.hs:2:8-29)
+<end of history>
+Logged breakpoint at ../Test7.hs:2:18-28
+_result :: a
+Logged breakpoint at ../Test7.hs:2:8-29
+_result :: IO a
+no more logged breakpoints
+Logged breakpoint at ../Test7.hs:2:18-28
+_result :: a
+Stopped at <exception thrown>
+_exception :: e
+already at the beginning of the history
+_exception = SomeException (ErrorCall "foo")
+_exception :: SomeException = SomeException (ErrorCall "foo")
+_result :: a = _
+*** Exception: foo
+*** Exception: foo
diff --git a/testsuite/tests/ghci.debugger/scripts/break012.hs b/testsuite/tests/ghci.debugger/scripts/break012.hs
new file mode 100644
index 0000000000..7b2e2ea0fb
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break012.hs
@@ -0,0 +1,5 @@
+g i = let a = i + 1
+ b = id
+ c = ()
+ d = (+)
+ in (a,b,c,d)
diff --git a/testsuite/tests/ghci.debugger/scripts/break012.script b/testsuite/tests/ghci.debugger/scripts/break012.script
new file mode 100644
index 0000000000..749947a4a9
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break012.script
@@ -0,0 +1,9 @@
+-- Test polymorphic types in a breakpoint
+:l break012
+:st g 5 `seq` ()
+:st
+:t a
+:t b
+:t c
+:t d
+:p a b c d
diff --git a/testsuite/tests/ghci.debugger/scripts/break012.stdout b/testsuite/tests/ghci.debugger/scripts/break012.stdout
new file mode 100644
index 0000000000..90e228c293
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break012.stdout
@@ -0,0 +1,16 @@
+Stopped at break012.hs:(1,1)-(5,18)
+_result :: (t, a1 -> a1, (), a -> a -> a) = _
+Stopped at break012.hs:5:10-18
+_result :: (t, a1 -> a1, (), a -> a -> a) = _
+a :: t = _
+b :: a2 -> a2 = _
+c :: () = _
+d :: a -> a -> a = _
+a :: t
+b :: a2 -> a2
+c :: ()
+d :: a -> a -> a
+a = (_t1::t)
+b = (_t2::forall a2. a2 -> a2)
+c = (_t3::())
+d = (_t4::a -> a -> a)
diff --git a/testsuite/tests/ghci.debugger/scripts/break013.hs b/testsuite/tests/ghci.debugger/scripts/break013.hs
new file mode 100644
index 0000000000..53d8432865
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break013.hs
@@ -0,0 +1,4 @@
+g i = (a,b,c)
+ where a = False
+ b = True
+ c = ()
diff --git a/testsuite/tests/ghci.debugger/scripts/break013.script b/testsuite/tests/ghci.debugger/scripts/break013.script
new file mode 100644
index 0000000000..b14e4c135f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break013.script
@@ -0,0 +1,5 @@
+-- Available bindings at where(s)
+:l break013
+:st g 1 `seq` ()
+:st
+:show bindings
diff --git a/testsuite/tests/ghci.debugger/scripts/break013.stdout b/testsuite/tests/ghci.debugger/scripts/break013.stdout
new file mode 100644
index 0000000000..9daa2db266
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break013.stdout
@@ -0,0 +1,11 @@
+Stopped at break013.hs:(1,1)-(4,18)
+_result :: (Bool, Bool, ()) = _
+Stopped at break013.hs:1:7-13
+_result :: (Bool, Bool, ()) = _
+a :: Bool = _
+b :: Bool = _
+c :: () = _
+_result :: (Bool, Bool, ()) = _
+a :: Bool = _
+b :: Bool = _
+c :: () = _
diff --git a/testsuite/tests/ghci.debugger/scripts/break014.hs b/testsuite/tests/ghci.debugger/scripts/break014.hs
new file mode 100644
index 0000000000..7dff7b6fc5
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break014.hs
@@ -0,0 +1,4 @@
+g i = let a = False
+ b = True
+ c = (a,b)
+ in c
diff --git a/testsuite/tests/ghci.debugger/scripts/break014.script b/testsuite/tests/ghci.debugger/scripts/break014.script
new file mode 100644
index 0000000000..f0ad6da277
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break014.script
@@ -0,0 +1,5 @@
+-- Available bindings at let(s)
+:l break014
+:break 3
+g 1
+-- stops at the breakpoint on c, a and b should be in scope
diff --git a/testsuite/tests/ghci.debugger/scripts/break014.stdout b/testsuite/tests/ghci.debugger/scripts/break014.stdout
new file mode 100644
index 0000000000..3d284bf11f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break014.stdout
@@ -0,0 +1,5 @@
+Breakpoint 0 activated at break014.hs:3:15-19
+Stopped at break014.hs:3:15-19
+_result :: (Bool, Bool) = _
+a :: Bool = _
+b :: Bool = _
diff --git a/testsuite/tests/ghci.debugger/scripts/break015.hs b/testsuite/tests/ghci.debugger/scripts/break015.hs
new file mode 100644
index 0000000000..d897118268
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break015.hs
@@ -0,0 +1,3 @@
+f i = if ?flag then i*2 else i
+
+g i = let ?flag=False in f i
diff --git a/testsuite/tests/ghci.debugger/scripts/break015.script b/testsuite/tests/ghci.debugger/scripts/break015.script
new file mode 100644
index 0000000000..bbeba92f2c
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break015.script
@@ -0,0 +1,8 @@
+-- implicit params availability in breakpoints
+
+:set -XImplicitParams
+:l break015.hs
+:b f
+g 5
+:st
+_flag
diff --git a/testsuite/tests/ghci.debugger/scripts/break016.hs b/testsuite/tests/ghci.debugger/scripts/break016.hs
new file mode 100644
index 0000000000..1e31c807e9
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break016.hs
@@ -0,0 +1,4 @@
+f i = i :: Int
+
+g :: Int -> ()
+g i = ()
diff --git a/testsuite/tests/ghci.debugger/scripts/break016.script b/testsuite/tests/ghci.debugger/scripts/break016.script
new file mode 100644
index 0000000000..2124e045bd
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break016.script
@@ -0,0 +1,11 @@
+-- conditional breakpoints
+:l break016.hs
+:break 1 7
+-- this is one way to do conditional breakpoints. It's a bit
+-- horrible: the :undef will complain the first time it is used.
+:def cond (\expr -> return (":undef __cond\n:def __cond (\\_ -> if "++expr++" then return \"\" else return \":cont\")\n:__cond"))
+:set stop 0 :cond (i < 3)
+-- this one continues:
+f 4
+-- this one stops:
+f 1
diff --git a/testsuite/tests/ghci.debugger/scripts/break016.stdout b/testsuite/tests/ghci.debugger/scripts/break016.stdout
new file mode 100644
index 0000000000..92128d177d
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break016.stdout
@@ -0,0 +1,3 @@
+Breakpoint 0 activated at break016.hs:1:7-14
+macro '__cond' is not defined
+4
diff --git a/testsuite/tests/ghci.debugger/scripts/break017.script b/testsuite/tests/ghci.debugger/scripts/break017.script
new file mode 100644
index 0000000000..05c99acdda
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break017.script
@@ -0,0 +1,11 @@
+:l ../QSort.hs
+:set -fbreak-on-exception
+:trace qsort ("abc" ++ undefined)
+:back
+putStrLn "Printing 1"
+:print as
+putStrLn "Forcing"
+:force as
+-- this should print the exception
+putStrLn "Printing 2"
+:print as
diff --git a/testsuite/tests/ghci.debugger/scripts/break017.stdout b/testsuite/tests/ghci.debugger/scripts/break017.stdout
new file mode 100644
index 0000000000..305289d216
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break017.stdout
@@ -0,0 +1,12 @@
+"Stopped at <exception thrown>
+_exception :: e = _
+Logged breakpoint at ../QSort.hs:6:24-38
+_result :: [Char]
+a :: Char
+as :: [Char]
+Printing 1
+as = 'b' : 'c' : (_t1::[Char])
+Forcing
+*** Exception: Prelude.undefined
+Printing 2
+as = 'b' : 'c' : (_t2::[Char])
diff --git a/testsuite/tests/ghci.debugger/scripts/break018.script b/testsuite/tests/ghci.debugger/scripts/break018.script
new file mode 100644
index 0000000000..0a4c70ef5a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break018.script
@@ -0,0 +1,9 @@
+-- Check mdo statements: availability of local bindings.
+-- Maybe we should not want to put in scope the things binded in the mdo scope, to avoid silliness.
+
+:set -XRecursiveDo
+:l ../mdo.hs
+:st l2dll "hello world"
+:st
+:st
+:st
diff --git a/testsuite/tests/ghci.debugger/scripts/break018.stderr b/testsuite/tests/ghci.debugger/scripts/break018.stderr
new file mode 100644
index 0000000000..0107b5880f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break018.stderr
@@ -0,0 +1,3 @@
+
+<no location info>:
+ Warning: -XRecursiveDo is deprecated: use -XDoRec or pragma {-# LANGUAGE DoRec #-} instead
diff --git a/testsuite/tests/ghci.debugger/scripts/break018.stdout b/testsuite/tests/ghci.debugger/scripts/break018.stdout
new file mode 100644
index 0000000000..a495e7903a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break018.stdout
@@ -0,0 +1,13 @@
+Stopped at ../mdo.hs:(29,1)-(31,27)
+_result :: IO (N a) = _
+Stopped at ../mdo.hs:(29,16)-(31,27)
+_result :: IO (N Char) = _
+x :: Char = 'h'
+xs :: [Char] = _
+Stopped at ../mdo.hs:29:30-42
+_result :: IO (N Char) = _
+f :: N Char = _
+l :: N Char = _
+x :: Char = 'h'
+Stopped at ../mdo.hs:(7,1)-(8,42)
+_result :: IO (N a) = _
diff --git a/testsuite/tests/ghci.debugger/scripts/break019.script b/testsuite/tests/ghci.debugger/scripts/break019.script
new file mode 100644
index 0000000000..59537e7364
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break019.script
@@ -0,0 +1,3 @@
+-- Test for #1505
+:load ../Test2.hs
+:break Test2
diff --git a/testsuite/tests/ghci.debugger/scripts/break019.stderr b/testsuite/tests/ghci.debugger/scripts/break019.stderr
new file mode 100644
index 0000000000..fe27afda19
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break019.stderr
@@ -0,0 +1,2 @@
+
+Top level: Not in scope: data constructor `Test2'
diff --git a/testsuite/tests/ghci.debugger/scripts/break020.hs b/testsuite/tests/ghci.debugger/scripts/break020.hs
new file mode 100644
index 0000000000..b44de82a4c
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break020.hs
@@ -0,0 +1,15 @@
+import Break020b
+
+line1 _ = return ()
+line2 _ = return ()
+
+in_another_decl _ = do line1 0
+ line2 0
+
+main = do
+ line1 0
+ line2 0
+ in_another_decl 0
+ in_another_module 0
+ line2 1
+ return () \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break020.script b/testsuite/tests/ghci.debugger/scripts/break020.script
new file mode 100644
index 0000000000..f8ba30859e
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break020.script
@@ -0,0 +1,8 @@
+:l break020.hs
+:set stop :list
+:step main
+:steplocal
+:steplocal
+:steplocal
+:steplocal
+:steplocal \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break020.stdout b/testsuite/tests/ghci.debugger/scripts/break020.stdout
new file mode 100644
index 0000000000..0c7b0a4fc9
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break020.stdout
@@ -0,0 +1,42 @@
+Stopped at break020.hs:(9,8)-(15,11)
+_result :: IO () = _
+8
+ vv
+9 main = do
+10 line1 0
+11 line2 0
+12 in_another_decl 0
+13 in_another_module 0
+14 line2 1
+15 return ()
+ ^^
+Stopped at break020.hs:10:3-9
+_result :: IO () = _
+9 main = do
+10 line1 0
+ ^^^^^^^
+11 line2 0
+Stopped at break020.hs:11:3-9
+_result :: IO () = _
+10 line1 0
+11 line2 0
+ ^^^^^^^
+12 in_another_decl 0
+Stopped at break020.hs:12:3-19
+_result :: IO () = _
+11 line2 0
+12 in_another_decl 0
+ ^^^^^^^^^^^^^^^^^
+13 in_another_module 0
+Stopped at break020.hs:13:3-21
+_result :: IO () = _
+12 in_another_decl 0
+13 in_another_module 0
+ ^^^^^^^^^^^^^^^^^^^
+14 line2 1
+Stopped at break020.hs:14:3-9
+_result :: IO () = _
+13 in_another_module 0
+14 line2 1
+ ^^^^^^^
+15 return ()
diff --git a/testsuite/tests/ghci.debugger/scripts/break021.script b/testsuite/tests/ghci.debugger/scripts/break021.script
new file mode 100644
index 0000000000..e9251d6613
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break021.script
@@ -0,0 +1,23 @@
+:l break020.hs
+:set stop :list
+:step main
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule
+:stepmodule \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break021.stdout b/testsuite/tests/ghci.debugger/scripts/break021.stdout
new file mode 100644
index 0000000000..3a78eafce7
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break021.stdout
@@ -0,0 +1,135 @@
+Stopped at break020.hs:(9,8)-(15,11)
+_result :: IO () = _
+8
+ vv
+9 main = do
+10 line1 0
+11 line2 0
+12 in_another_decl 0
+13 in_another_module 0
+14 line2 1
+15 return ()
+ ^^
+Stopped at break020.hs:10:3-9
+_result :: IO () = _
+9 main = do
+10 line1 0
+ ^^^^^^^
+11 line2 0
+Stopped at break020.hs:3:1-19
+_result :: IO () = _
+2
+3 line1 _ = return ()
+ ^^^^^^^^^^^^^^^^^^^
+4 line2 _ = return ()
+Stopped at break020.hs:3:11-19
+_result :: IO () = _
+2
+3 line1 _ = return ()
+ ^^^^^^^^^
+4 line2 _ = return ()
+Stopped at break020.hs:11:3-9
+_result :: IO () = _
+10 line1 0
+11 line2 0
+ ^^^^^^^
+12 in_another_decl 0
+Stopped at break020.hs:4:1-19
+_result :: IO () = _
+3 line1 _ = return ()
+4 line2 _ = return ()
+ ^^^^^^^^^^^^^^^^^^^
+5
+Stopped at break020.hs:4:11-19
+_result :: IO () = _
+3 line1 _ = return ()
+4 line2 _ = return ()
+ ^^^^^^^^^
+5
+Stopped at break020.hs:12:3-19
+_result :: IO () = _
+11 line2 0
+12 in_another_decl 0
+ ^^^^^^^^^^^^^^^^^
+13 in_another_module 0
+Stopped at break020.hs:(6,1)-(7,30)
+_result :: m () = _
+5
+ vv
+6 in_another_decl _ = do line1 0
+7 line2 0
+ ^^
+8
+Stopped at break020.hs:(6,21)-(7,30)
+_result :: m () = _
+5
+ vv
+6 in_another_decl _ = do line1 0
+7 line2 0
+ ^^
+8
+Stopped at break020.hs:6:24-30
+_result :: m () = _
+5
+6 in_another_decl _ = do line1 0
+ ^^^^^^^
+7 line2 0
+Stopped at break020.hs:3:1-19
+_result :: m () = _
+2
+3 line1 _ = return ()
+ ^^^^^^^^^^^^^^^^^^^
+4 line2 _ = return ()
+Stopped at break020.hs:3:11-19
+_result :: m () = _
+2
+3 line1 _ = return ()
+ ^^^^^^^^^
+4 line2 _ = return ()
+Stopped at break020.hs:7:24-30
+_result :: m () = _
+6 in_another_decl _ = do line1 0
+7 line2 0
+ ^^^^^^^
+8
+Stopped at break020.hs:4:1-19
+_result :: m () = _
+3 line1 _ = return ()
+4 line2 _ = return ()
+ ^^^^^^^^^^^^^^^^^^^
+5
+Stopped at break020.hs:4:11-19
+_result :: m () = _
+3 line1 _ = return ()
+4 line2 _ = return ()
+ ^^^^^^^^^
+5
+Stopped at break020.hs:13:3-21
+_result :: IO () = _
+12 in_another_decl 0
+13 in_another_module 0
+ ^^^^^^^^^^^^^^^^^^^
+14 line2 1
+Stopped at break020.hs:14:3-9
+_result :: IO () = _
+13 in_another_module 0
+14 line2 1
+ ^^^^^^^
+15 return ()
+Stopped at break020.hs:4:1-19
+_result :: IO () = _
+3 line1 _ = return ()
+4 line2 _ = return ()
+ ^^^^^^^^^^^^^^^^^^^
+5
+Stopped at break020.hs:4:11-19
+_result :: IO () = _
+3 line1 _ = return ()
+4 line2 _ = return ()
+ ^^^^^^^^^
+5
+Stopped at break020.hs:15:3-11
+_result :: IO () = _
+14 line2 1
+15 return ()
+ ^^^^^^^^^
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/A.hs b/testsuite/tests/ghci.debugger/scripts/break022/A.hs
new file mode 100644
index 0000000000..bf903ab11e
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break022/A.hs
@@ -0,0 +1,4 @@
+module A where
+import {-# SOURCE #-} B
+
+a x = b x \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/B.hs b/testsuite/tests/ghci.debugger/scripts/break022/B.hs
new file mode 100644
index 0000000000..cfc9682cbd
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break022/B.hs
@@ -0,0 +1,5 @@
+module B where
+
+import A
+
+b x = x \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/B.hs-boot b/testsuite/tests/ghci.debugger/scripts/break022/B.hs-boot
new file mode 100644
index 0000000000..8e73321e9f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break022/B.hs-boot
@@ -0,0 +1,3 @@
+module B where
+
+b :: a -> a \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/C.hs b/testsuite/tests/ghci.debugger/scripts/break022/C.hs
new file mode 100644
index 0000000000..0dd15af7e7
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break022/C.hs
@@ -0,0 +1,5 @@
+module C where
+
+import A
+import B
+
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/Makefile b/testsuite/tests/ghci.debugger/scripts/break022/Makefile
new file mode 100644
index 0000000000..1c39d1c1fe
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break022/Makefile
@@ -0,0 +1,3 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/all.T b/testsuite/tests/ghci.debugger/scripts/break022/all.T
new file mode 100644
index 0000000000..f81e8de45c
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break022/all.T
@@ -0,0 +1,4 @@
+setTestOpts(extra_run_opts('-ignore-dot-ghci'))
+setTestOpts(if_compiler_profiled(skip))
+
+test('break022', normal, ghci_script, ['break022.script'])
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/break022.script b/testsuite/tests/ghci.debugger/scripts/break022/break022.script
new file mode 100644
index 0000000000..e0aaeda371
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break022/break022.script
@@ -0,0 +1,20 @@
+
+-- We have this structure of modules:
+
+-- A (imports B.boot)
+-- B (imports A)
+-- B.boot (imports A)
+-- C (imports A and B)
+
+-- And we load C, to debug some function in A which enters B.
+-- But first we touch A, and reload. B.boot will be reloaded, but not B, which will end up with an empty modbreaks. When we :step into B, ghci will die with an out of bounds access in B's break array.
+-- The effect we want is B.boot being reloaded while B is not.
+
+:l C
+:! touch A.hs
+:r
+:break a
+a ()
+:st
+:st
+:st -- here we step into B, and produce the exception \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break022/break022.stdout b/testsuite/tests/ghci.debugger/scripts/break022/break022.stdout
new file mode 100644
index 0000000000..49cbd2628d
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break022/break022.stdout
@@ -0,0 +1,8 @@
+Breakpoint 0 activated at A.hs:4:1-9
+Stopped at A.hs:4:1-9
+_result :: a = _
+Stopped at A.hs:4:7-9
+_result :: () = _
+x :: () = ()
+Stopped at B.hs:5:1-7
+_result :: t = _
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/A.hs b/testsuite/tests/ghci.debugger/scripts/break023/A.hs
new file mode 100644
index 0000000000..138a4faa1c
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break023/A.hs
@@ -0,0 +1,2 @@
+module A where
+import {-# SOURCE #-} B
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/B.hs b/testsuite/tests/ghci.debugger/scripts/break023/B.hs
new file mode 100644
index 0000000000..cfc9682cbd
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break023/B.hs
@@ -0,0 +1,5 @@
+module B where
+
+import A
+
+b x = x \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/B.hs-boot b/testsuite/tests/ghci.debugger/scripts/break023/B.hs-boot
new file mode 100644
index 0000000000..8e73321e9f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break023/B.hs-boot
@@ -0,0 +1,3 @@
+module B where
+
+b :: a -> a \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/C.hs b/testsuite/tests/ghci.debugger/scripts/break023/C.hs
new file mode 100644
index 0000000000..0dd15af7e7
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break023/C.hs
@@ -0,0 +1,5 @@
+module C where
+
+import A
+import B
+
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/Makefile b/testsuite/tests/ghci.debugger/scripts/break023/Makefile
new file mode 100644
index 0000000000..1c39d1c1fe
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break023/Makefile
@@ -0,0 +1,3 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/all.T b/testsuite/tests/ghci.debugger/scripts/break023/all.T
new file mode 100644
index 0000000000..3858849735
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break023/all.T
@@ -0,0 +1,4 @@
+setTestOpts(extra_run_opts('-ignore-dot-ghci'))
+setTestOpts(if_compiler_profiled(skip))
+
+test('break023', normal, ghci_script, ['break023.script'])
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/break023.script b/testsuite/tests/ghci.debugger/scripts/break023/break023.script
new file mode 100644
index 0000000000..4ddd2d6be4
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break023/break023.script
@@ -0,0 +1,17 @@
+
+-- We have this structure of modules:
+
+-- A (imports B.boot)
+-- B (imports A)
+-- B.boot (imports A)
+-- C (imports A and B)
+
+-- And we load C, to debug some function called b in B.
+-- But first we touch A, and reload. B.boot will be reloaded, but not B, which will end up with an empty modbreaks. We can no longer set a breakpoint in B.b
+-- The effect we want is B.boot being reloaded while B is not.
+
+:l C
+:break b -- it works ok at this point
+:! touch A.hs
+:r
+:break b -- it does not work anymore
diff --git a/testsuite/tests/ghci.debugger/scripts/break023/break023.stdout b/testsuite/tests/ghci.debugger/scripts/break023/break023.stdout
new file mode 100644
index 0000000000..2b6c85daf4
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break023/break023.stdout
@@ -0,0 +1,2 @@
+Breakpoint 0 activated at B.hs:5:1-7
+Breakpoint 1 activated at B.hs:5:1-7
diff --git a/testsuite/tests/ghci.debugger/scripts/break024.hs b/testsuite/tests/ghci.debugger/scripts/break024.hs
new file mode 100644
index 0000000000..33c8ce6036
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break024.hs
@@ -0,0 +1,4 @@
+import Control.Exception as CE
+
+exception_uncaught = ioError (userError "error")
+exception_caught = CE.try exception_uncaught :: IO (Either CE.IOException ())
diff --git a/testsuite/tests/ghci.debugger/scripts/break024.script b/testsuite/tests/ghci.debugger/scripts/break024.script
new file mode 100644
index 0000000000..7efb396788
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break024.script
@@ -0,0 +1,16 @@
+-- Test -fbreak-on-exception and -fbreak-on-error
+:set -XDeriveDataTypeable
+:l break024
+:set -fbreak-on-error
+exception_caught
+exception_uncaught
+:force _exception
+:co
+:set -fno-break-on-error
+:set -fbreak-on-exception
+exception_uncaught
+:force _exception
+:co
+exception_caught
+:force _exception
+:co
diff --git a/testsuite/tests/ghci.debugger/scripts/break024.stdout b/testsuite/tests/ghci.debugger/scripts/break024.stdout
new file mode 100644
index 0000000000..dc3bd73425
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break024.stdout
@@ -0,0 +1,19 @@
+Left user error (error)
+Stopped at <exception thrown>
+_exception :: e = _
+_exception = SomeException
+ (GHC.IO.Exception.IOError
+ Nothing GHC.IO.Exception.UserError [] "error" Nothing Nothing)
+*** Exception: user error (error)
+Stopped at <exception thrown>
+_exception :: e = _
+_exception = SomeException
+ (GHC.IO.Exception.IOError
+ Nothing GHC.IO.Exception.UserError [] "error" Nothing Nothing)
+*** Exception: user error (error)
+Stopped at <exception thrown>
+_exception :: e = _
+_exception = SomeException
+ (GHC.IO.Exception.IOError
+ Nothing GHC.IO.Exception.UserError [] "error" Nothing Nothing)
+Left user error (error)
diff --git a/testsuite/tests/ghci.debugger/scripts/break024.stdout-ghc-7.0 b/testsuite/tests/ghci.debugger/scripts/break024.stdout-ghc-7.0
new file mode 100644
index 0000000000..d2c3495ee6
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break024.stdout-ghc-7.0
@@ -0,0 +1,28 @@
+Left user error (error)
+Stopped at <exception thrown>
+_exception :: e = SomeException (GHC.Exception.D:Exception _
+ (GHC.Show.D:Show ...) ....)
+ (GHC.IO.Exception.IOError Nothing GHC.IO.Exception.UserError ....)
+_exception = SomeException (GHC.Exception.D:Exception _
+ (GHC.Show.D:Show _ _ _) _ _)
+ (GHC.IO.Exception.IOError Nothing GHC.IO.Exception.UserError []
+ ['e','r','r','o','r'] Nothing Nothing)
+*** Exception: user error (error)
+Stopped at <exception thrown>
+_exception :: e = SomeException (GHC.Exception.D:Exception _
+ (GHC.Show.D:Show ...) ....)
+ (GHC.IO.Exception.IOError Nothing GHC.IO.Exception.UserError ....)
+_exception = SomeException (GHC.Exception.D:Exception _
+ (GHC.Show.D:Show _ _ _) _ _)
+ (GHC.IO.Exception.IOError Nothing GHC.IO.Exception.UserError []
+ ['e','r','r','o','r'] Nothing Nothing)
+*** Exception: user error (error)
+Stopped at <exception thrown>
+_exception :: e = SomeException (GHC.Exception.D:Exception _
+ (GHC.Show.D:Show ...) ....)
+ (GHC.IO.Exception.IOError Nothing GHC.IO.Exception.UserError ....)
+_exception = SomeException (GHC.Exception.D:Exception _
+ (GHC.Show.D:Show _ _ _) _ _)
+ (GHC.IO.Exception.IOError Nothing GHC.IO.Exception.UserError []
+ ['e','r','r','o','r'] Nothing Nothing)
+Left user error (error)
diff --git a/testsuite/tests/ghci.debugger/scripts/break025.script b/testsuite/tests/ghci.debugger/scripts/break025.script
new file mode 100644
index 0000000000..2fe0bfcae6
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break025.script
@@ -0,0 +1,4 @@
+-- :abandon in an exception breakpoint can lead to ghci freezing
+:set -fbreak-on-exception
+error "an error"
+()
diff --git a/testsuite/tests/ghci.debugger/scripts/break025.stdout b/testsuite/tests/ghci.debugger/scripts/break025.stdout
new file mode 100644
index 0000000000..e38f173aff
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break025.stdout
@@ -0,0 +1,3 @@
+Stopped at <exception thrown>
+_exception :: e = _
+()
diff --git a/testsuite/tests/ghci.debugger/scripts/break026.hs b/testsuite/tests/ghci.debugger/scripts/break026.hs
new file mode 100644
index 0000000000..e88b9e96d7
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break026.hs
@@ -0,0 +1,7 @@
+module Test where
+
+import Prelude hiding (foldl)
+
+foldl f c xs = go c xs
+ where go c [] = c
+ go c (x:xs) = go (f c x) xs
diff --git a/testsuite/tests/ghci.debugger/scripts/break026.script b/testsuite/tests/ghci.debugger/scripts/break026.script
new file mode 100644
index 0000000000..98c6624751
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break026.script
@@ -0,0 +1,23 @@
+:load break026
+:step foldl (+) 0 [1..5]
+:step
+:step
+:step
+:step
+:step
+:force c
+ -- answer should be 1
+
+:load break026
+:step foldl (+) 0 [1..5]
+:step
+:step
+:step
+:step
+:step
+-- a diversion to single-step the evaluation of c:
+:step c `seq` ()
+:step
+-- end diversion
+c
+ -- answer should be 1 again (not 0)
diff --git a/testsuite/tests/ghci.debugger/scripts/break026.stdout b/testsuite/tests/ghci.debugger/scripts/break026.stdout
new file mode 100644
index 0000000000..311c1e6bd2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break026.stdout
@@ -0,0 +1,58 @@
+Stopped at break026.hs:(5,1)-(7,35)
+_result :: t1 = _
+Stopped at break026.hs:5:16-22
+_result :: t1 = _
+c :: t1 = _
+go :: t1 -> [t] -> t1 = _
+xs :: [t] = _
+Stopped at break026.hs:(6,9)-(7,35)
+_result :: t1 = _
+f :: t1 -> t -> t1 = _
+Stopped at break026.hs:7:23-35
+_result :: t1 = _
+c :: t1 = _
+f :: t1 -> Integer -> t1 = _
+x :: Integer = 1
+xs :: [Integer] = _
+Stopped at break026.hs:(6,9)-(7,35)
+_result :: t1 = _
+f :: t1 -> t -> t1 = _
+Stopped at break026.hs:7:23-35
+_result :: t1 = _
+c :: t1 = _
+f :: t1 -> Integer -> t1 = _
+x :: Integer = 2
+xs :: [Integer] = _
+c = 1
+Stopped at break026.hs:(5,1)-(7,35)
+_result :: t1 = _
+Stopped at break026.hs:5:16-22
+_result :: t1 = _
+c :: t1 = _
+go :: t1 -> [t] -> t1 = _
+xs :: [t] = _
+Stopped at break026.hs:(6,9)-(7,35)
+_result :: t1 = _
+f :: t1 -> t -> t1 = _
+Stopped at break026.hs:7:23-35
+_result :: t1 = _
+c :: t1 = _
+f :: t1 -> Integer -> t1 = _
+x :: Integer = 1
+xs :: [Integer] = _
+Stopped at break026.hs:(6,9)-(7,35)
+_result :: t1 = _
+f :: t1 -> t -> t1 = _
+Stopped at break026.hs:7:23-35
+_result :: t1 = _
+c :: t1 = _
+f :: t1 -> Integer -> t1 = _
+x :: Integer = 2
+xs :: [Integer] = _
+Stopped at break026.hs:7:27-31
+_result :: t1 = _
+c :: t1 = _
+f :: t1 -> Integer -> t1 = _
+x :: Integer = 1
+()
+1
diff --git a/testsuite/tests/ghci.debugger/scripts/break027.script b/testsuite/tests/ghci.debugger/scripts/break027.script
new file mode 100644
index 0000000000..198b259c78
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break027.script
@@ -0,0 +1,5 @@
+:l ../QSort
+:break qsort
+qsort [3,2,1]
+:step
+:i a
diff --git a/testsuite/tests/ghci.debugger/scripts/break027.stdout b/testsuite/tests/ghci.debugger/scripts/break027.stdout
new file mode 100644
index 0000000000..818111a9e1
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break027.stdout
@@ -0,0 +1,9 @@
+Breakpoint 0 activated at ../QSort.hs:(4,1)-(6,55)
+Stopped at ../QSort.hs:(4,1)-(6,55)
+_result :: [a] = _
+Stopped at ../QSort.hs:5:16-51
+_result :: [a] = _
+a :: a = _
+left :: [a] = _
+right :: [a] = _
+a :: a -- <no location info>
diff --git a/testsuite/tests/ghci.debugger/scripts/break028.hs b/testsuite/tests/ghci.debugger/scripts/break028.hs
new file mode 100644
index 0000000000..8e4ef2a3b5
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break028.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts #-}
+
+type family Id x
+type instance Id Int = Int
+type instance Id Bool = Bool
+
+class Convert x y where convert :: x -> y
+instance Convert x x where convert = id
+
+f :: Convert a (Id a) => a -> Id a
+f x = convert x
+
+g :: Convert a (Id a) => a -> Id a
+g x = let x' = f x in x' \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/break028.script b/testsuite/tests/ghci.debugger/scripts/break028.script
new file mode 100644
index 0000000000..26793f1459
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break028.script
@@ -0,0 +1,4 @@
+:l break028
+:step g False
+:step
+:q
diff --git a/testsuite/tests/ghci.debugger/scripts/break028.stdout b/testsuite/tests/ghci.debugger/scripts/break028.stdout
new file mode 100644
index 0000000000..2438d73a14
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/break028.stdout
@@ -0,0 +1,5 @@
+Stopped at break028.hs:15:1-24
+_result :: Id a = _
+Stopped at break028.hs:15:23-24
+_result :: Id a = _
+x' :: Id a = _
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk001.script b/testsuite/tests/ghci.debugger/scripts/dynbrk001.script
new file mode 100644
index 0000000000..95c1ab6118
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk001.script
@@ -0,0 +1,22 @@
+
+:set -fprint-explicit-foralls
+
+:l ../QSort
+
+:delete 1
+-- Illegal: empty breakpoint list
+
+:break NonModule 1
+-- Illegal: I don't know this module
+
+:break QSort 1 1
+-- Error: No breakpoint here
+
+:show breaks
+-- Show an empty list
+
+qsort [8, 4, 42, 16, 15, 23]
+-- Should run normally
+
+-- Testing that ghci commands work normally
+:i map
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk001.stderr b/testsuite/tests/ghci.debugger/scripts/dynbrk001.stderr
new file mode 100644
index 0000000000..adb8dca658
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk001.stderr
@@ -0,0 +1,4 @@
+
+<no location info>:
+ Could not find module `NonModule'
+ It is not a module in the current program, or in any known package.
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk001.stdout b/testsuite/tests/ghci.debugger/scripts/dynbrk001.stdout
new file mode 100644
index 0000000000..3ce4969682
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk001.stdout
@@ -0,0 +1,5 @@
+Breakpoint 1 does not exist
+No breakpoints found at that location.
+No active breakpoints.
+[4,8,15,16,23,42]
+map :: forall a b. (a -> b) -> [a] -> [b] -- Defined in GHC.Base
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk002.script b/testsuite/tests/ghci.debugger/scripts/dynbrk002.script
new file mode 100644
index 0000000000..043e02328b
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk002.script
@@ -0,0 +1,7 @@
+-- :abandon stops a debugging session
+
+:l ../QSort
+:break QSort 5
+run
+:abandon
+:q
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk002.stdout b/testsuite/tests/ghci.debugger/scripts/dynbrk002.stdout
new file mode 100644
index 0000000000..b67ced36a6
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk002.stdout
@@ -0,0 +1,6 @@
+Breakpoint 0 activated at ../QSort.hs:5:16-51
+Stopped at ../QSort.hs:5:16-51
+_result :: [a] = _
+a :: a = _
+left :: [a] = _
+right :: [a] = _
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk003.script b/testsuite/tests/ghci.debugger/scripts/dynbrk003.script
new file mode 100644
index 0000000000..dfd00b69ab
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk003.script
@@ -0,0 +1,2 @@
+-- :abandon in the top level should be a no-op
+:abandon
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk003.stdout b/testsuite/tests/ghci.debugger/scripts/dynbrk003.stdout
new file mode 100644
index 0000000000..be3e67e656
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk003.stdout
@@ -0,0 +1 @@
+There is no computation running.
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk004.script b/testsuite/tests/ghci.debugger/scripts/dynbrk004.script
new file mode 100644
index 0000000000..eb0bad6940
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk004.script
@@ -0,0 +1,8 @@
+-- Instrumentation of mdo notation
+
+:set -XRecursiveDo
+:l ../mdo.hs
+:break Main 13
+:break Main 12
+:break Main 11
+:break Main 14
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk004.stderr b/testsuite/tests/ghci.debugger/scripts/dynbrk004.stderr
new file mode 100644
index 0000000000..0107b5880f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk004.stderr
@@ -0,0 +1,3 @@
+
+<no location info>:
+ Warning: -XRecursiveDo is deprecated: use -XDoRec or pragma {-# LANGUAGE DoRec #-} instead
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk004.stdout b/testsuite/tests/ghci.debugger/scripts/dynbrk004.stdout
new file mode 100644
index 0000000000..ed7fb990a4
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk004.stdout
@@ -0,0 +1,4 @@
+Breakpoint 0 activated at ../mdo.hs:13:16-30
+Breakpoint 1 activated at ../mdo.hs:12:16-30
+Breakpoint 2 activated at ../mdo.hs:11:16-30
+Breakpoint 3 activated at ../mdo.hs:14:10-18
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk005.hs b/testsuite/tests/ghci.debugger/scripts/dynbrk005.hs
new file mode 100644
index 0000000000..5b228d2ab4
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk005.hs
@@ -0,0 +1,5 @@
+import TupleN
+
+tuple3 x = $(tuple 3) x
+
+normal_fn x = tuple3 x \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk005.script b/testsuite/tests/ghci.debugger/scripts/dynbrk005.script
new file mode 100644
index 0000000000..6ac65d8096
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk005.script
@@ -0,0 +1,13 @@
+-- TH generated code does not get instrumented
+
+:set -XTemplateHaskell
+:l dynbrk005
+:st normal_fn [1,2,3]
+:st
+:st
+:st
+:st
+:st
+:st
+:st
+:st \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk005.stdout b/testsuite/tests/ghci.debugger/scripts/dynbrk005.stdout
new file mode 100644
index 0000000000..3eff707e6c
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk005.stdout
@@ -0,0 +1,11 @@
+Stopped at dynbrk005.hs:5:0-21
+_result :: (a, a, a) = _
+Stopped at dynbrk005.hs:5:14-21
+_result :: (a, a, a) = _
+x :: [a] = [_,_,_]
+Stopped at dynbrk005.hs:3:0-22
+_result :: (a, a, a) = _
+Stopped at dynbrk005.hs:3:11-22
+_result :: (a, a, a) = _
+x :: [a] = [_,_,_]
+(1,2,3)
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk007.hs b/testsuite/tests/ghci.debugger/scripts/dynbrk007.hs
new file mode 100644
index 0000000000..dc02170216
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk007.hs
@@ -0,0 +1,6 @@
+f :: Maybe Int
+f = do
+ i <- return 1
+ j <- return 2
+ k <- return 3
+ return i \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk007.script b/testsuite/tests/ghci.debugger/scripts/dynbrk007.script
new file mode 100644
index 0000000000..1f40a2255f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk007.script
@@ -0,0 +1,7 @@
+-- Breakpoints in do statements
+:l dynbrk007.hs
+:st f
+:st
+:st
+:st
+:st
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk007.stdout b/testsuite/tests/ghci.debugger/scripts/dynbrk007.stdout
new file mode 100644
index 0000000000..22adee0db2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk007.stdout
@@ -0,0 +1,11 @@
+Stopped at dynbrk007.hs:(2,5)-(6,11)
+_result :: Maybe Int = _
+Stopped at dynbrk007.hs:3:9-16
+_result :: Maybe Int = _
+Stopped at dynbrk007.hs:4:9-16
+_result :: Maybe Integer = _
+Stopped at dynbrk007.hs:5:9-16
+_result :: Maybe Integer = _
+Stopped at dynbrk007.hs:6:4-11
+_result :: Maybe Int = _
+i :: Int = 1
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk008.hs b/testsuite/tests/ghci.debugger/scripts/dynbrk008.hs
new file mode 100644
index 0000000000..8fbde66d21
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk008.hs
@@ -0,0 +1,4 @@
+f :: Int -> [Int]
+f i = [ j | j <- [i], h <- [j], k <- [h]]
+
+g i = i \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk008.script b/testsuite/tests/ghci.debugger/scripts/dynbrk008.script
new file mode 100644
index 0000000000..e99ee6076e
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk008.script
@@ -0,0 +1,9 @@
+-- Breakpoints on binding sites that start with a List Comprehension are being coalesced, since list comp. are desugared to Lets and we coalesce bkpts for Lets (since there will be a breakpoint at body of the Let anyway)
+
+:l dynbrk008.hs
+:st f 42
+:st
+:st
+:st
+:st
+:st
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk008.stdout b/testsuite/tests/ghci.debugger/scripts/dynbrk008.stdout
new file mode 100644
index 0000000000..722f2991f3
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk008.stdout
@@ -0,0 +1,15 @@
+Stopped at dynbrk008.hs:2:1-41
+_result :: [Int] = _
+Stopped at dynbrk008.hs:2:7-41
+_result :: [Int] = _
+i :: Int = 42
+Stopped at dynbrk008.hs:2:18-20
+_result :: [Int] = _
+i :: Int = 42
+Stopped at dynbrk008.hs:2:28-30
+_result :: [Int] = _
+j :: Int = 42
+Stopped at dynbrk008.hs:2:38-40
+_result :: [Int] = _
+h :: Int = 42
+[42]
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk009.hs b/testsuite/tests/ghci.debugger/scripts/dynbrk009.hs
new file mode 100644
index 0000000000..f0e0bfee16
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk009.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE MagicHash, BangPatterns #-}
+
+import GHC.Base
+
+f :: Int -> Int# -> Int#
+f x i = i
+
+test = let !(I# i) = 3 in I# (f 2 i) \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk009.script b/testsuite/tests/ghci.debugger/scripts/dynbrk009.script
new file mode 100644
index 0000000000..7d00f193a5
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk009.script
@@ -0,0 +1,10 @@
+-- Instrumentation should not set breakpoints around unlifted values.
+-- Also unlifted types are not bound at a breakpoint currently.
+
+:l dynbrk009.hs
+:st test
+:st
+:st
+:st
+:st
+:st
diff --git a/testsuite/tests/ghci.debugger/scripts/dynbrk009.stdout b/testsuite/tests/ghci.debugger/scripts/dynbrk009.stdout
new file mode 100644
index 0000000000..e7e107448c
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/dynbrk009.stdout
@@ -0,0 +1,11 @@
+Stopped at dynbrk009.hs:8:22
+_result :: Int = _
+Stopped at dynbrk009.hs:8:27-36
+_result :: Int = _
+Stopped at dynbrk009.hs:8:31-35
+_result :: Int = _
+Stopped at dynbrk009.hs:6:1-9
+_result :: Int = _
+Stopped at dynbrk009.hs:6:9
+_result :: Int = _
+3
diff --git a/testsuite/tests/ghci.debugger/scripts/getargs.script b/testsuite/tests/ghci.debugger/scripts/getargs.script
new file mode 100644
index 0000000000..4574386df3
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/getargs.script
@@ -0,0 +1,4 @@
+:l ../getargs.hs
+:set args 42
+:step main
+:step
diff --git a/testsuite/tests/ghci.debugger/scripts/getargs.stdout b/testsuite/tests/ghci.debugger/scripts/getargs.stdout
new file mode 100644
index 0000000000..659308cd77
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/getargs.stdout
@@ -0,0 +1,3 @@
+Stopped at ..\getargs.hs:3:8-24
+_result :: IO () = _
+["42"]
diff --git a/testsuite/tests/ghci.debugger/scripts/hist001.script b/testsuite/tests/ghci.debugger/scripts/hist001.script
new file mode 100644
index 0000000000..5f8eab637e
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/hist001.script
@@ -0,0 +1,15 @@
+:l ../Test3.hs
+-- set a break on the [] case in map
+:b 1
+-- trace an execution
+:tr mymap (+1) [1,2]
+:hist
+:back
+:show bindings
+:back
+:show bindings
+:force _result
+:back
+:forward
+-- at this point, we can't retrieve the bindings because _result (the AP_STACK)
+-- was evaluated previously. GHCi should not crash, preferably.
diff --git a/testsuite/tests/ghci.debugger/scripts/hist001.stdout b/testsuite/tests/ghci.debugger/scripts/hist001.stdout
new file mode 100644
index 0000000000..68e05cc076
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/hist001.stdout
@@ -0,0 +1,31 @@
+Breakpoint 0 activated at ../Test3.hs:1:14-15
+[2,3Stopped at ../Test3.hs:1:14-15
+_result :: [a] = _
+-1 : mymap (../Test3.hs:(1,1)-(2,31))
+-2 : mymap (../Test3.hs:2:22-31)
+-3 : mymap (../Test3.hs:2:18-20)
+-4 : mymap (../Test3.hs:2:18-31)
+-5 : mymap (../Test3.hs:(1,1)-(2,31))
+-6 : mymap (../Test3.hs:2:22-31)
+-7 : mymap (../Test3.hs:2:18-20)
+-8 : mymap (../Test3.hs:2:18-31)
+-9 : mymap (../Test3.hs:(1,1)-(2,31))
+<end of history>
+Logged breakpoint at ../Test3.hs:(1,1)-(2,31)
+_result :: [a]
+_result :: [a] = _
+Logged breakpoint at ../Test3.hs:2:22-31
+_result :: [a]
+f :: t -> a
+xs :: [t]
+_result :: [a] = _
+f :: t -> a = _
+xs :: [t] = []
+*** Ignoring breakpoint
+_result = []
+Logged breakpoint at ../Test3.hs:2:18-20
+_result :: a
+f :: Integer -> a
+x :: Integer
+Logged breakpoint at ../Test3.hs:2:22-31
+_result :: [a]
diff --git a/testsuite/tests/ghci.debugger/scripts/listCommand001.script b/testsuite/tests/ghci.debugger/scripts/listCommand001.script
new file mode 100644
index 0000000000..767b27c47f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/listCommand001.script
@@ -0,0 +1,13 @@
+:list
+-- should fail, nothing to list
+:list Data.List 20
+-- can't list a compiled module
+:list Data.List.map
+-- can't list a compiled module
+:l ../Test3.hs
+:list mymap
+:list main
+:list 4
+-- wrong syntax:
+:list a b c
+:list 10 20
diff --git a/testsuite/tests/ghci.debugger/scripts/listCommand001.stdout b/testsuite/tests/ghci.debugger/scripts/listCommand001.stdout
new file mode 100644
index 0000000000..26a27ac5a5
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/listCommand001.stdout
@@ -0,0 +1,15 @@
+Not stopped at a breakpoint; nothing to list
+module 'Data.List' is from another package;
+this command requires an interpreted module
+cannot list source code for map: module GHC.Base is not interpreted
+1 mymap f [] = []
+2 mymap f (x:xs) = f x:mymap f xs
+3
+3
+4 main = mapM_ putStrLn $ mymap ('a':) ["hello","bye"]
+5
+3
+4 main = mapM_ putStrLn $ mymap ('a':) ["hello","bye"]
+5
+syntax: :list [<line> | <module> <line> | <identifier>]
+syntax: :list [<line> | <module> <line> | <identifier>]
diff --git a/testsuite/tests/ghci.debugger/scripts/listCommand002.hs b/testsuite/tests/ghci.debugger/scripts/listCommand002.hs
new file mode 100644
index 0000000000..71f3f5482c
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/listCommand002.hs
@@ -0,0 +1,5 @@
+import System.Directory
+
+main = do
+ setCurrentDirectory ".."
+ putStrLn "Hello World" \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/listCommand002.script b/testsuite/tests/ghci.debugger/scripts/listCommand002.script
new file mode 100644
index 0000000000..72abf5291d
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/listCommand002.script
@@ -0,0 +1,4 @@
+:l listCommand002
+:step main
+:step
+:step \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/listCommand002.stdout b/testsuite/tests/ghci.debugger/scripts/listCommand002.stdout
new file mode 100644
index 0000000000..95854884b2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/listCommand002.stdout
@@ -0,0 +1,6 @@
+Stopped at listCommand002.hs:(3,8)-(5,24)
+_result :: IO () = _
+Stopped at listCommand002.hs:4:3-26
+_result :: IO () = _
+Stopped at listCommand002.hs:5:3-24
+_result :: IO () = _
diff --git a/testsuite/tests/ghci.debugger/scripts/print001.script b/testsuite/tests/ghci.debugger/scripts/print001.script
new file mode 100644
index 0000000000..f2111c0cc5
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print001.script
@@ -0,0 +1,12 @@
+-- Printing of lists
+
+let li = map Just [0..5]
+:p li
+head li
+:p li
+length li
+:p li
+:sp li
+li
+:p li
+:sp li \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print001.stdout b/testsuite/tests/ghci.debugger/scripts/print001.stdout
new file mode 100644
index 0000000000..c55ed941cb
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print001.stdout
@@ -0,0 +1,10 @@
+li = (_t1::[Maybe Integer])
+Just 0
+li = Just 0 : (_t2::[Maybe Integer])
+6
+li = [Just 0,(_t3::Maybe Integer),(_t4::Maybe Integer),
+ (_t5::Maybe Integer),(_t6::Maybe Integer),(_t7::Maybe Integer)]
+li = [Just 0,_,_,_,_,_]
+[Just 0,Just 1,Just 2,Just 3,Just 4,Just 5]
+li = [Just 0,Just 1,Just 2,Just 3,Just 4,Just 5]
+li = [Just 0,Just 1,Just 2,Just 3,Just 4,Just 5]
diff --git a/testsuite/tests/ghci.debugger/scripts/print002.script b/testsuite/tests/ghci.debugger/scripts/print002.script
new file mode 100644
index 0000000000..629bb92e74
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print002.script
@@ -0,0 +1,19 @@
+-- printing of Showables
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+let f = Just (1.2::Float)
+f
+:p f
+
+let i = Just (10::Integer)
+:p i
+
+case i of Just j -> Control.Exception.evaluate j
+:p i
+
+:l ../Test.hs
+
+let s = S1 'a' 'b' 'c'
+s
+:p s
+:sp s \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print002.stdout b/testsuite/tests/ghci.debugger/scripts/print002.stdout
new file mode 100644
index 0000000000..ab0e6f2fdb
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print002.stdout
@@ -0,0 +1,8 @@
+Just 1.2
+f = Just 1.2
+i = Just (_t1::Integer)
+10
+i = Just 10
+'a'
+s = S1 'a' 'b' 'c'
+s = S1 'a' 'b' 'c'
diff --git a/testsuite/tests/ghci.debugger/scripts/print003.script b/testsuite/tests/ghci.debugger/scripts/print003.script
new file mode 100644
index 0000000000..8544f46231
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print003.script
@@ -0,0 +1,15 @@
+-- Simple Recovery of types - opaque types
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+let t = O (map Just [[1,1],[2,2]])
+:p t
+-- should have bound _t1 now
+:show bindings
+seq _t1 ()
+:p t
+:show bindings
+seq _t2 ()
+:p t
+seq _t4 ()
+:p t
+:t _t7
diff --git a/testsuite/tests/ghci.debugger/scripts/print003.stdout b/testsuite/tests/ghci.debugger/scripts/print003.stdout
new file mode 100644
index 0000000000..99a66e4bdc
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print003.stdout
@@ -0,0 +1,15 @@
+t = O (_t1::a)
+_t1 :: a = _
+t :: Opaque = O _
+()
+t = O ((_t2::a1) : (_t3::[a1]))
+_t1 :: [a] = _ : _
+_t2 :: a1 = _
+_t3 :: [a1] = _
+it :: () = ()
+t :: Opaque = O (_ : _)
+()
+t = O (Just [(_t4::a1),(_t5::a1)] : (_t6::[Maybe [a1]]))
+()
+t = O (Just [1,(_t7::Integer)] : (_t8::[Maybe [Integer]]))
+_t7 :: Integer
diff --git a/testsuite/tests/ghci.debugger/scripts/print004.script b/testsuite/tests/ghci.debugger/scripts/print004.script
new file mode 100644
index 0000000000..b82929a600
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print004.script
@@ -0,0 +1,28 @@
+-- simple :print tests
+
+let a = False
+:sp a
+:p a
+
+let b = map Just [1..4]
+:p b
+head b
+:p b
+length b
+:p b
+:sp b
+b
+:p b
+
+-- Force loading of a external package and keep pushing
+:m +Language.Haskell.TH
+let c = ListT
+:p c
+let d = map TupleT [1..4]
+:p d
+head d
+:p d
+length d
+:p d
+d
+:p d
diff --git a/testsuite/tests/ghci.debugger/scripts/print004.stdout b/testsuite/tests/ghci.debugger/scripts/print004.stdout
new file mode 100644
index 0000000000..ee7bbacefa
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print004.stdout
@@ -0,0 +1,19 @@
+a = False
+a = False
+b = (_t1::[Maybe Integer])
+Just 1
+b = Just 1 : (_t2::[Maybe Integer])
+4
+b = [Just 1,(_t3::Maybe Integer),(_t4::Maybe Integer),
+ (_t5::Maybe Integer)]
+b = [Just 1,_,_,_]
+[Just 1,Just 2,Just 3,Just 4]
+b = [Just 1,Just 2,Just 3,Just 4]
+c = ListT
+d = (_t6::[Type])
+TupleT 1
+d = TupleT 1 : (_t7::[Type])
+4
+d = [TupleT 1,(_t8::Type),(_t9::Type),(_t10::Type)]
+[TupleT 1,TupleT 2,TupleT 3,TupleT 4]
+d = [TupleT 1,TupleT 2,TupleT 3,TupleT 4]
diff --git a/testsuite/tests/ghci.debugger/scripts/print005.script b/testsuite/tests/ghci.debugger/scripts/print005.script
new file mode 100644
index 0000000000..0d26508703
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print005.script
@@ -0,0 +1,15 @@
+-- Recovery of types, polymorphic bindings inside a bkpt
+
+:l ../QSort
+:break 5
+qsort [8, 4]
+
+:p right
+seq right ()
+:p right
+:p left
+seq left ()
+:p left
+length left
+:p left
+:continue \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print005.stdout b/testsuite/tests/ghci.debugger/scripts/print005.stdout
new file mode 100644
index 0000000000..f2c930a356
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print005.stdout
@@ -0,0 +1,19 @@
+Breakpoint 0 activated at ../QSort.hs:5:16-51
+Stopped at ../QSort.hs:5:16-51
+_result :: [a] = _
+a :: a = _
+left :: [a] = _
+right :: [a] = _
+right = (_t1::[a])
+()
+right = []
+left = (_t2::[Integer])
+()
+left = 4 : (_t3::[Integer])
+1
+left = [4]
+Stopped at ../QSort.hs:5:16-51
+_result :: [Integer] = _
+a :: Integer = 4
+left :: [Integer] = _
+right :: [Integer] = _
diff --git a/testsuite/tests/ghci.debugger/scripts/print006.script b/testsuite/tests/ghci.debugger/scripts/print006.script
new file mode 100644
index 0000000000..d4c60d56a6
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print006.script
@@ -0,0 +1,19 @@
+-- Recovery of types, opaque types
+-- This scenario demands propagation of types up in the tree of terms
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+let t = O (map Just [[1,1],[2,2]])
+:p t
+seq _t1 () -- The contents of the opaque
+:p t
+seq _t3 () -- The tail of the list
+:p t
+seq _t5 () -- The 2nd element of the list
+:p t
+seq _t8 () -- The 1st element of the list inside the Just
+:p t
+seq _t11 () -- The 1st element of the outer list
+
+:p t
+ -- The 1st Just must be completely typed, as we know the type of the list \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print006.stdout b/testsuite/tests/ghci.debugger/scripts/print006.stdout
new file mode 100644
index 0000000000..0a91ca724b
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print006.stdout
@@ -0,0 +1,14 @@
+t = O (_t1::a)
+()
+t = O ((_t2::a1) : (_t3::[a1]))
+()
+t = O ((_t4::a2) : (_t5::a2) : (_t6::[a2]))
+()
+t = O ((_t7::Maybe [a1]) : Just [(_t8::a1),(_t9::a1)] :
+ (_t10::[Maybe [a1]]))
+()
+t = O ((_t11::Maybe [Integer]) : Just [2,(_t12::Integer)] :
+ (_t13::[Maybe [Integer]]))
+()
+t = O (Just [(_t14::Integer),(_t15::Integer)] :
+ Just [2,(_t16::Integer)] : (_t17::[Maybe [Integer]]))
diff --git a/testsuite/tests/ghci.debugger/scripts/print007.script b/testsuite/tests/ghci.debugger/scripts/print007.script
new file mode 100644
index 0000000000..69fbb4d2dd
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print007.script
@@ -0,0 +1,30 @@
+-- Handling of unboxed fields
+-- There seems to be a problem with -funbox-strict-fields
+-- and interpreted code.
+-- dataConRepArgTys says they are unboxed,
+-- but they seem to be not.
+-- So this test fails with wrong output
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+
+let s = S2 'a' 'b'
+seq s ()
+:p s
+
+:set -funbox-strict-fields
+:l
+:l ../Test
+
+let s = S2 'a' 'b'
+seq s ()
+:p s
+
+
+:set -funbox-strict-fields -O
+:l
+:l ../Test
+
+let s = S2 'a' 'b'
+seq s ()
+:p s
+
diff --git a/testsuite/tests/ghci.debugger/scripts/print007.stderr b/testsuite/tests/ghci.debugger/scripts/print007.stderr
new file mode 100644
index 0000000000..713c629818
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print007.stderr
@@ -0,0 +1,3 @@
+
+<no location info>:
+ Warning: -O conflicts with --interactive; -O ignored.
diff --git a/testsuite/tests/ghci.debugger/scripts/print007.stdout b/testsuite/tests/ghci.debugger/scripts/print007.stdout
new file mode 100644
index 0000000000..1498fe1ae1
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print007.stdout
@@ -0,0 +1,6 @@
+()
+s = S2 'a' 'b'
+()
+s = S2 'a' 'b'
+()
+s = S2 'a' 'b'
diff --git a/testsuite/tests/ghci.debugger/scripts/print008.script b/testsuite/tests/ghci.debugger/scripts/print008.script
new file mode 100644
index 0000000000..52ca7dc857
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print008.script
@@ -0,0 +1,14 @@
+--Handling of polymorphic types:
+-- testing that tyvars are instantiated to unknown
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+let t = O (map Just [[1,1],[2,2]])
+
+:p t
+:t _t1
+seq _t1 ()
+:p t
+seq _t2 ()
+:p t
+:t _t4 \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print008.stdout b/testsuite/tests/ghci.debugger/scripts/print008.stdout
new file mode 100644
index 0000000000..1b42a99ed4
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print008.stdout
@@ -0,0 +1,7 @@
+t = O (_t1::a)
+_t1 :: a
+()
+t = O ((_t2::a1) : (_t3::[a1]))
+()
+t = O (Just [(_t4::a1),(_t5::a1)] : (_t6::[Maybe [a1]]))
+_t4 :: a1
diff --git a/testsuite/tests/ghci.debugger/scripts/print009.script b/testsuite/tests/ghci.debugger/scripts/print009.script
new file mode 100644
index 0000000000..9c36e8c403
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print009.script
@@ -0,0 +1,8 @@
+-- Name generation
+-- Testing collisions
+
+let _t1 = "user value"
+let li = map Just [1..4]
+:p li
+_t1
+_t2 \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print009.stdout b/testsuite/tests/ghci.debugger/scripts/print009.stdout
new file mode 100644
index 0000000000..de29287d57
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print009.stdout
@@ -0,0 +1,3 @@
+li = (_t2::[Maybe Integer])
+"user value"
+[Just 1,Just 2,Just 3,Just 4]
diff --git a/testsuite/tests/ghci.debugger/scripts/print010.script b/testsuite/tests/ghci.debugger/scripts/print010.script
new file mode 100644
index 0000000000..4b488fa867
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print010.script
@@ -0,0 +1,12 @@
+-- Another tricky type reconstruction case
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+
+let o = O (map id [0..3])
+:p o
+seq _t1 ()
+:p o
+seq _t2 ()
+length _t3
+:p o \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print010.stdout b/testsuite/tests/ghci.debugger/scripts/print010.stdout
new file mode 100644
index 0000000000..b390d255c8
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print010.stdout
@@ -0,0 +1,6 @@
+o = O (_t1::a)
+()
+o = O ((_t2::a1) : (_t3::[a1]))
+()
+3
+o = O [0,(_t4::Integer),(_t5::Integer),(_t6::Integer)]
diff --git a/testsuite/tests/ghci.debugger/scripts/print011.script b/testsuite/tests/ghci.debugger/scripts/print011.script
new file mode 100644
index 0000000000..9d200dcaa2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print011.script
@@ -0,0 +1,13 @@
+-- Type reconstruction with newtypes involved
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+
+let i = map (Just . Just) [My 1 .. My 3]
+:p i
+seq _t1 ()
+:p i
+seq _t2 ()
+:p i
+seq _t4 ()
+:p i \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print011.stdout b/testsuite/tests/ghci.debugger/scripts/print011.stdout
new file mode 100644
index 0000000000..852312f15f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print011.stdout
@@ -0,0 +1,7 @@
+i = (_t1::[Maybe (Maybe MyInt)])
+()
+i = (_t2::Maybe (Maybe MyInt)) : (_t3::[Maybe (Maybe MyInt)])
+()
+i = Just (_t4::Maybe MyInt) : (_t5::[Maybe (Maybe MyInt)])
+()
+i = Just (Just (My 1)) : (_t6::[Maybe (Maybe MyInt)])
diff --git a/testsuite/tests/ghci.debugger/scripts/print012.script b/testsuite/tests/ghci.debugger/scripts/print012.script
new file mode 100644
index 0000000000..bda9a8fbe7
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print012.script
@@ -0,0 +1,11 @@
+:set -XGADTs -XRank2Types -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../GADT
+:a ../Test
+:m +Main
+let o = O (id foo)
+:p o
+seq _t1 ()
+:t _t1
+:p o
+seq _t4 ()
+:p o \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print012.stdout b/testsuite/tests/ghci.debugger/scripts/print012.stdout
new file mode 100644
index 0000000000..c717acc069
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print012.stdout
@@ -0,0 +1,6 @@
+o = O (_t1::a)
+()
+_t1 :: SafeList x NonEmpty
+o = O (Cons (_t4::x1) (_t5::SafeList x1 y))
+()
+o = O (Cons 3 (_t8::SafeList Integer y1))
diff --git a/testsuite/tests/ghci.debugger/scripts/print013.script b/testsuite/tests/ghci.debugger/scripts/print013.script
new file mode 100644
index 0000000000..154c1b328f
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print013.script
@@ -0,0 +1,10 @@
+-- Test handling of extra fields in the representation due to dictionaries
+
+:set -XGADTs -XRank2Types
+:l ../GADT
+
+let d = DictN 1
+:p d
+seq _t1 ()
+:p d
+:q
diff --git a/testsuite/tests/ghci.debugger/scripts/print013.stdout b/testsuite/tests/ghci.debugger/scripts/print013.stdout
new file mode 100644
index 0000000000..8ccfef5376
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print013.stdout
@@ -0,0 +1,3 @@
+d = DictN (_t13::Integer)
+()
+d = DictN (_t26::Integer)
diff --git a/testsuite/tests/ghci.debugger/scripts/print014.script b/testsuite/tests/ghci.debugger/scripts/print014.script
new file mode 100644
index 0000000000..88fce78418
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print014.script
@@ -0,0 +1,9 @@
+-- Test handling of extra fields in the representation due to existentials.
+
+:set -XGADTs -XRank2Types
+:l ../GADT
+
+let e = Exist 1
+:p e
+seq _t1 ()
+:p e
diff --git a/testsuite/tests/ghci.debugger/scripts/print014.stdout b/testsuite/tests/ghci.debugger/scripts/print014.stdout
new file mode 100644
index 0000000000..e6d9a01bd8
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print014.stdout
@@ -0,0 +1,3 @@
+e = Exist (_t1::a)
+()
+e = Exist 1
diff --git a/testsuite/tests/ghci.debugger/scripts/print015.script b/testsuite/tests/ghci.debugger/scripts/print015.script
new file mode 100644
index 0000000000..6fdcca9b56
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print015.script
@@ -0,0 +1,8 @@
+--
+
+let li = map Just (1 : undefined)
+:p li
+head li
+:p li
+:force li
+:p li
diff --git a/testsuite/tests/ghci.debugger/scripts/print015.stdout b/testsuite/tests/ghci.debugger/scripts/print015.stdout
new file mode 100644
index 0000000000..cc037e9ba7
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print015.stdout
@@ -0,0 +1,5 @@
+li = (_t1::[Maybe Integer])
+Just 1
+li = Just 1 : (_t2::[Maybe Integer])
+*** Exception: Prelude.undefined
+*** Exception: Prelude.undefined
diff --git a/testsuite/tests/ghci.debugger/scripts/print016.script b/testsuite/tests/ghci.debugger/scripts/print016.script
new file mode 100644
index 0000000000..1f5f153892
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print016.script
@@ -0,0 +1,10 @@
+-- Type reconstruction with newtypes involved, more gruesome.
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+let a = map MkT [1..2]
+:p a
+seq _t1 ()
+:p a
+seq _t2 ()
+:p a \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print016.stdout b/testsuite/tests/ghci.debugger/scripts/print016.stdout
new file mode 100644
index 0000000000..ec894b5162
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print016.stdout
@@ -0,0 +1,5 @@
+a = (_t1::[MkT Integer])
+()
+a = (_t2::MkT Integer) : (_t3::[MkT Integer])
+()
+a = MkT 1 : (_t4::[MkT Integer])
diff --git a/testsuite/tests/ghci.debugger/scripts/print017.script b/testsuite/tests/ghci.debugger/scripts/print017.script
new file mode 100644
index 0000000000..7a8371a2c1
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print017.script
@@ -0,0 +1,12 @@
+-- More newtypes goodness
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+let a = map (MkT2 . MkT) [1..2]
+:p a
+seq _t1 ()
+:p a
+seq _t2 ()
+:p a
+seq _t4 ()
+:p a
diff --git a/testsuite/tests/ghci.debugger/scripts/print017.stdout b/testsuite/tests/ghci.debugger/scripts/print017.stdout
new file mode 100644
index 0000000000..4d38a041c4
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print017.stdout
@@ -0,0 +1,7 @@
+a = (_t1::[MkT2 Integer])
+()
+a = (_t2::MkT2 Integer) : (_t3::[MkT2 Integer])
+()
+a = MkT2 (MkT 1) : (_t4::[MkT2 Integer])
+()
+a = MkT2 (MkT 1) : (_t5::MkT2 Integer) : (_t6::[MkT2 Integer])
diff --git a/testsuite/tests/ghci.debugger/scripts/print018.script b/testsuite/tests/ghci.debugger/scripts/print018.script
new file mode 100644
index 0000000000..695dfca291
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print018.script
@@ -0,0 +1,15 @@
+-- Test type reconstruction of Constants
+-- Found by Bernie Pope
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+
+:break poly
+poly Unary
+:step
+:p x
+:t x
+seq x ()
+:p x
+:t x
+x
diff --git a/testsuite/tests/ghci.debugger/scripts/print018.stderr b/testsuite/tests/ghci.debugger/scripts/print018.stderr
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print018.stderr
diff --git a/testsuite/tests/ghci.debugger/scripts/print018.stdout b/testsuite/tests/ghci.debugger/scripts/print018.stdout
new file mode 100644
index 0000000000..26861305f3
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print018.stdout
@@ -0,0 +1,12 @@
+Breakpoint 0 activated at ../Test.hs:40:1-17
+Stopped at ../Test.hs:40:1-17
+_result :: () = _
+Stopped at ../Test.hs:40:10-17
+_result :: () = _
+x :: a = _
+x = (_t1::a)
+x :: a
+()
+x = Unary
+x :: Unary
+Unary
diff --git a/testsuite/tests/ghci.debugger/scripts/print019.script b/testsuite/tests/ghci.debugger/scripts/print019.script
new file mode 100644
index 0000000000..a7653720d6
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print019.script
@@ -0,0 +1,11 @@
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+let a = O (id 'a')
+let b = O (id "abc")
+:p a
+:p b
+seq _t1 ()
+:p _t1
+:show bindings
+_t2
+-- bogus!! _t2 has been resolved to type Char
diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stderr b/testsuite/tests/ghci.debugger/scripts/print019.stderr
new file mode 100644
index 0000000000..dcf63dd07e
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr
@@ -0,0 +1,7 @@
+
+<interactive>:1:1:
+ Ambiguous type variable `a1' in the constraint:
+ (Show a1) arising from a use of `print'
+ Cannot resolve unknown runtime types: a1
+ Use :print or :force to determine these types
+ In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stdout b/testsuite/tests/ghci.debugger/scripts/print019.stdout
new file mode 100644
index 0000000000..9c48d11d8d
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print019.stdout
@@ -0,0 +1,9 @@
+a = O (_t1::a)
+b = O (_t2::a1)
+()
+_t1 = 'a'
+_t1 :: Char = 'a'
+_t2 :: a1 = _
+a :: Opaque = O 'a'
+b :: Opaque = O _
+it :: () = ()
diff --git a/testsuite/tests/ghci.debugger/scripts/print020.script b/testsuite/tests/ghci.debugger/scripts/print020.script
new file mode 100644
index 0000000000..e0101955cb
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print020.script
@@ -0,0 +1,5 @@
+:set -fno-warn-overlapping-patterns
+:l ../HappyTest.hs
+:break lexer
+main
+:force _result
diff --git a/testsuite/tests/ghci.debugger/scripts/print020.stdout b/testsuite/tests/ghci.debugger/scripts/print020.stdout
new file mode 100644
index 0000000000..ee10c3a575
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print020.stdout
@@ -0,0 +1,14 @@
+Breakpoint 0 activated at ../HappyTest.hs:(229,0)-(240,34)
+Stopped at ../HappyTest.hs:(229,0)-(240,34)
+_result :: [Token] = _
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+*** Ignoring breakpoint
+_result = [TokenInt 1,TokenPlus,TokenInt 2,TokenPlus,TokenInt 3]
diff --git a/testsuite/tests/ghci.debugger/scripts/print021.hs b/testsuite/tests/ghci.debugger/scripts/print021.hs
new file mode 100644
index 0000000000..7c3962d803
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print021.hs
@@ -0,0 +1,18 @@
+-- Test that we can recover unicode DataCons in :print
+data T
+ = À -- latin
+ | Α -- greek
+ | Ⴀ -- georgian
+ | Ϣ -- coptic
+ | А -- cyrillic
+ | Ա -- armenian
+ deriving Show
+
+test =
+ [ À -- latin
+ , Α -- greek
+ , Ⴀ -- georgian
+ , Ϣ -- coptic
+ , А -- cyrillic
+ , Ա -- armenian
+ ]
diff --git a/testsuite/tests/ghci.debugger/scripts/print021.script b/testsuite/tests/ghci.debugger/scripts/print021.script
new file mode 100644
index 0000000000..58846cb64a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print021.script
@@ -0,0 +1,3 @@
+:l print021.hs
+:print test
+:force test
diff --git a/testsuite/tests/ghci.debugger/scripts/print021.stdout b/testsuite/tests/ghci.debugger/scripts/print021.stdout
new file mode 100644
index 0000000000..4ebd63ee4a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print021.stdout
@@ -0,0 +1,2 @@
+test = (_t1::[T])
+test = [À,Α,Ⴀ,Ϣ,А,Ա]
diff --git a/testsuite/tests/ghci.debugger/scripts/print022.hs b/testsuite/tests/ghci.debugger/scripts/print022.hs
new file mode 100644
index 0000000000..f83873e5ea
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print022.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE MagicHash #-}
+import GHC.Exts
+data T = C Int# Word# Float# Double# Char# Int Float Double
+test = C 1# 32## 1.2# 1.23## 'x'# 1 1.2 1.23
+
+data TwoFields = TwoFields Char Int deriving Show
+
+data T2 = C2 {-# UNPACK #-} !Int {-#UNPACK#-} !Word {-# UNPACK #-} !TwoFields deriving Show
+test2 = C2 1 32 (TwoFields 'a' 3)
+
+f x = x \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print022.script b/testsuite/tests/ghci.debugger/scripts/print022.script
new file mode 100644
index 0000000000..cfed80380e
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print022.script
@@ -0,0 +1,9 @@
+-- test for unboxed fields in datatypes
+:l print022.hs
+seq test ()
+:print test
+:break f
+f test2
+:step
+:fo x
+:t x \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print022.stdout b/testsuite/tests/ghci.debugger/scripts/print022.stdout
new file mode 100644
index 0000000000..8aa539418a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print022.stdout
@@ -0,0 +1,10 @@
+()
+test = C 1 32 1.2 1.23 'x' 1 1.2 1.23
+Breakpoint 0 activated at print022.hs:11:1-7
+Stopped at print022.hs:11:1-7
+_result :: t = _
+Stopped at print022.hs:11:7
+_result :: t = _
+x :: t = _
+x = C2 1 (W# 32) (TwoFields 'a' 3)
+x :: T2
diff --git a/testsuite/tests/ghci.debugger/scripts/print023.script b/testsuite/tests/ghci.debugger/scripts/print023.script
new file mode 100644
index 0000000000..434b8df4af
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print023.script
@@ -0,0 +1,8 @@
+-- Another type reconstruction with newtypes test
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+
+let a = MkT [1..2]
+seq a ()
+:p a
diff --git a/testsuite/tests/ghci.debugger/scripts/print023.stdout b/testsuite/tests/ghci.debugger/scripts/print023.stdout
new file mode 100644
index 0000000000..ef8d3c18fa
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print023.stdout
@@ -0,0 +1,2 @@
+()
+a = MkT (1 : (_t1::[Integer]))
diff --git a/testsuite/tests/ghci.debugger/scripts/print024.script b/testsuite/tests/ghci.debugger/scripts/print024.script
new file mode 100644
index 0000000000..d617ecaaa0
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print024.script
@@ -0,0 +1,10 @@
+-- stg_ap_rep exception after using :print with newtypes
+
+:set -XExistentialQuantification -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../Test
+
+let a = MkT 1
+seq a ()
+:p a
+a
+-- Bang! "internal error: stg_ap_p_ret", triggered by the evaluation of a
diff --git a/testsuite/tests/ghci.debugger/scripts/print024.stdout b/testsuite/tests/ghci.debugger/scripts/print024.stdout
new file mode 100644
index 0000000000..021fa5c98a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print024.stdout
@@ -0,0 +1,3 @@
+()
+a = MkT 1
+MkT 1
diff --git a/testsuite/tests/ghci.debugger/scripts/print025.hs b/testsuite/tests/ghci.debugger/scripts/print025.hs
new file mode 100644
index 0000000000..c2898bfa8e
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print025.hs
@@ -0,0 +1,2 @@
+data T a s = T a deriving Show
+f x = x
diff --git a/testsuite/tests/ghci.debugger/scripts/print025.script b/testsuite/tests/ghci.debugger/scripts/print025.script
new file mode 100644
index 0000000000..926890f4bc
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print025.script
@@ -0,0 +1,8 @@
+:l print025
+let i = T (1::Int)
+i
+:break f
+f i
+-- RTTI happens implicitly when the bindings at f come into context
+:step
+:step \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print025.stdout b/testsuite/tests/ghci.debugger/scripts/print025.stdout
new file mode 100644
index 0000000000..b2fcf65b1b
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print025.stdout
@@ -0,0 +1,8 @@
+T 1
+Breakpoint 0 activated at print025.hs:2:1-7
+Stopped at print025.hs:2:1-7
+_result :: t = _
+Stopped at print025.hs:2:7
+_result :: T Int s = _
+x :: T Int s = T 1
+T 1
diff --git a/testsuite/tests/ghci.debugger/scripts/print026.script b/testsuite/tests/ghci.debugger/scripts/print026.script
new file mode 100644
index 0000000000..de31983f1d
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print026.script
@@ -0,0 +1,8 @@
+-- test -fno-debug-with-show
+
+:m +Data.Sequence
+let l = fromList "abc"
+l
+:p l
+:set -fprint-evld-with-show
+:p l \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print026.stdout b/testsuite/tests/ghci.debugger/scripts/print026.stdout
new file mode 100644
index 0000000000..decc3dfb6d
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print026.stdout
@@ -0,0 +1,6 @@
+fromList "abc"
+l = Data.Sequence.Seq (Data.Sequence.Deep
+ 3 (Data.Sequence.One (Data.Sequence.Elem 'a')) Data.Sequence.Empty
+ (Data.Sequence.Two
+ (Data.Sequence.Elem 'b') (Data.Sequence.Elem 'c')))
+l = fromList "abc"
diff --git a/testsuite/tests/ghci.debugger/scripts/print027.script b/testsuite/tests/ghci.debugger/scripts/print027.script
new file mode 100644
index 0000000000..b8c7238148
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print027.script
@@ -0,0 +1,8 @@
+-- #1827 - Printing overloaded values
+
+:print (+)
+:print print
+:print log
+:print head
+:print tail
+:print fst \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print027.stdout b/testsuite/tests/ghci.debugger/scripts/print027.stdout
new file mode 100644
index 0000000000..38c46a9118
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print027.stdout
@@ -0,0 +1,6 @@
++ = (_t1::forall a. Num a => a -> a -> a)
+print = (_t2::forall a. Show a => a -> IO ())
+log = (_t3::forall a. Floating a => a -> a)
+head = (_t4::forall a. [a] -> a)
+tail = (_t5::forall a. [a] -> [a])
+fst = (_t6::forall a b. (a, b) -> a)
diff --git a/testsuite/tests/ghci.debugger/scripts/print028.script b/testsuite/tests/ghci.debugger/scripts/print028.script
new file mode 100644
index 0000000000..0beb8bf725
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print028.script
@@ -0,0 +1,8 @@
+:m + Data.IORef
+
+let l = map Just [1..10]
+:p l
+head l
+r <- newIORef l
+:p r
+:sp r \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print028.stdout b/testsuite/tests/ghci.debugger/scripts/print028.stdout
new file mode 100644
index 0000000000..93a80bc69d
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print028.stdout
@@ -0,0 +1,6 @@
+l = (_t1::[Maybe Integer])
+Just 1
+r = GHC.IORef.IORef (GHC.STRef.STRef
+ (GHC.Prim.MutVar# (Just 1 : (_t2::[Maybe Integer]))))
+r = GHC.IORef.IORef (GHC.STRef.STRef
+ (GHC.Prim.MutVar# (Just 1 : _)))
diff --git a/testsuite/tests/ghci.debugger/scripts/print029.hs b/testsuite/tests/ghci.debugger/scripts/print029.hs
new file mode 100644
index 0000000000..23eb61bb5b
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print029.hs
@@ -0,0 +1,7 @@
+newtype MkT2 a = MkT2 [Maybe a] deriving Show
+
+f :: t Int -> t Int
+f x = x
+
+f2 :: t Int -> t Int -> (t Int, t Int)
+f2 x y = (x,y) \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print029.script b/testsuite/tests/ghci.debugger/scripts/print029.script
new file mode 100644
index 0000000000..b320153d17
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print029.script
@@ -0,0 +1,10 @@
+:l print029.hs
+let a = MkT2 [Just (1::Int)]
+a
+:break f
+f a
+:step
+-- Unsound! A false type is assigned to x
+-- reconstructType decides to stop too soon because
+-- its BFS has recovered a monomorphic type
+:p x \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print029.stdout b/testsuite/tests/ghci.debugger/scripts/print029.stdout
new file mode 100644
index 0000000000..366d1d480a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print029.stdout
@@ -0,0 +1,8 @@
+MkT2 [Just 1]
+Breakpoint 0 activated at print029.hs:4:1-7
+MkT2 Stopped at print029.hs:4:1-7
+_result :: t Int = _
+Stopped at print029.hs:4:7
+_result :: t Int = _
+x :: t Int = [Just 1]
+x = [Just 1]
diff --git a/testsuite/tests/ghci.debugger/scripts/print030.script b/testsuite/tests/ghci.debugger/scripts/print030.script
new file mode 100644
index 0000000000..9296c90163
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print030.script
@@ -0,0 +1,10 @@
+:l print029.hs
+let a = MkT2 (map Just [(1::Int)])
+:break f
+seq a ()
+f a
+:step
+-- Unsound! A false type is assigned to x
+-- reconstructType is forced to stop too soon
+-- because the elements of the list in x are not evaluated yet
+:q
diff --git a/testsuite/tests/ghci.debugger/scripts/print030.stdout b/testsuite/tests/ghci.debugger/scripts/print030.stdout
new file mode 100644
index 0000000000..a67d0492d2
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print030.stdout
@@ -0,0 +1,7 @@
+Breakpoint 0 activated at print029.hs:4:1-7
+()
+MkT2 Stopped at print029.hs:4:1-7
+_result :: t Int = _
+Stopped at print029.hs:4:7
+_result :: t Int = _
+x :: t Int = _ : _
diff --git a/testsuite/tests/ghci.debugger/scripts/print031.hs b/testsuite/tests/ghci.debugger/scripts/print031.hs
new file mode 100644
index 0000000000..c64c786b89
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print031.hs
@@ -0,0 +1,7 @@
+module Print031 where
+
+newtype MkT2 a = MkT2 [Maybe a] deriving Show
+data Phantom a = Phantom Int deriving Show
+
+f :: t (Phantom a) -> Bool
+f x = const False x -- const just to bring x into scope \ No newline at end of file
diff --git a/testsuite/tests/ghci.debugger/scripts/print031.script b/testsuite/tests/ghci.debugger/scripts/print031.script
new file mode 100644
index 0000000000..fb6308ffcf
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print031.script
@@ -0,0 +1,10 @@
+:l print031.hs
+let a = MkT2 [Just (Phantom 1)]
+:break f
+a
+f a
+:step
+-- ghc crashes now when the type for x is recovered
+-- and unifyRTTI fails to compute a substitution
+:p x
+:q
diff --git a/testsuite/tests/ghci.debugger/scripts/print031.stdout b/testsuite/tests/ghci.debugger/scripts/print031.stdout
new file mode 100644
index 0000000000..529b6987b5
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print031.stdout
@@ -0,0 +1,8 @@
+Breakpoint 0 activated at print031.hs:7:1-19
+MkT2 [Just (Phantom 1)]
+Stopped at print031.hs:7:1-19
+_result :: Bool = _
+Stopped at print031.hs:7:7-19
+_result :: Bool = _
+x :: t (Phantom a) = [Just (Phantom 1)]
+x = [Just (Phantom 1)]
diff --git a/testsuite/tests/ghci.debugger/scripts/print032.script b/testsuite/tests/ghci.debugger/scripts/print032.script
new file mode 100644
index 0000000000..fa872af5d3
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print032.script
@@ -0,0 +1,8 @@
+:l print029.hs
+let a = MkT2 [Just (1::Int)]
+a
+let b = MkT2 (map Just [2::Int]) -- Want to obtain a thunk
+:break f2
+f2 a b
+:step
+
diff --git a/testsuite/tests/ghci.debugger/scripts/print032.stdout b/testsuite/tests/ghci.debugger/scripts/print032.stdout
new file mode 100644
index 0000000000..5b84fd7c6d
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print032.stdout
@@ -0,0 +1,8 @@
+MkT2 [Just 1]
+Breakpoint 0 activated at print029.hs:7:0-13
+Stopped at print029.hs:7:0-13
+_result :: (t Int, t Int) = _
+Stopped at print029.hs:7:9-13
+_result :: (t Int, t Int) = _
+x :: [Maybe Int] = [Just 1]
+y :: [Maybe Int] = _
diff --git a/testsuite/tests/ghci.debugger/scripts/print033.script b/testsuite/tests/ghci.debugger/scripts/print033.script
new file mode 100644
index 0000000000..fed81fe3de
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print033.script
@@ -0,0 +1,5 @@
+-- Resolving an impredicative type
+:set -XImpredicativeTypes -fno-warn-deprecated-flags
+:m + Control.Monad.ST
+let u = undefined :: ST s (forall s'. ST s' a)
+:p u
diff --git a/testsuite/tests/ghci.debugger/scripts/print033.stdout b/testsuite/tests/ghci.debugger/scripts/print033.stdout
new file mode 100644
index 0000000000..e60df0905a
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print033.stdout
@@ -0,0 +1 @@
+u = (_t1::forall s a. ST s (forall s'. ST s' a))
diff --git a/testsuite/tests/ghci.debugger/scripts/print034.script b/testsuite/tests/ghci.debugger/scripts/print034.script
new file mode 100644
index 0000000000..95bcfde0a6
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print034.script
@@ -0,0 +1,11 @@
+-- More GADT goodness
+
+:set -XGADTs -XRank2Types -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
+:l ../GADT
+:a ../Test
+:m +Main
+let o = O (One False Main.Nil)
+:p o
+seq _t1 ()
+:t _t1
+:p o
diff --git a/testsuite/tests/ghci.debugger/scripts/print034.stdout b/testsuite/tests/ghci.debugger/scripts/print034.stdout
new file mode 100644
index 0000000000..5d83c8c9b7
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/print034.stdout
@@ -0,0 +1,4 @@
+o = O (_t1::a)
+()
+_t1 :: SafeList Bool NonEmpty
+o = O (One False (_t4::SafeList Bool Empty))
diff --git a/testsuite/tests/ghci.debugger/scripts/result001.hs b/testsuite/tests/ghci.debugger/scripts/result001.hs
new file mode 100644
index 0000000000..a32e2c10fa
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/result001.hs
@@ -0,0 +1,3 @@
+f xs = case map id xs of
+ [] -> True
+ x:xs -> False
diff --git a/testsuite/tests/ghci.debugger/scripts/result001.script b/testsuite/tests/ghci.debugger/scripts/result001.script
new file mode 100644
index 0000000000..c5714fe781
--- /dev/null
+++ b/testsuite/tests/ghci.debugger/scripts/result001.script
@@ -0,0 +1,5 @@
+-- demonstrates that _result has the wrong type sometimes
+:l result001
+:b 1 20
+f "abc"
+-- _result :: Bool is wrong, should be [a]