ABSTRACT
Even Haskell programs can occasionally go wrong. Programs calling head on an empty list, and incomplete patterns in function definitions can cause program crashes, reporting little more than the precise location where error was ultimately called. Being told that one application of the head function in your program went wrong, without knowing which use of head went wrong can be infuriating. We present our work on adding the ability to get stack traces out of GHC, for example that our crashing head was used during the evaluation of foo, which was called during the evaluation of bar, during the evaluation of main. We provide a transformation that converts GHC Core programs into ones that pass a stack around, and a stack library that ensures bounded heap usage despite the highly recursive nature of Haskell. We call our extension to GHC StackTrace.
Supplemental Material
- T. Allwood, S. P. Jones, and S. Eisenbach. Explicit call stack paper resources. http://code.haskell.org/explicitCallStackPaper/.Google Scholar
- A. Gill and C. Runciman. Haskell program coverage. In G. Keller, editor, Haskell, pages 1--12. ACM, 2007. Google ScholarDigital Library
- G. U. Guide. The ghci debugger. http://www.haskell.org/ghc/docs/latest/html/users_guide/ghci-debugger.h%tml.Google Scholar
- S. P. Jones and P. Wadler. A static semantics for haskell. Draft paper, Glasgow, 91.Google Scholar
- S. Marlow, J. Iborra, B. Pope, and A. Gill. A lightweight interactive debugger for haskell. In G. Keller, editor, Haskell, pages 13--24. ACM, 2007. Google ScholarDigital Library
- J. Meacham. Jhc. http://repetae.net/computer/jhc/jhc.shtml.Google Scholar
- W. Partain. The nofib benchmark suite of haskell programs. In J. Launchbury and P. M. Sansom, editors, Functional Programming, Workshops in Computing, pages 195--202. Springer, 1992. Google ScholarDigital Library
- P. Sansom and S. Peyton Jones. Formally based profiling for higher-order functional languages. ACM Transactions on Programming Langauges and Systems, 19(1), 1997. Google ScholarDigital Library
- M. Sulzmann, M. M. T. Chakravarty, S. L. P. Jones, and K. Donnelly. System F with type equality coercions. In F. Pottier and G. C. Necula, editors, TLDI, pages 53--66. ACM, 2007. Google ScholarDigital Library
- G. Trac. Annotations. http://hackage.haskell.org/trac/ghc/wiki/Annotations.Google Scholar
- M. Wallace, O. Chitil, T. Brehm, and C. Runciman. Multiple-view tracing for Haskell: a new Hat. In R. Hinze, editor, Preliminary Proceedings of the 2001 ACM SIGPLAN Haskell Workshop, pages 151--170, Firenze, Italy, Sept. 2001. Universiteit Utrecht UU-CS-2001-23. Final proceedings to appear in ENTCS 59(2).Google Scholar
Index Terms
- Finding the needle: stack traces for GHC
Recommendations
Declaratively defining domain-specific language debuggers
GCPE '11Tool support is vital to the effectiveness of domain-specific languages. With language workbenches, domain-specific languages and their tool support can be generated from a combined, high-level specification. This paper shows how such a specification ...
Debugging native extensions of dynamic languages
ManLang '18: Proceedings of the 15th International Conference on Managed Languages & RuntimesMany dynamic programming languages such as Ruby and Python enable developers to use so called native extensions, code implemented in typically statically compiled languages like C and C++. However, debuggers for these dynamic languages usually lack ...
Declaratively defining domain-specific language debuggers
GPCE '11: Proceedings of the 10th ACM international conference on Generative programming and component engineeringTool support is vital to the effectiveness of domain-specific languages. With language workbenches, domain-specific languages and their tool support can be generated from a combined, high-level specification. This paper shows how such a specification ...
Comments