[m-dev.] for review: new ports for the declarative debugger

Mark Anthony BROWN dougl at cs.mu.OZ.AU
Thu Sep 16 16:59:35 AEST 1999


Zoltan Somogyi writes:
> 
> 
> For review by Mark.
> 
> Add four new ports: entering the condition of an if-then-else, entering a
> negation, and leaving a negation via success or failure. If --trace-decl
> is enabled, generate these events, which the declarative debugger needs
> in order to properly delimit negated contexts (which should cause a switch
> from wrong answer to missing answer diagnosis and vice versa).

It's not just the declarative debugger; I imagine that a graphical
debugger would need the information to lay out negated goals.

IMHO these are useful ports for users of the trace-based debugger, also.


Index: compiler/ite_gen.m
===================================================================
>  		tree(FlushCode,
> @@ -334,14 +342,18 @@
>  		tree(EffectResumeCode,
>  		tree(SaveHpCode,
>  		tree(SaveTicketCode,
> +		tree(EnterTraceCode,
>  		tree(GoalCode,
>  		tree(ThenNeckCode,
>  		tree(DiscardTicketCode,
> +		tree(DiscardTicketCode,

Duplicated line.

> Index: compiler/trace.m
> ===================================================================
>  
> +:- type negation_trace_port
> +	--->	neg_success
> +	;	neg_failure.
> +

These are just the ports for the end of a negation.  Perhaps a better
type name can be found?  Or, you could put a comment explaining
why there is no `neg_enter'.

>  :- type nondet_pragma_trace_port
>  	--->	nondet_pragma_first
>  	;	nondet_pragma_later.
> @@ -117,6 +121,12 @@
>  :- pred trace__maybe_generate_internal_event_code(hlds_goal::in,
>  	code_tree::out, code_info::in, code_info::out) is det.
>  
> +	% If we are doing execution tracing, generate code for an trace event
> +	% that represents leaving a negated goal (via success or failure).

s/an/a/

Index: trace/mercury_trace_internal.c
===================================================================

>  			port_name = "ELSE";
> +			break;
> +
> +		case MR_PORT_NEGENTER:
> +			port_name = "NENT";
> +			break;
> +
> +		case MR_PORT_NEGSUCCESS:
> +			port_name = "NSUC";
> +			break;
> +
> +		case MR_PORT_NEGFAILURE:
> +			port_name = "NFAI";
>  			break;
>  

I don't like the port names that are printed by the debugger.
Do we really have to limit ourselves to four characters for the port name?

I see no other problems with this change.

Cheers,
Mark
-- 
Mark Brown, PhD student            )O+  |  "Another of Fortran's breakthroughs
(m.brown at cs.mu.oz.au)                   |  was the GOTO statement, which was...
Dept. of Computer Science and Software  |  uniquely simple and understandable"
Engineering, University of Melbourne    |              -- IEEE, 1994
--------------------------------------------------------------------------
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