[Haskell-cafe] libefence useful for debugging ghc+ffi programs?

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Tue Oct 19 08:42:33 EDT 2010

Hi. I have an application compiled with ghc and using C via FFI
(and lots of Haskell libraries as well)
and it keeps annoying me with segfaults and (worse) unpredictable behaviour.
I guess a C programmer would now apply electric-fence or valgrind.
Is this a reasonable approach for ghc+ffi as well? E.g., this:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x4114f950 (LWP 8343)]
0x00007f5af4e273b5 in free () from /usr/lib/libefence.so.0
(gdb) where
#0  0x00007f5af4e273b5 in free () from /usr/lib/libefence.so.0
#1  0x00007f5af4059519 in ?? () from /usr/lib/libcurl.so.4
#2  0x00007f5af4059748 in ?? () from /usr/lib/libcurl.so.4
#3  0x00007f5af4059abd in ?? () from /usr/lib/libcurl.so.4
#4  0x00007f5af405f080 in ?? () from /usr/lib/libcurl.so.4
#5  0x00000000007bef95 in ?? ()
#6  0x00007f5aefb66628 in ?? ()
#7  0x00007f5af0df9f00 in ?? ()
#8  0x0000000000000000 in ?? ()

Is this a reason to distrust libcurl (the C libs) or curl (the Haskell package)?

Thanks - J.W.

More information about the Haskell-Cafe mailing list