Hannes Siebenhandl pushed to branch wip/fendor/stack-annotation-ty at Glasgow Haskell Compiler / GHC
Commits:
19 changed files:
- libraries/ghc-experimental/src/GHC/Stack/Annotation/Experimental.hs
- + libraries/ghc-experimental/tests/Makefile
- + libraries/ghc-experimental/tests/all.T
- + libraries/ghc-experimental/tests/backtraces/Makefile
- + libraries/ghc-experimental/tests/backtraces/T26806a.hs
- + libraries/ghc-experimental/tests/backtraces/T26806a.stderr
- + libraries/ghc-experimental/tests/backtraces/T26806b.hs
- + libraries/ghc-experimental/tests/backtraces/T26806b.stderr
- + libraries/ghc-experimental/tests/backtraces/T26806c.hs
- + libraries/ghc-experimental/tests/backtraces/T26806c.stderr
- + libraries/ghc-experimental/tests/backtraces/all.T
- libraries/ghc-internal/src/GHC/Internal/Stack/Annotation.hs
- libraries/ghc-internal/tests/stack-annotation/ann_frame001.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame002.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame003.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame004.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
Changes:
| ... | ... | @@ -82,9 +82,6 @@ import GHC.Internal.Stack.Annotation |
| 82 | 82 | -- the pure variations can behave in ways that are hard to predict.
|
| 83 | 83 | --
|
| 84 | 84 | -- See Note [Stack annotations in pure code] for more details.
|
| 85 | ---
|
|
| 86 | --- At last, stack annotations are tricky to use with 'error'.
|
|
| 87 | --- See Note [Pushing annotation frames on 'error'] for why this is the case.
|
|
| 88 | 85 | |
| 89 | 86 | -- Note [Stack annotations in pure code]
|
| 90 | 87 | -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ... | ... | @@ -96,57 +93,50 @@ import GHC.Internal.Stack.Annotation |
| 96 | 93 | -- For example:
|
| 97 | 94 | --
|
| 98 | 95 | -- @
|
| 99 | --- annotateStackShow (5 @Int) (fib 20 + throw (ErrorCall "Oh no!"))
|
|
| 96 | +-- annotateStackShow (5 @Int) (fib 20 + error "Oh no!")
|
|
| 100 | 97 | -- @
|
| 101 | 98 | --
|
| 102 | --- Without forcing the result of @(fib 20 + throw (ErrorCall "Oh no!"))@, the computation
|
|
| 99 | +-- Without forcing the result of @(fib 20 + error "Oh no!")@, the computation
|
|
| 103 | 100 | -- will simply return a thunk, and the stack annotation would be popped off the stack.
|
| 104 | 101 | -- Once the thunk is evaluated, the exception is raised, but no stack annotation will be found!
|
| 105 | --- If we force the result of @(fib 20 + throw (ErrorCall "Oh no!"))@, then the stack
|
|
| 102 | +-- If we force the result of @(fib 20 + error "Oh no!")@, then the stack
|
|
| 106 | 103 | -- annotations remain on the stack, and are displayed in the stack trace.
|
| 107 | 104 | --
|
| 108 | 105 | -- Naturally, this only holds if no imprecise exceptions are thrown during evaluation of any
|
| 109 | 106 | -- nested value, for example in 'annotateStackShow 5 (Just $ throw (ErrorCall "Oh no!"))', the
|
| 110 | 107 | -- stack trace will not include the value @5@.
|
| 111 | 108 | --
|
| 112 | --- See how we preferred @throw (ErrorCall ...)@ over @error@?
|
|
| 113 | --- See Note [Pushing annotation frames on 'error'] for why we do this.
|
|
| 114 | - |
|
| 115 | --- Note [Pushing annotation frames on 'error']
|
|
| 116 | --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| 117 | --- Examples so far have not been using 'error' at all.
|
|
| 118 | --- The reason is that 'error' is extraordinarily difficult to use correctly with stack annotation frames.
|
|
| 119 | --- See Note [Capturing the backtrace in throw] for a detailed discussion of how 'throw'
|
|
| 120 | --- manages to capture 'Backtraces'.
|
|
| 121 | ---
|
|
| 122 | --- Long story short, 'error' does not do the same thing as 'throw' and is subtly different
|
|
| 123 | --- in terms of evaluation, cause it to bypass the stack annotation frames, especially in
|
|
| 124 | --- pure code.
|
|
| 125 | ---
|
|
| 126 | --- However, even in 'IO' code, it is difficult to use 'error' and obtain stack annotation frames
|
|
| 127 | --- close to the call site due to the same issue of laziness and backtrace collection.
|
|
| 128 | ---
|
|
| 129 | --- This means, right now, if you want to reliably capture stack frame annotations,
|
|
| 130 | --- in both pure and impure code, prefer 'throw' and 'throwIO' variants over 'error'.
|
|
| 131 | 109 | |
| 132 | 110 | -- ----------------------------------------------------------------------------
|
| 133 | 111 | -- Annotations
|
| 134 | 112 | -- ----------------------------------------------------------------------------
|
| 135 | 113 | |
| 114 | + |
|
| 115 | +-- | A 'String' only annotation with an optional source location.
|
|
| 136 | 116 | data StringAnnotation where
|
| 137 | - StringAnnotation :: String -> StringAnnotation
|
|
| 117 | + StringAnnotation :: !(Maybe SrcLoc) -> String -> StringAnnotation
|
|
| 138 | 118 | |
| 139 | 119 | instance StackAnnotation StringAnnotation where
|
| 140 | - displayStackAnnotation (StringAnnotation str) = str
|
|
| 120 | + displayStackAnnotationShort (StringAnnotation _srcLoc str) =
|
|
| 121 | + str
|
|
| 122 | + |
|
| 123 | + stackAnnotationSourceLocation (StringAnnotation srcLoc _str) =
|
|
| 124 | + srcLoc
|
|
| 141 | 125 | |
| 142 | 126 | -- | Use the 'Show' instance of a type to display as the 'StackAnnotation'.
|
| 143 | 127 | data ShowAnnotation where
|
| 144 | - ShowAnnotation :: forall a . Show a => a -> ShowAnnotation
|
|
| 128 | + ShowAnnotation :: forall a . Show a => !(Maybe SrcLoc) -> a -> ShowAnnotation
|
|
| 145 | 129 | |
| 146 | 130 | instance StackAnnotation ShowAnnotation where
|
| 147 | - displayStackAnnotation (ShowAnnotation showAnno) = show showAnno
|
|
| 131 | + displayStackAnnotationShort (ShowAnnotation _srcLoc showAnno) =
|
|
| 132 | + show showAnno
|
|
| 133 | + |
|
| 134 | + stackAnnotationSourceLocation (ShowAnnotation srcLoc _showAnno) =
|
|
| 135 | + srcLoc
|
|
| 148 | 136 | |
| 149 | 137 | -- | A 'CallStack' stack annotation.
|
| 138 | +--
|
|
| 139 | +-- Captures the whole 'CallStack'.
|
|
| 150 | 140 | newtype CallStackAnnotation = CallStackAnnotation CallStack
|
| 151 | 141 | |
| 152 | 142 | instance Show CallStackAnnotation where
|
| ... | ... | @@ -154,9 +144,23 @@ instance Show CallStackAnnotation where |
| 154 | 144 | |
| 155 | 145 | -- | Displays the first entry of the 'CallStack'
|
| 156 | 146 | instance StackAnnotation CallStackAnnotation where
|
| 157 | - displayStackAnnotation (CallStackAnnotation cs) = case getCallStack cs of
|
|
| 147 | + stackAnnotationSourceLocation (CallStackAnnotation cs) =
|
|
| 148 | + callStackHeadSrcLoc cs
|
|
| 149 | + |
|
| 150 | + displayStackAnnotationShort (CallStackAnnotation cs) =
|
|
| 151 | + callStackHeadFunctionName cs
|
|
| 152 | + |
|
| 153 | +callStackHeadSrcLoc :: CallStack -> Maybe SrcLoc
|
|
| 154 | +callStackHeadSrcLoc cs =
|
|
| 155 | + case getCallStack cs of
|
|
| 156 | + [] -> Nothing
|
|
| 157 | + (_, srcLoc):_ -> Just srcLoc
|
|
| 158 | + |
|
| 159 | +callStackHeadFunctionName :: CallStack -> String
|
|
| 160 | +callStackHeadFunctionName cs =
|
|
| 161 | + case getCallStack cs of
|
|
| 158 | 162 | [] -> "<unknown source location>"
|
| 159 | - ((fnName,srcLoc):_) -> fnName ++ ", called at " ++ prettySrcLoc srcLoc
|
|
| 163 | + (fnName, _):_ -> fnName
|
|
| 160 | 164 | |
| 161 | 165 | -- ----------------------------------------------------------------------------
|
| 162 | 166 | -- Annotate the CallStack with custom data
|
| ... | ... | @@ -172,7 +176,7 @@ instance StackAnnotation CallStackAnnotation where |
| 172 | 176 | --
|
| 173 | 177 | -- WARNING: forces the evaluation of @b@ to WHNF.
|
| 174 | 178 | {-# NOINLINE annotateStack #-}
|
| 175 | -annotateStack :: forall a b. (Typeable a, StackAnnotation a) => a -> b -> b
|
|
| 179 | +annotateStack :: forall a b. (HasCallStack, Typeable a, StackAnnotation a) => a -> b -> b
|
|
| 176 | 180 | annotateStack ann b = unsafePerformIO $
|
| 177 | 181 | annotateStackIO ann (evaluate b)
|
| 178 | 182 | |
| ... | ... | @@ -196,9 +200,9 @@ annotateCallStack b = unsafePerformIO $ withFrozenCallStack $ |
| 196 | 200 | -- information to stack traces.
|
| 197 | 201 | --
|
| 198 | 202 | -- WARNING: forces the evaluation of @b@ to WHNF.
|
| 199 | -annotateStackString :: forall b . String -> b -> b
|
|
| 203 | +annotateStackString :: forall b . HasCallStack => String -> b -> b
|
|
| 200 | 204 | annotateStackString ann =
|
| 201 | - annotateStack (StringAnnotation ann)
|
|
| 205 | + annotateStack (StringAnnotation (callStackHeadSrcLoc ?callStack) ann)
|
|
| 202 | 206 | |
| 203 | 207 | -- | @'annotateStackShow' showable b@ annotates the evaluation stack of @b@
|
| 204 | 208 | -- with the value @showable@.
|
| ... | ... | @@ -207,37 +211,36 @@ annotateStackString ann = |
| 207 | 211 | -- information to stack traces.
|
| 208 | 212 | --
|
| 209 | 213 | -- WARNING: forces the evaluation of @b@ to WHNF.
|
| 210 | -annotateStackShow :: forall a b . (Typeable a, Show a) => a -> b -> b
|
|
| 214 | +annotateStackShow :: forall a b . (HasCallStack, Typeable a, Show a) => a -> b -> b
|
|
| 211 | 215 | annotateStackShow ann =
|
| 212 | - annotateStack (ShowAnnotation ann)
|
|
| 216 | + annotateStack (ShowAnnotation (callStackHeadSrcLoc ?callStack) ann)
|
|
| 213 | 217 | |
| 214 | 218 | -- | @'annotateStackIO' showable b@ annotates the evaluation stack of @b@
|
| 215 | 219 | -- with the value @showable@.
|
| 216 | 220 | --
|
| 217 | 221 | -- When decoding the call stack, the annotation frames can be used to add more
|
| 218 | 222 | -- information to stack traces.
|
| 219 | -annotateStackIO :: forall a b . (Typeable a, StackAnnotation a) => a -> IO b -> IO b
|
|
| 223 | +annotateStackIO :: forall a b . (HasCallStack, Typeable a, StackAnnotation a) => a -> IO b -> IO b
|
|
| 220 | 224 | annotateStackIO ann (IO act) =
|
| 221 | 225 | IO $ \s -> annotateStack# (SomeStackAnnotation ann) act s
|
| 222 | -{-# NOINLINE annotateStackIO #-}
|
|
| 223 | 226 | |
| 224 | 227 | -- | @'annotateStackStringIO' msg b@ annotates the evaluation stack of @b@
|
| 225 | 228 | -- with the value @msg@.
|
| 226 | 229 | --
|
| 227 | 230 | -- When decoding the call stack, the annotation frames can be used to add more
|
| 228 | 231 | -- information to stack traces.
|
| 229 | -annotateStackStringIO :: forall b . String -> IO b -> IO b
|
|
| 232 | +annotateStackStringIO :: forall b . HasCallStack => String -> IO b -> IO b
|
|
| 230 | 233 | annotateStackStringIO ann =
|
| 231 | - annotateStackIO (StringAnnotation ann)
|
|
| 234 | + annotateStackIO (StringAnnotation (callStackHeadSrcLoc ?callStack) ann)
|
|
| 232 | 235 | |
| 233 | 236 | -- | @'annotateStackShowIO' msg b@ annotates the evaluation stack of @b@
|
| 234 | 237 | -- with the value @msg@.
|
| 235 | 238 | --
|
| 236 | 239 | -- When decoding the call stack, the annotation frames can be used to add more
|
| 237 | 240 | -- information to stack traces.
|
| 238 | -annotateStackShowIO :: forall a b . (Show a) => a -> IO b -> IO b
|
|
| 241 | +annotateStackShowIO :: forall a b . (HasCallStack, Show a) => a -> IO b -> IO b
|
|
| 239 | 242 | annotateStackShowIO ann =
|
| 240 | - annotateStackIO (ShowAnnotation ann)
|
|
| 243 | + annotateStackIO (ShowAnnotation (callStackHeadSrcLoc ?callStack) ann)
|
|
| 241 | 244 | |
| 242 | 245 | -- | @'annotateCallStackIO' b@ annotates the evaluation stack of @b@ with the
|
| 243 | 246 | -- current 'callstack'.
|
| 1 | +# This Makefile runs the tests using GHC's testsuite framework. It
|
|
| 2 | +# assumes the package is part of a GHC build tree with the testsuite
|
|
| 3 | +# installed in ../../../testsuite.
|
|
| 4 | + |
|
| 5 | +TOP=../../../testsuite
|
|
| 6 | +include $(TOP)/mk/boilerplate.mk
|
|
| 7 | +include $(TOP)/mk/test.mk |
| 1 | +# This Makefile runs the tests using GHC's testsuite framework. It
|
|
| 2 | +# assumes the package is part of a GHC build tree with the testsuite
|
|
| 3 | +# installed in ../../../testsuite.
|
|
| 4 | + |
|
| 5 | +TOP=../../../../testsuite
|
|
| 6 | +include $(TOP)/mk/boilerplate.mk
|
|
| 7 | +include $(TOP)/mk/test.mk |
| 1 | +module Main where
|
|
| 2 | + |
|
| 3 | +import GHC.Stack.Annotation.Experimental
|
|
| 4 | +import Control.Exception
|
|
| 5 | +import Control.Exception.Backtrace
|
|
| 6 | + |
|
| 7 | +main :: IO ()
|
|
| 8 | +main = do
|
|
| 9 | + setBacktraceMechanismState IPEBacktrace True
|
|
| 10 | + annotateCallStackIO $ do
|
|
| 11 | + annotateStackShowIO ([1..4] :: [Int]) $ do
|
|
| 12 | + annotateStackStringIO "Lovely annotation" $ do
|
|
| 13 | + throwIO $ ErrorCall "Backtrace Test"
|
|
| 14 | + |
| 1 | +T26806a: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
|
|
| 2 | + |
|
| 3 | +Backtrace Test
|
|
| 4 | + |
|
| 5 | +IPE backtrace:
|
|
| 6 | + Lovely annotation, called at T26806a.hs:12:7 in main:Main
|
|
| 7 | + [1,2,3,4], called at T26806a.hs:11:5 in main:Main
|
|
| 8 | + annotateCallStackIO, called at T26806a.hs:10:3 in main:Main
|
|
| 9 | +HasCallStack backtrace:
|
|
| 10 | + throwIO, called at T26806a.hs:13:9 in main:Main
|
|
| 11 | + |
| 1 | +module Main where
|
|
| 2 | + |
|
| 3 | +import GHC.Stack.Annotation.Experimental
|
|
| 4 | +import Control.Exception
|
|
| 5 | +import Control.Exception.Backtrace
|
|
| 6 | + |
|
| 7 | +main :: IO ()
|
|
| 8 | +main = do
|
|
| 9 | + setBacktraceMechanismState IPEBacktrace True
|
|
| 10 | + print $ foo 500
|
|
| 11 | + |
|
| 12 | +foo :: Int -> Int
|
|
| 13 | +foo n =
|
|
| 14 | + annotateCallStack $
|
|
| 15 | + annotateStackShow ([1..4] :: [Int]) $
|
|
| 16 | + annotateStackString "Lovely annotation" $
|
|
| 17 | + throw $ ErrorCall $ "Backtrace Test: " ++ show (n * n * n)
|
|
| 18 | + |
| 1 | +T26806b: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
|
|
| 2 | + |
|
| 3 | +Backtrace Test: 125000000
|
|
| 4 | + |
|
| 5 | +IPE backtrace:
|
|
| 6 | + Lovely annotation, called at T26806b.hs:16:7 in main:Main
|
|
| 7 | + [1,2,3,4], called at T26806b.hs:15:5 in main:Main
|
|
| 8 | + annotateCallStack, called at T26806b.hs:14:3 in main:Main
|
|
| 9 | +HasCallStack backtrace:
|
|
| 10 | + collectExceptionAnnotation, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:170:37 in ghc-internal:GHC.Internal.Exception
|
|
| 11 | + toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:90:42 in ghc-internal:GHC.Internal.Exception
|
|
| 12 | + throw, called at T26806b.hs:17:9 in main:Main
|
|
| 13 | + |
| 1 | +module Main where
|
|
| 2 | + |
|
| 3 | +import GHC.Stack.Annotation.Experimental
|
|
| 4 | +import Control.Exception
|
|
| 5 | +import Control.Exception.Backtrace
|
|
| 6 | + |
|
| 7 | +main :: IO ()
|
|
| 8 | +main = do
|
|
| 9 | + setBacktraceMechanismState IPEBacktrace True
|
|
| 10 | + print $ foo 500
|
|
| 11 | + |
|
| 12 | +foo :: Int -> Int
|
|
| 13 | +foo n =
|
|
| 14 | + annotateCallStack $
|
|
| 15 | + annotateStackShow ([1..4] :: [Int]) $
|
|
| 16 | + annotateStackString "Lovely annotation" $
|
|
| 17 | + error $ "Backtrace Test: " ++ show (n * n * n)
|
|
| 18 | + |
| 1 | +T26806c: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:
|
|
| 2 | + |
|
| 3 | +Backtrace Test: 125000000
|
|
| 4 | + |
|
| 5 | +IPE backtrace:
|
|
| 6 | + Lovely annotation, called at T26806c.hs:16:7 in main:Main
|
|
| 7 | + [1,2,3,4], called at T26806c.hs:15:5 in main:Main
|
|
| 8 | + annotateCallStack, called at T26806c.hs:14:3 in main:Main
|
|
| 9 | +HasCallStack backtrace:
|
|
| 10 | + error, called at T26806c.hs:17:9 in main:Main
|
|
| 11 | + |
| 1 | +stack_annotation_backtrace_opts = [ when(have_profiling(), extra_ways(['prof'])) , when(js_arch(), skip) , exit_code(1) ]
|
|
| 2 | + |
|
| 3 | +test('T26806a', stack_annotation_backtrace_opts, compile_and_run, [''])
|
|
| 4 | +test('T26806b', stack_annotation_backtrace_opts, compile_and_run, [''])
|
|
| 5 | +test('T26806c', stack_annotation_backtrace_opts, compile_and_run, ['']) |
| ... | ... | @@ -4,6 +4,7 @@ module GHC.Internal.Stack.Annotation where |
| 4 | 4 | |
| 5 | 5 | import GHC.Internal.Base
|
| 6 | 6 | import GHC.Internal.Data.Typeable
|
| 7 | +import GHC.Internal.Stack (SrcLoc, prettySrcLoc)
|
|
| 7 | 8 | |
| 8 | 9 | -- ----------------------------------------------------------------------------
|
| 9 | 10 | -- StackAnnotation
|
| ... | ... | @@ -13,8 +14,38 @@ import GHC.Internal.Data.Typeable |
| 13 | 14 | -- as the payload of 'AnnFrame' stack frames.
|
| 14 | 15 | --
|
| 15 | 16 | class StackAnnotation a where
|
| 17 | + -- | Display a human readable string for the 'StackAnnotation'.
|
|
| 18 | + --
|
|
| 19 | + -- This is supposed to be the long version of 'displayStackAnnotationShort'
|
|
| 20 | + -- and may contain a source location.
|
|
| 21 | + --
|
|
| 22 | + -- If not provided, 'displayStackAnnotation' is derived from 'stackAnnotationSourceLocation'
|
|
| 23 | + -- and 'displayStackAnnotationShort'.
|
|
| 16 | 24 | displayStackAnnotation :: a -> String
|
| 17 | 25 | |
| 26 | + -- | Get the 'SrcLoc' of the given 'StackAnnotation'.
|
|
| 27 | + --
|
|
| 28 | + -- This is optional, 'SrcLoc' are not strictly required for 'StackAnnotation', but
|
|
| 29 | + -- it is still heavily encouarged to provide a 'SrcLoc' for better IPE backtraces.
|
|
| 30 | + stackAnnotationSourceLocation :: a -> Maybe SrcLoc
|
|
| 31 | + |
|
| 32 | + -- | The description of the StackAnnotation without any metadata such as source locations.
|
|
| 33 | + --
|
|
| 34 | + -- Pefer implementing 'displayStackAnnotationShort' over 'displayStackAnnotation'.
|
|
| 35 | + displayStackAnnotationShort :: a -> String
|
|
| 36 | + |
|
| 37 | + {-# MINIMAL displayStackAnnotation | displayStackAnnotationShort #-}
|
|
| 38 | + |
|
| 39 | + displayStackAnnotation ann =
|
|
| 40 | + displayStackAnnotationShort ann
|
|
| 41 | + ++ case stackAnnotationSourceLocation ann of
|
|
| 42 | + Nothing -> ""
|
|
| 43 | + Just srcLoc -> ", called at " ++ prettySrcLoc srcLoc
|
|
| 44 | + |
|
| 45 | + stackAnnotationSourceLocation _ann = Nothing
|
|
| 46 | + |
|
| 47 | + displayStackAnnotationShort = displayStackAnnotation
|
|
| 48 | + |
|
| 18 | 49 | -- ----------------------------------------------------------------------------
|
| 19 | 50 | -- Annotations
|
| 20 | 51 | -- ----------------------------------------------------------------------------
|
| ... | ... | @@ -28,4 +59,11 @@ data SomeStackAnnotation where |
| 28 | 59 | SomeStackAnnotation :: forall a. (Typeable a, StackAnnotation a) => a -> SomeStackAnnotation
|
| 29 | 60 | |
| 30 | 61 | instance StackAnnotation SomeStackAnnotation where
|
| 31 | - displayStackAnnotation (SomeStackAnnotation a) = displayStackAnnotation a |
|
| 62 | + displayStackAnnotation (SomeStackAnnotation a) =
|
|
| 63 | + displayStackAnnotation a
|
|
| 64 | + |
|
| 65 | + stackAnnotationSourceLocation (SomeStackAnnotation a) =
|
|
| 66 | + stackAnnotationSourceLocation a
|
|
| 67 | + |
|
| 68 | + displayStackAnnotationShort (SomeStackAnnotation a) =
|
|
| 69 | + displayStackAnnotationShort a |
| 1 | 1 | Stack annotations:
|
| 2 | -- (2,3)
|
|
| 2 | +- (2,3), called at ann_frame001.hs:5:13 in main:Main
|
|
| 3 | 3 | 47
|
| 4 | 4 | Stack annotations:
|
| 5 | -- "bar"
|
|
| 6 | -- "foo"
|
|
| 7 | -- "tailCallEx"
|
|
| 5 | +- "bar", called at ann_frame001.hs:23:9 in main:Main
|
|
| 6 | +- "foo", called at ann_frame001.hs:21:11 in main:Main
|
|
| 7 | +- "tailCallEx", called at ann_frame001.hs:17:18 in main:Main
|
|
| 8 | 8 | Stack annotations:
|
| 9 | -- "bar"
|
|
| 10 | -- "foo"
|
|
| 11 | -- "tailCallEx"
|
|
| 9 | +- "bar", called at ann_frame001.hs:23:9 in main:Main
|
|
| 10 | +- "foo", called at ann_frame001.hs:21:11 in main:Main
|
|
| 11 | +- "tailCallEx", called at ann_frame001.hs:17:18 in main:Main
|
|
| 12 | 12 | 40 |
| ... | ... | @@ -7,5 +7,5 @@ Finish some work |
| 7 | 7 | Some more work in bar
|
| 8 | 8 | 17711
|
| 9 | 9 | Stack annotations:
|
| 10 | -- bar
|
|
| 10 | +- bar, called at ann_frame002.hs:23:29 in main:Main
|
|
| 11 | 11 | - annotateCallStackIO, called at ann_frame002.hs:23:7 in main:Main |
| 1 | 1 | 47
|
| 2 | 2 | Stack annotations:
|
| 3 | -- "bar"
|
|
| 4 | -- "foo"
|
|
| 5 | -- "tailCallEx"
|
|
| 3 | +- "bar", called at ann_frame003.hs:25:9 in main:Main
|
|
| 4 | +- "foo", called at ann_frame003.hs:21:11 in main:Main
|
|
| 5 | +- "tailCallEx", called at ann_frame003.hs:16:18 in main:Main
|
|
| 6 | 6 | 40 |
| ... | ... | @@ -13,5 +13,5 @@ Stack annotations: |
| 13 | 13 | - annotateCallStack, called at ann_frame004.hs:21:17 in main:Main
|
| 14 | 14 | - annotateCallStack, called at ann_frame004.hs:21:17 in main:Main
|
| 15 | 15 | - annotateCallStack, called at ann_frame004.hs:13:10 in main:Main
|
| 16 | -- bar
|
|
| 16 | +- bar, called at ann_frame004.hs:12:29 in main:Main
|
|
| 17 | 17 | - annotateCallStackIO, called at ann_frame004.hs:12:7 in main:Main |
| ... | ... | @@ -2,9 +2,9 @@ |
| 2 | 2 | Caught exception: SimpleBoom
|
| 3 | 3 | Exception context:
|
| 4 | 4 | - IPE backtrace:
|
| 5 | -- throwIO SimpleBoom
|
|
| 6 | -- raising action
|
|
| 7 | -- catch site for throwIO SimpleBoom
|
|
| 5 | +- throwIO SimpleBoom, called at ann_frame005.hs:33:5 in main:Main
|
|
| 6 | +- raising action, called at ann_frame005.hs:32:3 in main:Main
|
|
| 7 | +- catch site for throwIO SimpleBoom, called at ann_frame005.hs:27:5 in main:Main
|
|
| 8 | 8 | - annotateCallStackIO, called at ann_frame005.hs:26:3 in main:Main
|
| 9 | 9 | - HasCallStack backtrace:
|
| 10 | 10 | - throwIO, called at ann_frame005.hs:34:7 in main:Main
|
| ... | ... | @@ -13,9 +13,9 @@ Handler annotation not present in context |
| 13 | 13 | Caught exception: Prelude.undefined
|
| 14 | 14 | Exception context:
|
| 15 | 15 | - IPE backtrace:
|
| 16 | -- undefined thunk
|
|
| 17 | -- raising undefined action
|
|
| 18 | -- catch site for undefined
|
|
| 16 | +- undefined thunk, called at ann_frame005.hs:41:9 in main:Main
|
|
| 17 | +- raising undefined action, called at ann_frame005.hs:38:3 in main:Main
|
|
| 18 | +- catch site for undefined, called at ann_frame005.hs:27:5 in main:Main
|
|
| 19 | 19 | - annotateCallStackIO, called at ann_frame005.hs:26:3 in main:Main
|
| 20 | 20 | - HasCallStack backtrace:
|
| 21 | 21 | - undefined, called at ann_frame005.hs:41:48 in main:Main
|
| ... | ... | @@ -24,9 +24,9 @@ Handler annotation not present in context |
| 24 | 24 | Caught exception: error from annotateStackString
|
| 25 | 25 | Exception context:
|
| 26 | 26 | - IPE backtrace:
|
| 27 | -- error thunk
|
|
| 28 | -- raising error action
|
|
| 29 | -- catch site for error
|
|
| 27 | +- error thunk, called at ann_frame005.hs:48:9 in main:Main
|
|
| 28 | +- raising error action, called at ann_frame005.hs:45:3 in main:Main
|
|
| 29 | +- catch site for error, called at ann_frame005.hs:27:5 in main:Main
|
|
| 30 | 30 | - annotateCallStackIO, called at ann_frame005.hs:26:3 in main:Main
|
| 31 | 31 | - HasCallStack backtrace:
|
| 32 | 32 | - error, called at ann_frame005.hs:48:44 in main:Main
|
| ... | ... | @@ -35,8 +35,8 @@ Handler annotation not present in context |
| 35 | 35 | Caught exception: SimpleBoom
|
| 36 | 36 | Exception context:
|
| 37 | 37 | - IPE backtrace:
|
| 38 | -- raising throwSTM action
|
|
| 39 | -- catch site for throwSTM
|
|
| 38 | +- raising throwSTM action, called at ann_frame005.hs:52:3 in main:Main
|
|
| 39 | +- catch site for throwSTM, called at ann_frame005.hs:27:5 in main:Main
|
|
| 40 | 40 | - annotateCallStackIO, called at ann_frame005.hs:26:3 in main:Main
|
| 41 | 41 | - HasCallStack backtrace:
|
| 42 | 42 | - collectExceptionAnnotation, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:170:37 in ghc-internal:GHC.Internal.Exception
|
| ... | ... | @@ -6499,25 +6499,27 @@ module GHC.Stack.Annotation.Experimental where |
| 6499 | 6499 | newtype CallStackAnnotation = CallStackAnnotation GHC.Internal.Stack.Types.CallStack
|
| 6500 | 6500 | type ShowAnnotation :: *
|
| 6501 | 6501 | data ShowAnnotation where
|
| 6502 | - ShowAnnotation :: forall a. GHC.Internal.Show.Show a => a -> ShowAnnotation
|
|
| 6502 | + ShowAnnotation :: forall a. GHC.Internal.Show.Show a => !(GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc) -> a -> ShowAnnotation
|
|
| 6503 | 6503 | type SomeStackAnnotation :: *
|
| 6504 | 6504 | data SomeStackAnnotation where
|
| 6505 | 6505 | SomeStackAnnotation :: forall a. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> SomeStackAnnotation
|
| 6506 | 6506 | type StackAnnotation :: * -> Constraint
|
| 6507 | 6507 | class StackAnnotation a where
|
| 6508 | 6508 | displayStackAnnotation :: a -> GHC.Internal.Base.String
|
| 6509 | - {-# MINIMAL displayStackAnnotation #-}
|
|
| 6509 | + stackAnnotationSourceLocation :: a -> GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc
|
|
| 6510 | + displayStackAnnotationShort :: a -> GHC.Internal.Base.String
|
|
| 6511 | + {-# MINIMAL displayStackAnnotation | displayStackAnnotationShort #-}
|
|
| 6510 | 6512 | type StringAnnotation :: *
|
| 6511 | 6513 | data StringAnnotation where
|
| 6512 | - StringAnnotation :: GHC.Internal.Base.String -> StringAnnotation
|
|
| 6514 | + StringAnnotation :: !(GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc) -> GHC.Internal.Base.String -> StringAnnotation
|
|
| 6513 | 6515 | annotateCallStack :: forall b. GHC.Internal.Stack.Types.HasCallStack => b -> b
|
| 6514 | 6516 | annotateCallStackIO :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Types.IO a -> GHC.Internal.Types.IO a
|
| 6515 | - annotateStack :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> b -> b
|
|
| 6516 | - annotateStackIO :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6517 | - annotateStackShow :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Show.Show a) => a -> b -> b
|
|
| 6518 | - annotateStackShowIO :: forall a b. GHC.Internal.Show.Show a => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6519 | - annotateStackString :: forall b. GHC.Internal.Base.String -> b -> b
|
|
| 6520 | - annotateStackStringIO :: forall b. GHC.Internal.Base.String -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6517 | + annotateStack :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> b -> b
|
|
| 6518 | + annotateStackIO :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6519 | + annotateStackShow :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Show.Show a) => a -> b -> b
|
|
| 6520 | + annotateStackShowIO :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, GHC.Internal.Show.Show a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6521 | + annotateStackString :: forall b. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> b -> b
|
|
| 6522 | + annotateStackStringIO :: forall b. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6521 | 6523 | |
| 6522 | 6524 | module GHC.Stats.Experimental where
|
| 6523 | 6525 | -- Safety: Safe
|
| ... | ... | @@ -6502,25 +6502,27 @@ module GHC.Stack.Annotation.Experimental where |
| 6502 | 6502 | newtype CallStackAnnotation = CallStackAnnotation GHC.Internal.Stack.Types.CallStack
|
| 6503 | 6503 | type ShowAnnotation :: *
|
| 6504 | 6504 | data ShowAnnotation where
|
| 6505 | - ShowAnnotation :: forall a. GHC.Internal.Show.Show a => a -> ShowAnnotation
|
|
| 6505 | + ShowAnnotation :: forall a. GHC.Internal.Show.Show a => !(GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc) -> a -> ShowAnnotation
|
|
| 6506 | 6506 | type SomeStackAnnotation :: *
|
| 6507 | 6507 | data SomeStackAnnotation where
|
| 6508 | 6508 | SomeStackAnnotation :: forall a. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> SomeStackAnnotation
|
| 6509 | 6509 | type StackAnnotation :: * -> Constraint
|
| 6510 | 6510 | class StackAnnotation a where
|
| 6511 | 6511 | displayStackAnnotation :: a -> GHC.Internal.Base.String
|
| 6512 | - {-# MINIMAL displayStackAnnotation #-}
|
|
| 6512 | + stackAnnotationSourceLocation :: a -> GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc
|
|
| 6513 | + displayStackAnnotationShort :: a -> GHC.Internal.Base.String
|
|
| 6514 | + {-# MINIMAL displayStackAnnotation | displayStackAnnotationShort #-}
|
|
| 6513 | 6515 | type StringAnnotation :: *
|
| 6514 | 6516 | data StringAnnotation where
|
| 6515 | - StringAnnotation :: GHC.Internal.Base.String -> StringAnnotation
|
|
| 6517 | + StringAnnotation :: !(GHC.Internal.Maybe.Maybe GHC.Internal.Stack.Types.SrcLoc) -> GHC.Internal.Base.String -> StringAnnotation
|
|
| 6516 | 6518 | annotateCallStack :: forall b. GHC.Internal.Stack.Types.HasCallStack => b -> b
|
| 6517 | 6519 | annotateCallStackIO :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Types.IO a -> GHC.Internal.Types.IO a
|
| 6518 | - annotateStack :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> b -> b
|
|
| 6519 | - annotateStackIO :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6520 | - annotateStackShow :: forall a b. (ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Show.Show a) => a -> b -> b
|
|
| 6521 | - annotateStackShowIO :: forall a b. GHC.Internal.Show.Show a => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6522 | - annotateStackString :: forall b. GHC.Internal.Base.String -> b -> b
|
|
| 6523 | - annotateStackStringIO :: forall b. GHC.Internal.Base.String -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6520 | + annotateStack :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> b -> b
|
|
| 6521 | + annotateStackIO :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, StackAnnotation a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6522 | + annotateStackShow :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, ghc-internal-9.1500.0:GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Show.Show a) => a -> b -> b
|
|
| 6523 | + annotateStackShowIO :: forall a b. (GHC.Internal.Stack.Types.HasCallStack, GHC.Internal.Show.Show a) => a -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6524 | + annotateStackString :: forall b. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> b -> b
|
|
| 6525 | + annotateStackStringIO :: forall b. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> GHC.Internal.Types.IO b -> GHC.Internal.Types.IO b
|
|
| 6524 | 6526 | |
| 6525 | 6527 | module GHC.Stats.Experimental where
|
| 6526 | 6528 | -- Safety: Safe
|