[GHC] #960: Lexical call site string
GHC
trac at galois.com
Tue Oct 24 06:56:55 EDT 2006
#960: Lexical call site string
-----------------------------------+----------------------------------------
Reporter: paul at cogito.org.uk | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.6
Severity: normal | Keywords:
Difficulty: Unknown | Testcase:
Architecture: Unknown | Os: Unknown
-----------------------------------+----------------------------------------
A function that returns the lexical call site of the current function when
an exception occurs.
I'm thinking primarily of "head []", but the same principle would apply to
other functions. A dynamic traceback is not necessarily possible in a
lazy language, but when "head" gets called on an empty list there must be
somewhere in the program that actually said "head", even if it was not
evaluated at the time or included in a closure or something. That way
when I get a "head: empty list" I don't need to grep my program for "head"
calls: I know where head was called from and can start looking there.
Examples:
* If I just have a function "foo = head" then it will report that the
caller was "foo".
* If I have a function "bar x y = ..." and subsequntly say "baz x = bar (x
* 2)" then an exception in "bar" will report the caller as "baz".
I know there is a -x profiler option to get a sort of dynamic traceback,
but I find it frequently just tells me the error is in "CAF.List", which
isn't very informative.
I'm guessing at a difficulty of 1 week as I don't know the GHC internals.
I'm guessing that the call site is going to have to be a hidden parameter
passed in to each function call, or alternatively hard-coded when a
function is in-lined.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/960>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list