question about debugging haskell/C using ffi

Axel Krauth krauth at infosun.fmi.uni-passau.de
Wed Nov 8 05:56:32 EST 2000


Hi!

at the moment I'm writing a haskell/C programm using the FFI. But I'm
getting always a segfault in the haskell part (according to gdb) .

With Linux the segfault happens at random (while I'm doing a lot of calls
to haskell via a dynamically exported function). With Unix gdb says it
occurs in 'StgReturn' called from 'stg_returnToStackTop' after the C part
finishes it job. 

I already put a C frontend instead of the haskell part and
searched for access violations and other memory missmanagement in the C
part (none). I also disabled (with no effect) all finalizers of the
ForeignObj's used. 

As I'm relatively new to Haskell I don't know how to hunt that one down.
Unfortunately the programm is already huge (ca. 4000 LOC Haskell & C) so
the buggy part of the programm is not obvious (for me).

Could someone give me a hint/technique how to approach the problem?

bye,
Axel

the system I used are
Linux : Suse 7.0,    ghc4.08.1 gcc 2.95.2
Unix  : Solaris 2.6, ghc4.08   gcc 2.95.2
   and               ghc4.08.1 egcs1.1.2





More information about the FFI mailing list