Commit Graph

20 Commits

Author SHA1 Message Date
Zoltan Somogyi
e7c86a2342 Conform to the convention of importing only one browser module per
Estimated hours taken: 0.2
Branches: main

browser/debugger_interface.m:
browser/declarative_oracle.m:
browser/interactive_query.m:
browser/parse.m:
	Conform to the convention of importing only one browser module per
	line, and of importing browser modules before standard library modules.
2003-10-27 06:24:43 +00:00
Mark Brown
c9563335ef Allow users of the declarative debugger to revise answers that they
Estimated hours taken: 60
Branches: main

Allow users of the declarative debugger to revise answers that they
have given previously.  We do this by modifying the user interface
to allow a default answer to be shown as part of the question; the
default answer will always be some answer the user has given previously,
which they can choose to either change or accept as is.  Initially no
questions will be candidates for revision, but if the user ever rejects
a diagnosis, some or all of the questions leading directly to the bug in
question will be asked again.

Add an empty command to the user_command type, for when the user just
presses return.  If there is a default answer, the empty command is
interpreted as that answer.  If there is no default answer, the empty
command is interpreted as the skip command, which allows the user to
cycle through all the available questions by repeatedly pressing return.

browser/declarative_debugger.m:
	Define the type decl_evidence which represents the evidence
	collected against a particular suspect.

	Pass the evidence to the oracle as required.

	Ensure the analyser is updated after the user rejects a diagnosis.

browser/declarative_analyser.m:
	Collect the evidence against the prime suspect as the answers are
	processed, and include this evidence when the analyser response
	is a bug.

	Export the predicate revise_analysis/4 which updates the
	analyser state after the user has rejected a diagnosis.

	Pass the IO action map to prime_suspect_get_evidence so that
	edt_root_question can be called.

browser/declarative_oracle.m:
	When the user rejects a bug, retract from the oracle's knowledge
	base any of the evidence which implicated that bug.  Rather than
	throw this information away, we assert it in a secondary knowledge
	base which is consulted when we want to know if there should be
	a default answer provided to the user.

	Update the oracle_state to reflect the above change, and remove
	all the get_* and set_* predicates for the oracle state.  That
	functionality is provided by labelled fields, so maintaining the
	get_* and set_* predicates is no longer worth the trouble.

	Add the predicate retract_oracle_kb/3 to remove information from
	a knowledge base.

	Use the correct (equivalence) type for exceptions.

browser/declarative_user.m:
	Add the type user_question, which may be a plain decl_question or
	may be a decl_question with a default answer.  Use this type in
	query_user* instead of decl_question.

	Write the command handling switch as a separate predicate.  This
	makes it easier for one command to emulate others (e.g. the empty
	command).

	If the question has a default answer, print it as part of the
	prompt.

	Parse the empty command.

doc/user_guide.texi:
	Update the documentation to reflect the changes.

library/list.m:
	Add a cc_multi version of list__map.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/empty_command.exp:
tests/debugger/declarative/empty_command.inp:
tests/debugger/declarative/empty_command.m:
tests/debugger/declarative/revise.exp:
tests/debugger/declarative/revise.inp:
tests/debugger/declarative/revise.m:
tests/debugger/declarative/revise_2.exp:
tests/debugger/declarative/revise_2.inp:
tests/debugger/declarative/revise_2.m:
	Test cases for the new features.
2003-02-03 05:19:32 +00:00
Mark Brown
fb27d22a8f Implement a committed choice version of the 'set' module, and use this in
Estimated hours taken: 1.5
Branches: main

Implement a committed choice version of the 'set' module, and use this in
the declarative debugging oracle.  This implementation of sets avoids the
use of builtin comparison, which would otherwise cause problems for the
oracle.

This fixes a bug that was causing test case 'ho5' to fail.

browser/set_cc.m:
	The new module.  This is mostly a wrapper around tree234_cc.

browser/mdb.m:
	Make the new module a sub-module of mdb.

browser/declarative_oracle.m:
	Use the new module instead of sets from the standard library.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/ho5.exp:
tests/debugger/declarative/ho5.exp2:
tests/debugger/declarative/ho5.inp:
	Enable this test case, and provide input and expected output.
