[m-dev.] spypoints in external debugger

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Aug 30 21:46:48 AEST 1999

On 30-Aug-1999, Gregory Daniel Denehy <gdenehy at cs.monash.edu.au> wrote:
> Is it possible to add support for spypoints to the external debugger, and
> how much work would be involved?

Yes, it's possible.  It would not be that hard.

Basically you'd need to do the following:

	* Add some new debugger request types (e.g. `add_breakpoint',
	  `disable_breakpoint', `enable_breakpoint', `list_breakpoints')
	  to the `debugger_request' type in browser/debugger_interface.m
	  and to the corresponding `MR_debugger_request_type' enum in

	* For any request types which have arguments, provide Mercury
	  routines to extract the arguments in browser/debugger_interface.m,
	  similar to the existing routines get_mmc_options, get_var_number,
	  etc., and export these new routines to C using a `pragma export'
	  declaration.  Add wrapper functions similar to MR_get_mmc_options()
	  and MR_get_var_number() in trace/mercury_trace_external.c.

	* Add new cases to the switch in MR_trace_event_external()
	  to handle these new request types.  This would involve
	  writing a small amount of glue code that would call the
	  functions defined in trace/mercury_trace_spy.c.
	  This code would be very similar to the code in
	  MR_trace_handle_cmd() which handles the "break", "enable",
	  and "disable" commands for the internal debugger;
	  the main difference would be that the input and output
	  would be in the form of terms rather than strings,
	  and the input and output would go to the debugger socket
	  rather than to stdin/stdout/stderr.
	  The code here would use the wrapper functions that you
	  defined in the previous step to access the arguments of the
	  debugger request term.  The output terms send in response
	  could be sent using MR_send_message_to_socket_format(),
	  which is like printf() but sends messages to the debugger socket.

> And if so, is anyone willing to implement it?
> I could possibly try it myself, but I'm not confident that
> I could do it with my time constraints, and I've little knowledge of the
> source code.

Given the above fairly detailed description I think you should be able
to do it within a reasonably short time period.  If you have any trouble
I'd be happy to help.


Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at        |     -- the last words of T. S. Garp.
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list