summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorEric Seidel <gridaphobe@gmail.com>2015-09-21 19:18:56 -0500
committerAustin Seipp <austin@well-typed.com>2015-09-21 19:24:47 -0500
commit0b852fcf74c65291aeb6357973ecb715735d6383 (patch)
treed92dddac04d543cb5811a4f689649ef846375f15 /libraries
parent83e23c1a4cce36de68c3c8323d27f24182b33f34 (diff)
downloadhaskell-0b852fcf74c65291aeb6357973ecb715735d6383.tar.gz
base: use Show for ErrorCall in uncaughtExceptionHandler
The default top-level exception handler now uses the `Show` instance for `ErrorCall` when printing exceptions, so it will actually print the out-of-band data (e.g. `CallStack`s) in compiled binaries, instead of just printing the error message. This also updates the hpc submodule to fix the test output. Reviewed By: austin, thomie Differential Revision: https://phabricator.haskell.org/D1217
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/GHC/Conc/Sync.hs4
-rw-r--r--libraries/base/tests/all.T4
-rw-r--r--libraries/base/tests/readFloat.stderr2
-rw-r--r--libraries/base/tests/topHandler04.hs5
-rw-r--r--libraries/base/tests/topHandler04.stderr2
m---------libraries/hpc0
6 files changed, 14 insertions, 3 deletions
diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs
index 48a3b2a4c6..c417226da9 100644
--- a/libraries/base/GHC/Conc/Sync.hs
+++ b/libraries/base/GHC/Conc/Sync.hs
@@ -875,9 +875,7 @@ uncaughtExceptionHandler = unsafePerformIO (newIORef defaultHandler)
(hFlush stdout) `catchAny` (\ _ -> return ())
let msg = case cast ex of
Just Deadlock -> "no threads to run: infinite loop or deadlock?"
- _ -> case cast ex of
- Just (ErrorCall s) -> s
- _ -> showsPrec 0 se ""
+ _ -> showsPrec 0 se ""
withCString "%s" $ \cfmt ->
withCString msg $ \cmsg ->
errorBelch cfmt cmsg
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index 96cb551a26..f53ad0cb80 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -162,6 +162,10 @@ test('topHandler03',
ignore_output,
signal_exit_code(15)
], compile_and_run, [''])
+test('topHandler04',
+ [when(opsys('mingw32'), skip),
+ exit_code(1)
+ ], compile_and_run, [''])
test('T8766',
diff --git a/libraries/base/tests/readFloat.stderr b/libraries/base/tests/readFloat.stderr
index 929906187e..99049a35b7 100644
--- a/libraries/base/tests/readFloat.stderr
+++ b/libraries/base/tests/readFloat.stderr
@@ -1 +1,3 @@
readFloat: Prelude.read: no parse
+CallStack:
+ error, called at libraries/base/Text/Read.hs:90:17 in base:Text.Read
diff --git a/libraries/base/tests/topHandler04.hs b/libraries/base/tests/topHandler04.hs
new file mode 100644
index 0000000000..ae669a07b4
--- /dev/null
+++ b/libraries/base/tests/topHandler04.hs
@@ -0,0 +1,5 @@
+import Control.Exception
+
+-- test that the out-of-band data in an ErrorCall exception is printed
+
+main = throw (ErrorCallWithLocation "error" "out-of-band")
diff --git a/libraries/base/tests/topHandler04.stderr b/libraries/base/tests/topHandler04.stderr
new file mode 100644
index 0000000000..e9bba9e480
--- /dev/null
+++ b/libraries/base/tests/topHandler04.stderr
@@ -0,0 +1,2 @@
+topHandler04: error
+out-of-band
diff --git a/libraries/hpc b/libraries/hpc
-Subproject 315b78ac8fe7b42912d2146783b0366f6b0e950
+Subproject 886429bf84097bbc16cdb6602b60ba1b9156cf6