2002-10-15 07:40:48 +00:00
Mark Brown
596bf09f7e The "complete" and "incomplete" maps in the declarative debugging oracle
Estimated hours taken: 2
Branches: main

The "complete" and "incomplete" maps in the declarative debugging oracle
can cause a runtime abort if higher order terms are present in the debuggee,
because the maps use sets to represent the solutions to a goal, and sets make
use of builtin comparison.  This change fixes the problem by replacing the
two maps with a single map from initial atom to truth value.  The set of
solutions is no longer stored explicitly.

This change causes no loss of accuracy of the oracle, because we weren't
really using the explicit knowledge about solutions anyway.  The main
drawback of this change is that if in future we implement support for "edit
and continue" style debugging (e.g. by allowing previous answers to be
saved in/restored from a file), we will lose some of the information
pertaining to previous versions of the program, which will make the oracle
slightly less effective at deducing new answers from previous ones.  Since
runtime aborts are a much more serious problem, we will have to live with
this drawback for the moment.

Another solution to this problem may have been to implement a 'set_cc'
module, which would be to 'set' as 'tree234_cc' is to 'tree234'.
Unfortunately, we would need to implement 'set_cc__intersect' but it
appears not to be possible to implement a satisfactory committed choice
version of intersection.

browser/declarative_oracle.m:
	Replace the two maps with the new one, and update the code
	that accesses the knowledge base.

tests/debugger/declarative/Mmakefile:
	Enable tests 'ho3' and 'ho4', which now work.

tests/debugger/declarative/ho3.m:
	Fix a typo in the test case.  It wasn't testing precisely the thing
	it was supposed to test.

tests/debugger/declarative/ho3.exp:
tests/debugger/declarative/ho3.inp:
tests/debugger/declarative/ho4.exp:
tests/debugger/declarative/ho4.inp:
	Input and expected output for the enabled tests.
2002-10-10 19:44:00 +00:00
Mark Brown
5cbec33da5 Add the command 'pd' to the declarative debugger.
Estimated hours taken: 1
Branches: main

Add the command 'pd' to the declarative debugger.  This command returns
to the procedural debugger at the event corresponding to the current
question; it is notionally the inverse of the 'dd' command in the
procedural debugger.

browser/declarative_user.m:
	Handle the new command, and add a new alternative to the
	user_response type.

browser/declarative_oracle.m:
	Handle the new user response, and add a new alternative to the
	oracle_response type.

browser/declarative_debugger.m:
	Handle the new oracle response, and add a new alternative to the
	diagnoser_response type.

	Export some procedures to C so that the back end can interpret the
	new diagnoser response.

	Update an old comment.

trace/mercury_trace_declarative.c:
	Handle the new diagnoser response.  Rename the function
	MR_decl_handle_bug_found, since it now also handles the case
	where a symptom has been found.

	Interpret the diagnoser response using something like a switch,
	rather than something like an if-then-else.  This gives better
	error messages if the diagnoser response type is changed.

doc/user_guide.texi:
	Document the new command.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/pd.exp:
tests/debugger/declarative/pd.inp:
tests/debugger/declarative/pd.m:
	Test the new feature.
2002-10-03 07:34:43 +00:00
Mark Brown
f302f534fd Move the code that defines an instance of mercury_edt/2 from
Estimated hours taken: 1
Branches: main

Move the code that defines an instance of mercury_edt/2 from
browser/declarative_debugger.m into a module of its own.  This section
of code is large and reasonably self-contained, so it makes sense for it
to have its own module.  Moreover, declarative_debugger.m contains the
main declarative debugging definitions and the upper levels of code for
the front end, and the mercury_edt/2 instance doesn't fit into either of
these categories.

