Skip to content

Commit c4e5219

Browse files
committed
T159b: annotated stack trace with minimal imports
1 parent b32ada0 commit c4e5219

6 files changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[1 of 2] Compiling Main ( <TEMPORARY-DIRECTORY>/T159b.hs, interpreted )[main]
2+
(hdb) BreakFound {changed = True, breakId = [InternalBreakpointId Main 16], sourceSpan = SourceSpan {file = "<TEMPORARY-DIRECTORY>/T159b.hs", startLine = 12, endLine = 12, startCol = 3, endCol = 47}}
3+
(hdb) Stopped at breakpoint
4+
(hdb) [DbgStackFrame {name = "Main.foo", sourceSpan = SourceSpan {file = "<TEMPORARY-DIRECTORY>/T159b.hs", startLine = 12, endLine = 12, startCol = 3, endCol = 47}, breakId = Just InternalBreakpointId Main 16},DbgStackFrame {name = "Lovely annotation", sourceSpan = SourceSpan {file = "", startLine = 0, endLine = 0, startCol = 0, endCol = 0}, breakId = Nothing},DbgStackFrame {name = "[1,2,3,4]", sourceSpan = SourceSpan {file = "", startLine = 0, endLine = 0, startCol = 0, endCol = 0}, breakId = Nothing},DbgStackFrame {name = "annotateCallStackIO, called at <TEMPORARY-DIRECTORY>/T159b.hs:5:3 in main:Main", sourceSpan = SourceSpan {file = "", startLine = 0, endLine = 0, startCol = 0, endCol = 0}, breakId = Nothing}]
5+
(hdb) Exiting...
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[1 of 3] Compiling GHC.Debugger.View.Class ( in-memory:GHC.Debugger.View.Class, in-memory:GHC.Debugger.View.gbc )[haskell-debugger-view-in-memory]
2+
[2 of 3] Compiling Main ( <TEMPORARY-DIRECTORY>/T159b.hs, <TEMPORARY-DIRECTORY>/.hdb-cache/<CACHE-ENTRY>/Main.gbc )[main]
3+
(hdb) BreakFound {changed = True, breakId = [InternalBreakpointId Main 16], sourceSpan = SourceSpan {file = "<TEMPORARY-DIRECTORY>/T159b.hs", startLine = 12, endLine = 12, startCol = 3, endCol = 47}}
4+
(hdb) Stopped at breakpoint
5+
(hdb) [DbgStackFrame {name = "Main.foo", sourceSpan = SourceSpan {file = "<TEMPORARY-DIRECTORY>/T159b.hs", startLine = 12, endLine = 12, startCol = 3, endCol = 47}, breakId = Just InternalBreakpointId Main 16},DbgStackFrame {name = "Lovely annotation, called at <TEMPORARY-DIRECTORY>/T159b.hs:7:7 in main:Main", sourceSpan = SourceSpan {file = "", startLine = 0, endLine = 0, startCol = 0, endCol = 0}, breakId = Nothing},DbgStackFrame {name = "[1,2,3,4], called at <TEMPORARY-DIRECTORY>/T159b.hs:6:5 in main:Main", sourceSpan = SourceSpan {file = "", startLine = 0, endLine = 0, startCol = 0, endCol = 0}, breakId = Nothing},DbgStackFrame {name = "annotateCallStackIO, called at <TEMPORARY-DIRECTORY>/T159b.hs:5:3 in main:Main", sourceSpan = SourceSpan {file = "", startLine = 0, endLine = 0, startCol = 0, endCol = 0}, breakId = Nothing}]
6+
(hdb) Exiting...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
$HDB -v0 T159b.hs < T159b.hdb-stdin 2>&1 || true

test/golden/T159b/T159b.hdb-stdin

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
break T159b.hs 12
2+
run
3+
backtrace

test/golden/T159b/T159b.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import GHC.Stack.Annotation.Experimental (annotateCallStackIO,annotateStackShowIO,annotateStackStringIO)
2+
3+
main :: IO ()
4+
main = do
5+
annotateCallStackIO $ do
6+
annotateStackShowIO ([1..4] :: [Int]) $ do
7+
annotateStackStringIO "Lovely annotation" $ do
8+
foo 500
9+
10+
foo :: Int -> IO ()
11+
foo arg =
12+
putStrLn $ "foo: " <> show (arg * arg * arg)

test/golden/T159b/hie.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cradle:
2+
direct:
3+
arguments:
4+
- -i
5+
- -i.
6+
- T159b.hs
7+
- -package base
8+
- -package ghc-experimental

0 commit comments

Comments
 (0)