
#14634: Add print stacktrace to exception handler in runtime system -------------------------------------+------------------------------------- Reporter: flip101 | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari):
Could this handler be moved into the RTS so that i can stacktraces with exceptions just like with error?
Not easily; `HasCallStack` is implemented entirely in Haskell and the RTS has no knowledge of if. Perhaps you could teach the compiler to put the "current" `CallStack` in a known location where the RTS can find it; however, at this point you arguably might as well just build with profilng as the latter is significantly less ad-hoc and likely only slightly less efficient. If the exception you are trying to identify is produced by code that you control then you could easily capture the `CallStack` from the the throwing context. This won't work for exceptions arising from, e.g., `base`, however. One alternative that is currently unimplemented is to use DWARF stack unwinding to produce callstacks. In principle we have the ability to do this now (see wiki:DWARF/Status) and wiring it up to the exception handling subsystem is "merely" a matter of deciding an approach. See wiki:Exceptions/StackTraces and #12096 for some possible options. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14634#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler