[mercury-users] Interacting with other processes

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Dec 16 05:05:08 AEDT 1998

On 15-Dec-1998, Ralph Becket <rwab1 at cam.sri.com> wrote:
> Fergus Henderson wrote on 16 Dec:
> > Doing this is inherently system-dependent -- it won't work on
> > single-tasking operating systems, for example.  But if the OS supports
> > multi-tasking and an appropriate method of IPC, then yes, it can be done.
> > ...
> Umm, wouldn't it be possible to just extend/rewrite
> mercury-compiler-0.8/browser/debugger_interface.m ?

Yes, that would be possible.  

The external debugger interface is written partly in C
(in trace/mercury_trace_external.c) and partly
in Mercury (in browser/debugger_interface.m).
The C part uses sockets for IPC, which of course
makes it non-portable.

Extending or rewriting the external debugger interface would probably
require changes to the C part too, not just to the Mercury part.
Gregory Daniel specifically said he wanted to do it using Mercury streams,
and that he wanted to avoid using tcl, and so I figured that he may well
have wanted to avoid C hacking too.

Also, since he wants to write the GUI in Mercury,
he'd need a Mercury interface to the socket functions
so that his GUI can connect to the other end of the socket.
To implement such a socket interface, you need a solution
the fd -> Mercury stream issue that I mentioned in my previous mail.
(BTW, a search of the mailing list archives should pull up
a draft of such a socket interface, together with an explanation
of why it didn't make it into the Mercury distribution.)

Currently the external debugger interface is rather sparse,
whereas the internal debugger (mdb) is much more full-featured,
supporting things like stack traces, retry, breakpoints,
and so forth.

Extending the external debugger interface would in many
respects be a nicer design than trying to parse the output from
the internal debugger.  But it would require more knowledge
about the implementation details of the internal debugger.

Fergus Henderson <fjh at cs.mu.oz.au>  |  "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh>  |   but source code lives forever"
PGP: finger fjh at        |     -- leaked Microsoft memo.

More information about the users mailing list