[m-users.] Debugging with foreign types

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat May 23 03:47:23 AEST 2015

On Fri, 22 May 2015 18:12:29 +0100, matthias.guedemann at googlemail.com (Matthias G├╝demann) wrote:
> I imagined having a type class for foreign types that exports a
> few functions to turn a value into a string. A simple case could be
> having two functions, one to get a condensed version, e.g., printing
> only the root of the tree, and a second one to get the full
> representation.

That would not require a type class, merely an optional attribute
in foreign type pragmas. The problems outlined in my previous email
would remain, of course.

> How is debugging with foreign code usually done?

When the foreign code is in C, *and* when you understand how the Mercury
compiler works, you can do it by compiling Mercury to C as usual, invoking
the C compiler and the linker with the flags required to enable debugging,
and running the program inside gdb. That is how almost all parts of the
Mercury system were debugged.

As for how people outside the Mercury team debug foreign language code,
unfortunately, the answer is "behind closed doors" :-(

If anyone on the mailing list would like to open their doors, now would be
a good time.


More information about the users mailing list