Reputation: 1116
I have a haskell package which contains native code as well. However, I get exceptions, (and sometimes segfaults) as I interface through FFI.
Is it possible to handle native exceptions on the haskell side. I tried using catch/catchIOError in the some cases without any success.
In this case, I would also like to like to debug only the native code. How can I use native debuggers with Haskell/FFI?
Sometimes, segfaults may occur in the C code. Being able to debug this code would help a lot.
Upvotes: 1
Views: 167
Reputation: 5001
If you think the error is in a component in C, just use gdb
. You should be able to set breakpoint in your C code and step into it. Compile your code and simply run gdb dist/build/myprogram/myprogram
(or wherever it is).
Also you could have a look at valgrind
for detecting thinks such as allocated memory not freed.
Upvotes: 2