RE: Debugging Haskell: the stack

when I call from Haskell into C, stop it there, and use a debugger (e.g gdb) to look at the stack, it looks all broken. Here is an example:
#0 c_init () at c.c:5 #1 0x08048f14 in ssM_fast1 () #2 0x0804a248 in sakt_ret () #3 0x04c58308 in ?? ()
(c_init is a C function on which I've set a breakpoint). Now, I don't expect to see meaningful stack frames from Haskell, but I am calling into Haskell from C, and I would expect the C functions calling into Haskell to appear on the stack frame. What is happening? How does Haskell manage to still return to C when the stack looks like that?
GHC's runtime system leaves a hole on the C stack to use for temporary storage while running Haskell code, and then it doesn't move the C stack pointer at all until calling out to C or returning to the runtime. Gdb won't be able to traverse the hole to find the enclosing stack frames. Cheers, Simon
participants (1)
-
Simon Marlow