Files
mercury/tests/debugger/declarative/aadebug.m
Mark Brown 0166fe7510 Bring the implementation up to date with the algorithm that is
Estimated hours taken: 25 (plus ? by zs)

Bring the implementation up to date with the algorithm that is
described in the paper (papers/decl_debug).  Add some debugging
infrastructure to the back end, which was used to debug this
change.

browser/declarative_execution.m:
	- Store the call sequence number in call nodes.
	- Store the previous redo (if there is one) in fail nodes.
	- Use a functor specifically for switches.
	- Use a pointer to the first disj event, instead of a pointer
	  to the event before it.
	- Export two new predicates for dereferencing disj node ids.
	- Export (to C) a procedure for accessing the call sequence number,
	  and a procedure for getting to the first disj event.
	- Split the scan_backwards function into two: step_left_in_context
	  and find_prev_contour.

browser/declarative_debugger.m:
trace/mercury_trace_declarative.c:
	- Use the updated data structure.

runtime/mercury_conf_param.h:
	- Add the configuration parameter MR_USE_DECL_STACK_SLOT, which
	  makes the declarative debugger use stack slots reserved by
	  the compiler to cache the location of the call node.

trace/mercury_trace_declarative.h:
trace/mercury_trace_declarative.c:
	- Use stack slot only if MR_USE_DECL_STACK_SLOT is defined.
	- If not using stack slot, use the new algorithm to search
	  for a matching call or exit event.
	- Avoid using a global by passing the previous node to
	  MR_trace_decl_* and returning the new node.
	- Rename MR_trace_call_node_answer to
	  MR_trace_call_node_last_interface.
	- Update comments.

browser/declarative_execution.m:
trace/mercury_trace_declarative.c:
	- Added debugging output for various events of interest
	  in the back end.  It is activated when MR_DEBUG_DD_BACK_END
	  is set.

tests/debugger/declarative/aadebug.m:
tests/debugger/declarative/aadebug.inp:
tests/debugger/declarative/aadebug.exp:
tests/debugger/declarative/aadebug.exp2:
	- Update this test to match the example in the paper.

tests/debugger/declarative/propositional.inp:
tests/debugger/declarative/propositional.exp:
tests/debugger/declarative/propositional.exp2:
	- Update this test case so it gives a similar result in
	  debugging grades to non-debugging grades.

tests/debugger/declarative/app.exp2:
tests/debugger/declarative/if_then_else.exp2:
	- Update test case results.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/backtrack.m:
tests/debugger/declarative/backtrack.inp:
tests/debugger/declarative/backtrack.exp:
	- New test case.
2000-02-17 06:48:18 +00:00

58 lines
742 B
Mathematica

:- module aadebug.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module int, std_util.
main -->
( { p('a', X), test(X) } ->
io__write_string("yes\n")
;
io__write_string("no\n")
).
:- pred test(int).
:- mode test(in) is semidet.
test(_) :-
semidet_fail.
:- pred p(character, int).
:- mode p(in, out) is nondet.
p(A, D) :-
q(A, B),
(
r(B, C)
->
(
s(C, D)
;
D = 31
)
;
not(
q(B, _)
),
D = 32
).
:- pred q(character, character).
:- mode q(in, out) is nondet.
q('a', 'a').
q('a', 'b').
q('c', 'c').
:- pred r(character, int).
:- mode r(in, out) is semidet.
r('a', 10).
:- pred s(int, int).
:- mode s(in, out) is det.
s(N, 3 * N).