Add an exception handler to the front end, so that if declarative debugging
fails for whatever reason, the debugging session can at least continue using
the procedural debugger.  Rather than calling error in the front end, throw
exceptions that are of a type specific to the front end (so we know which
errors are ours and which aren't).

browser/declarative_debugger.m:
	Add a new type, diagnoser_exception/0.  Handle these exceptions
	but rethrow any other kind.

browser/declarative_debugger.m:
browser/declarative_tree.m:
	Move the mercury_edt/2 instance to the new module.

browser/mdb.m:
	Add the new module to the mdb library.

browser/declarative_*.m:
	Call throw/1 instead of error/1.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/catch.exp:
tests/debugger/declarative/catch.inp:
tests/debugger/declarative/catch.m:
	A test case for debugging code that catches exceptions.  This sort
	of code is still not supported by the front end, but at least we
	now give a decent error message and allow debugging to resume.
2002-09-13 04:17:47 +00:00
Zoltan Somogyi
985b13ed3f Make I/O actions known to the declarative debugger.
Estimated hours taken: 48
Branches: main

Make I/O actions known to the declarative debugger. The debugger doesn't do
anything with them yet beyond asking about their correctness.

browser/io_action.m:
	New module for representing I/O actions, and for constructing the map
	from I/O action numbers to the actions themselves.

browser/mdb.m:
	Include the new module.

browser/declarative_analysis.m:
	Make the map from I/O action numbers to the actions themselves part
	of the analyzer state, since conversions from annotated trace nodes
	to EDT nodes may now require this information. This information is
	stored in the analyzer state because only the analyser needs this
	information (when converting annotated trace nodes to EDT tree nodes).
	It is not stored in the trace node store because its lifetime is
	different: its contents does not change during a tree deepening
	operation.

browser/declarative_execution.m:
	Store the current value of the I/O action counter with each call and
	exit node. The list of I/O actions associated with the atom of the exit
	node is given by the I/O actions whose counters lie between these two
	values (initial inclusive, final exclusive).

browser/declarative_debugger.m:
browser/declarative_oracle.m:
	Distinguish atoms associated with exit nodes from atoms associated with
	call nodes, since the former, but not the latter, now have a list of
	I/O actions associated with them.

browser/declarative_user.m:
	Add mechanisms for printing and browsing the I/O actions associated
	with EDT nodes and bugs.

runtime/mercury_trace_base.[ch]:
	Move the code for finding an I/O action here from the file
	mercury_trace_declarative.c, for use by browser/io_action.m.

runtime/mercury_layout_util.[ch]:
	Move a utility function here from mercury_trace_declarative.c,
	for use by the code moved to mercury_trace_base.c.

trace/mercury_trace_declarative.c:
	When invoking the front end, pass to it the boundaries of the required
	I/O action map. Cache these boundaries, so we can tell the front end
	when reinvocation of the back end by the front end (to materialize
	previously virtual parts of the annotated trace) does not require
	the reconstruction of the I/O action map.

trace/mercury_trace_vars.[ch]:
	Separate out the code for finding an I/O action from the code for
	browsing it, for use in mercury_trace_declarative.c.

	Note places where the implementation does not live up to the
	documentation.

trace/mercury_trace.[ch]:
	Add a parameter to MR_trace_retry that allows retries to cross I/O
	actions without asking the user if this is OK.

trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
	Pass MR_FALSE as this new parameter to MR_trace_retry.

tests/debugger/declarative/tabled_read_decl.{m,inp,exp}:
	A slightly modified copy of the tests/debugger/tabled_read_decl test
	case, to check the declarative debugger's handling of goals with I/O
	actions.

tests/debugger/declarative/Mmakefile:
	Enable the new test case.
2002-05-15 11:24:21 +00:00
Mark Brown
68ebc7b53a Implement a committed choice version of 234-trees which uses
Estimated hours taken: 10
Branches: main

Implement a committed choice version of 234-trees which uses
compare_representation instead of builtin compare.  Use this to implement
the declarative debugger's oracle knowledge base, instead of the standard
library map.  We do this because the keys used by the oracle may contain
non-canonical terms, which would cause a runtime abort if used as map
keys.

This completes the changes to the declarative debugger to support the
debugging of higher order code.  (There is still a problem in that the
declarative debugger back end does not filter out external events for
higher order calls.  This means that the declarative debugger asks
questions about what are effectively calls to call/N, which is not
necessary since we assume that call/N is correct.  This is a problem
unrelated to this change, so I will deal with it separately.)

browser/tree234_cc.m:
	The new sub-module of mdb, which implements the 234-trees.

browser/declarative_oracle.m:
	Use the new module instead of library/map.m.  Propagate the
	effect of the calls to committed choice code.

browser/mdb.m:
	Include the new module.

tests/debugger/declarative/Mmakefile:
	Enable two old test cases, higher_order and ite_2, that now work
	after this change.  Add a new test case that tests closures
	with some arguments applied.

tests/debugger/declarative/higher_order.exp:
tests/debugger/declarative/higher_order.inp:
tests/debugger/declarative/ite_2.exp:
tests/debugger/declarative/ite_2.inp:
	Provide input and expected output for these tests.

tests/debugger/declarative/ho2.exp:
tests/debugger/declarative/ho2.inp:
tests/debugger/declarative/ho2.m:
	New test case.
2002-05-02 07:44:02 +00:00
Mark Brown
14ceb68776 Change the definitions of decl_question and decl_answer in the declarative
Estimated hours taken: 24
Branches: main

Change the definitions of decl_question and decl_answer in the declarative
debugger.  Each question now contains a reference to the EDT node that
generated the question, and each answer contains the reference from the
question it applies to.  Previously, the answers referred to the questions
themselves.

This change means that the analyser no longer needs to unify questions
to determine what to do with an answer.  The reason we need to avoid
this is that questions may contain higher order terms, and these will
cause a runtime abort if unified.  Also, by using our new approach it is
possible to simplify the analyser in a number of ways.

This is the first part of a larger change to support declarative debugging
of higher order code.  The main task remaining is to avoid using comparison
of questions in the oracle.  But this will require a different approach
than the one taken here, because the oracle is interested in the value of
the question, not just the identity of it.

browser/declarative_*.m:
	Propagate the effect of the changes to decl_question and decl_answer.

	Fix some comments which are out of date, and elaborate on some others
	which don't give enough information.

browser/declarative_analyser.m:
	Remove the definition of the suspect/1 type.  Its main purpose
	was to associate a question with its EDT node, but this is no
	longer required.  Update the places that used suspect(T) to instead
	use either decl_question(T) or just T, as appropriate.

	Separate out the code which calculates the analyser response.  This
	requires adding some fields to the analyser state, but this in turn
	means that the processing of answers can be greatly simplified.
	This should also make implementing more sophisticated search
	strategies possible, which is something we want to do in the
	future.

browser/declarative_debugger.m:
	Make the changes to the two exported types.  Export a function which
	extracts the EDT node from the question.

browser/declarative_oracle.m:
browser/declarative_user.m:
	Add a type parameter to oracle_response and user_response, similarly
	to the change to the other types.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/dependency2.exp:
tests/debugger/declarative/dependency2.inp:
tests/debugger/declarative/dependency2.m:
	A test case, which tests for a bug I encountered when developing
	this change.

tests/debugger/declarative/family.exp:
	Because of the change to the way the analyser matches up the answers
	with the EDT, a different but equally valid instance of the same bug
	is chosen in part of this test case.  Update the expected output to
	reflect this.
2002-04-30 07:08:02 +00:00
Zoltan Somogyi
ed83014595 Make the debugger use the committed choice versions of the
Estimated hours taken: 2
Branches: main

browser/*.m:
	Make the debugger use the committed choice versions of the
	deconstruction predicates, and propagate the committed choice
	environment up the call chain as far as necessary.
2002-01-28 07:20:10 +00:00
Mark Brown
75a2a90cbb This is the second part of a change to support term dependency analysis
Estimated hours taken: 40
Branches: main

This is the second part of a change to support term dependency analysis
in the declarative debugger.  A `mark' command is implemented for the
term browser, which allows a particular subterm to be selected and
returned from the browser.  The declarative debugger interprets this as
a suspicious subterm, and tries to find a child or sibling node from which
this subterm comes.  This is used to determine the next question to be
asked of the oracle.

browser/browse.m:
	Update the browser interface to allow for marked subterms being
	returned from the browser.

	Implement and document the mark command.

	Rewrite run_command as a switch instead of a chain of if-then-elses.
	This forces all unimplemented commands to be explicitly listed,
	and gives better error checking.

browser/browser_info.m:
	Add a maybe_mark field to the browser_info.  It is initially `no',
	but is updated when the mark command is given.

browser/declarative_analyser.m:
	Select which child or sibling node to ask about next by searching
	for the origin of the suspicious subterm.  If the subterm has mode
	`out' we act as if the oracle had answered no, and if the subterm
	has mode `in' we act as if the oracle had answered yes.  In future
	we may not wish to presume this -- we do so now mainly to keep the
	analysis algorithm simpler.

browser/declarative_debugger.m:
	Add a functor for suspicious subterms to the decl_answer type.

browser/declarative_oracle.m:
	Accommodate the changed answer type.  The oracle does not try to
	store information about suspicious subterms in the knowledge base,
	because in principle this could lead to infinite loops (although
	currently this wouldn't be a problem since we don't ever use the
	information to move upward in the tree, so no cycle could be
	formed).

browser/declarative_user.m:
	Accommodate the changed answer type, and interpret marked terms
	from the browser as suspicious subterms.

browser/parse.m:
	Add the new command.

browser/program_representation.m:
	Add a procedure to convert the browser's list(dir) to a term_path.

	Change atomic_goal_rep_is_call/2 so it fails for special predicates,
	which was originally intended.

trace/mercury_trace_browse.c:
	Ignore the extra argument -- marked terms are not currently used in
	the main debugger.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/input_term_dep.*:
tests/debugger/declarative/output_term_dep.*:
tests/debugger/declarative/special_term_dep.*:
	New test cases.
2001-04-23 16:26:38 +00:00
Mark Brown
c5de0d5b0c Implement declarative debugging of code that throws exceptions.
Estimated hours taken: 8

Implement declarative debugging of code that throws exceptions.

This aborts if used on code that handles exceptions.  There is no point
dealing with this yet, since the oracle won't handle the higher order
argument to try/2.

browser/declarative_debugger.m:
	Add "unexpected exception" questions and "unhandled exception" bugs,
	and generate these from EXCP events.  Handle the exception case
	in various switches.

	Add a predicate unexpected_exception_children/4, analogous to
	{wrong,missing}_answer_children/4.

browser/declarative_execution.m:
	Add excp/5 nodes to the event trace, and export a C function to
	construct them.  Handle these nodes in various switches.

	Allow contours to extend beyond NEGE events, if the status is
	`undecided'.  Such events have no matching NEGS or NEGF event,
	so they do not mark the boundary of a separate context.

browser/declarative_oracle.m:
	Store information about which exceptions should/shouldn't be thrown
	from various calls, and use this information to answer questions
	where possible.

browser/declarative_user.m:
	Handle the new questions and bugs.

trace/mercury_trace_declarative.c:
	Add a function to deal with EXCP events.

trace/mercury_trace_internal.c:
	Allow declarative debugging to be started from EXCP events.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/throw.m:
tests/debugger/declarative/throw.inp:
tests/debugger/declarative/throw.exp:
tests/debugger/declarative/throw.exp2:
	A test case for this feature.

tests/debugger/declarative/queens.exp:
	Update the output from this test.
2000-08-10 05:51:29 +00:00
Mark Brown
134e188154 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.
2000-03-01 04:17:27 +00:00
Mark Brown
f49968a3ff Fix the user interface of the declarative debugger so that it
Estimated hours taken: 15

Fix the user interface of the declarative debugger so that it
produces more readable output; the representation of atoms
is updated so that it can handle non-ground arguments.

Ensure that all DD output goes through the correct stream, so that
the debugger works properly under emacs.

browser/declarative_debugger.m:
	Call a procedure in the oracle to handle bug confirmation
	(including printing out the bug), rather than handle
	it directly.

browser/declarative_execution.m:
	Update the trace_atom type so that it can handle both ground
	and free arguments.  Export to C some procedures for
	constructing trace atoms.

browser/declarative_oracle.m:
	Export a procedure which handles bug confirmation.  This calls
	the declarative_user module to do the interaction, and interprets
	the result.

browser/declarative_user.m:
	Export a procedure to handle bug confirmation by the user.
	Update to handle the changes to trace_atom.

trace/mercury_trace_declarative.c:
	Construct trace_atoms by calling the new Mercury procedures
	exported from browser/declarative_execution.m.

trace/mercury_trace_declarative.h:
	Remove the macro that had been used to construct old style atoms.

trace/mercury_trace_vars.{c,h}:
	Export a procedure to calculate the argument position of a
	head variable.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/args.{m,inp,exp,exp2}:
	New test case to test mixing bound and free arguments.

tests/debugger/declarative/*.inp:
tests/debugger/declarative/*.exp:
tests/debugger/declarative/*.exp2:
	Update test cases to reflect new output, and the extra question
	asked for bug confirmation.
2000-02-22 10:46:55 +00:00
Simon Taylor
9ba3b14098 Make all the modules in the browser library sub-modules of
Estimated hours taken: 1

Make all the modules in the browser library sub-modules of
module `mdb', to avoid link errors when users use module names
such as `parse'.

browser/Mmakefile:
browser/browser_library.m:
browser/mdb.m:
	Rename browser_library.m to mdb.m.
	Change `:- import_module' declarations to
	`:- include_module' declarations.

browser/Mmakefile:
	Remove the special case rule for `mer_browser.init' --
	it doesn't work when the file names are not the same
	as the module name. Instead, the default rule for `mdb.init'
	is used and the output is copied to `mer_browser.init'.

browser/.cvsignore:
	Rename header files, etc.

browser/*.m:
	Add a `mdb__' prefix to the names of modules in the browser library
	in `:- module' and `:- import_module' declarations.

trace/*.c:
	Rename the header files for the browser library in
	`#include' statements.

tests/hard_coded/Mmakefile:
tests/hard_coded/parse.m:
tests/hard_coded/parse.exp:
	Test case.
2000-02-04 03:45:53 +00:00
Mark Brown
3e065c040e Implement the new architecture for the front end of the
Estimated hours taken: 120

Implement the new architecture for the front end of the
declarative debugger.  Disable declarative debugging if conservative
GC is not being used since this change relies on it.  The benefits
of declarative debugging in non-GC grades are not worth the extra
maintenance required to support it, since even small examples require
a large amount of memory.

browser/declarative_analyser.m:
	New module which handles the analysis of EDTs, which was
	previously done in browser/declarative_debugger.m.

browser/declarative_debugger.m:
	- Change the interface according to the new design.
	- Export types of the form decl_*, rather than edt_*.
	- Move the EDT analysis to the new module.
	- Handle the interaction between the analyser and the oracle.
	- Don't interact directly with the user, but go via the oracle.
	- New diagnoser state type.
	- Update the EDT instance to conform to the other changes.

browser/declarative_oracle.m:
	- Replace oracle_answer type with oracle_response.
	- Allow the oracle to work with a queue of questions rather
	  than one at a time.
	- Add new predicates to manipulate the knowledge base.

browser/declarative_user.m:
	- Export the user_state type.
	- Handle some user commands in this module.
	- Handle questions properly (apart from printing atoms).

browser/browser_library.m:
	Add the new module.

trace/mercury_trace_declarative.c:
	- Initialise the front end state just once per session.
	- Make the step size much larger, since implicit subtrees
	  are not fully supported yet.
	- Correct the types in a format specifier.

trace/mercury_trace_declarative.c:
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
	- Disable declarative debugging unless conservative GC is used.
2000-01-03 02:23:04 +00:00
Mark Brown
cc644fcf22 This change adds a more sophisticated oracle to the declarative
Estimated hours taken: 55

This change adds a more sophisticated oracle to the declarative
debugger.  The oracle now tries to remember previous answers and uses
them if available, and only asks the user if there is no other
information.

browser/declarative_oracle.m:
	- Add the type "oracle_assumption", which identifies an
	  internal assumption of the oracle.
	- Add the type "oracle_answer", which the oracle returns to the
	  caller.  This holds either the truth value, or a reason why
	  the truth value cannot be given yet.
	- Implement a knowledge base to store the previous answers.
	  This data structure is designed to be able to store arbitrary
	  assertions, although at this stage only one kind of assertion
	  is used.
	- Where possible, use the KB to answer questions, instead of
	  asking the user.
	- Update comments.

browser/declarative_debugger.m:
	- Use the new interface to the oracle.  Handle "don't know"
	  answers in a simple way: either save the question and ask it
	  later or return without finding any bug.
	- Move the debugger_command type to this module.
	- Move the UI stuff to a new module.

browser/declarative_user.m:
	New module to handle interaction between the debugger/oracle
	and the user.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/oracle_db.{m,inp,exp}
	Add a test case for the new feature.
1999-08-20 06:50:00 +00:00
Mark Brown
07cad7c169 If calling from the internal debugger, use readline input for the
Estimated hours taken: 6

If calling from the internal debugger, use readline input for the
interactive term browser and interactive queries.

browser/browse.m:
	Change some if-then-elses to switches, which will help
	catch errors if a new functor is added to the debugger type.

browser/parse.m:
browser/util.m:
	Return a string from util__trace_getline/4 rather than a
	list of chars, which saves converting from a string to a list
	of chars and then back again.

browser/util.m:
	Add a version of util__trace_getline that also takes I/O
	stream arguments.  Pass these arguments to MR_trace_getline.

browser/declarative_oracle.m:
	Call util__trace_getline/4 to do input via readline (if
	available).  Improve error handling.

browser/interactive_query.m:
	Call util__trace_getline to get user input, instead of
	standard library predicates.

runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
	Add two I/O stream arguments to MR_trace_getline.
1999-05-30 03:55:13 +00:00
Mark Brown
5d9569900b Clean up the declarative debugger.
Estimated hours taken: 12

Clean up the declarative debugger.

browser/declarative_debugger.m:
browser/declarative_oracle.m:
	- Add a new type, oracle_data, to store the oracle database.
	- Thread an oracle database through a single call to the
	  front end.
	- Replace `unknown' with a less overloaded name in
	  some type definitions.

trace/mercury_trace_declarative.c:
trace/mercury_trace_declarative.h:
browser/declarative_debugger.m:
	- Improve documentation.

browser/declarative_debugger.m:
	- Export new type, edt_truth.
	- Improve the interface to the oracle.
	- Add a new typeclass, evaluation_tree, and update the
	  previous interface to reflect this.
	- Make declarative_bug a polymorphic type, and change the
	  constructor for buggy nodes from `wrong' to `e_bug'.
1999-04-30 04:00:22 +00:00
Mark Brown
4fec7f6137 Add a front end to the declarative debugger, written in Mercury.
Estimated hours taken: 80

Add a front end to the declarative debugger, written in Mercury.  Modify
the back end to call this whenever an EDT is built.  Also, various
bug fixes and improvements.

browser/declarative_debugger.m:
	New module.  This is a first implementation of the front end of
	the declarative debugger.  It uses a simple top-down algorithm
	to search the EDT for a buggy node.  The results are printed
	in a simple format to the output stream.  It is called from the
	back end, in trace/mercury_trace_declarative.c.

browser/declarative_oracle.m:
	New module.  This is a first implementation of an oracle for the
	declarative debugger.  It simply passes all queries directly
	on to the user.

browser/browser_library.m:
	Import the new modules.

trace/mercury_trace_declarative.c:
	- Various fixes/improvements of comments.
	- Fix bugs where `int' is used instead of `Unsigned'.
	- Pass the event_info structure to MR_trace_decl_update_path,
	  rather than passing various components of it.
	- Use the copy of MR_trace_event_number in the event_info structure
	  rather than referring to the global variable directly.
	- Remove the EDT printing functions, as they have been superseded by
	  the new front end.  Call the new front end instead of these old
	  functions.
	- Provide an interface to the EDT nodes that is imported by the
	  front end.
	- Ensure that, after diagnosis, we end up at the same event we
	  started at.
	- Fix a bug where it was assumed all procedures had at least one
	  argument.
	- Ensure that the user is notified if the dd_wrong operation cannot
	  be started due to MR_trace_retry failing.

trace/mercury_trace_declarative.h:
	- Move a #include to the correct place.
	- Declare the interface to the EDT nodes.

trace/mercury_trace_internal.c:
	Fix a bug introduced earlier.

runtime/mercury_conf_param.h:
	Add a new configuration macro, MR_DEBUG_DD_BACK_END.  When defined
	this causes information about the declarative debugger back end
	to be printed out during operation.
1999-04-12 04:11:48 +00:00