Represent bugs directly rather than with edt nodes.

Estimated hours taken: 10

Represent bugs directly rather than with edt nodes.  This makes the
interface to the analyser more consistent: bugs are now handled
in much the same way as questions.

browser/declarative_analyser.m:
	- In the mercury_edt/2 typeclass, change edt_root/3 to
	  edt_root_question/3 and add the method edt_root_e_bug/3.
	- Add the type prime_suspect/1 which keeps track of the
	  evidence (oracle answers) which implicates a particular
	  edt node.
	- Use the new bug representation.

browser/declarative_debugger.m:
browser/declarative_oracle.m:
	- Move oracle_confirmation to declarative_debugger.m, and
	  rename it decl_confirmation.

browser/declarative_debugger.m:
	- Change decl_bug/1 to decl_bug/0.  Instead of a bug being
	  represented by an edt node, decl_bug now represents
	  directly the different sorts of bugs possible.
	- Add an implementation for the new mercury_edt method.

browser/declarative_oracle.m:
browser/declarative_user.m:
	- Update the confirmation to use the new types.

tests/debugger/declarative/*.{exp,exp2}:
	- Update test results.
This commit is contained in:
Mark Brown
2000-03-01 04:17:27 +00:00
parent c6cc811c65
commit 134e188154
26 changed files with 368 additions and 231 deletions

View File

@@ -25,7 +25,7 @@
:- module mdb__declarative_oracle.
:- interface.
:- import_module mdb__declarative_debugger.
:- import_module list, io, string.
:- import_module list, io.
% A response that the oracle gives to a query about the
% truth of an EDT node.
@@ -35,13 +35,6 @@
; no_oracle_answers
; abort_diagnosis.
% A response that the oracle gives when asked to confirm a bug.
%
:- type oracle_confirmation
---> confirm_bug
; overrule_bug
; abort_diagnosis.
% The oracle state. This is threaded around the declarative
% debugger.
%
@@ -63,12 +56,10 @@
:- mode query_oracle(in, out, in, out, di, uo) is det.
% Confirm that the node found is indeed an e_bug or an i_bug.
% The first argument is a message from the caller to be
% prefixed to the question.
%
:- pred oracle_confirm_bug(string, decl_question, oracle_confirmation,
oracle_state, oracle_state, io__state, io__state).
:- mode oracle_confirm_bug(in, in, out, in, out, di, uo) is det.
:- pred oracle_confirm_bug(decl_bug, decl_confirmation, oracle_state,
oracle_state, io__state, io__state).
:- mode oracle_confirm_bug(in, out, in, out, di, uo) is det.
%-----------------------------------------------------------------------------%
@@ -104,23 +95,10 @@ query_oracle(Queries, Response, Oracle0, Oracle) -->
{ Oracle = Oracle0 }
).
oracle_confirm_bug(Message, Question, Confirmation, Oracle0, Oracle) -->
oracle_confirm_bug(Bug, Confirmation, Oracle0, Oracle) -->
{ get_oracle_user(Oracle0, User0) },
user_confirm_bug(Message, Question, UserResponse, User0, User),
{ set_oracle_user(Oracle0, User, Oracle) },
{
UserResponse = user_answer(_ - yes),
Confirmation = confirm_bug
;
UserResponse = user_answer(_ - no),
Confirmation = overrule_bug
;
UserResponse = no_user_answer,
error("oracle_confirm_bug: no user answer")
;
UserResponse = abort_diagnosis,
Confirmation = abort_diagnosis
}.
user_confirm_bug(Bug, Confirmation, User0, User),
{ set_oracle_user(Oracle0, User, Oracle) }.
%-----------------------------------------------------------------------------%