[m-rev.] for review: improve the declarative debugger user interface

Ian MACLARTY maclarty at cs.mu.OZ.AU
Sun May 1 16:23:09 AEST 2005


For review by anyone.

Estimated hours taken: 7
Branches: main

Improve the declarative debugger interface.

The two main changes are to use the mdb help system and not re-display
the question after the user issues a command which does not answer the 
question.  For example if the user issues an `info' command, then previously 
the question would be redisplayed after the requested information and if the 
question is big then the information would be scrolled off the screen.

browser/declarative_analyser.m:
 	Remove extra new line characters when printing info.  These are
 	no longer necessary since the question is not redisplayed.

browser/declarative_debugger.m:
 	Pass the help system from mdb to the oracle state when
 	initialising the diagnoser.

browser/declarative_oracle.m:
 	Pass the help system to the user state when initialising the
 	oracle state.

browser/declarative_user.m:
 	Add two new fields to the user state: one to keep a reference to
 	the help system and one to indicate whether the current question
 	should be displayed when getting a user input.

 	Allow the user to redisplay the question by issuing a `print' command
 	with no arguments.  If the question is not to be displayed the show
 	a "dd>" prompt.

 	Change the `abort' command to `quit'.  This is more consistent
 	with the rest of mdb.

doc/commands:
 	Add a script to print all the commands in a section in the
 	user guide.

doc/generate_mdb_doc:
 	Generate help for the declarative debugger.

doc/mdb_categories:
 	Add a category, `decl', for commands that can be executed inside
 	the declarative debugger.  Change the `dd' category to mdb_dd,
 	because 1) `help dd' used to show help about the `dd' category AND
 	the `dd' command and 2) `dd' is too general a category name now that we
 	have a `decl' category.

 	Add an item, `decl_debug' to the concepts category.

doc/user_guide.texi:
 	Document some dd commands which previously weren't documented here.

 	Add a short overview of the declarative debugger.  This is
 	displayed when the user issues a `help' command from within the
 	dd.

 	Move the bit about the behaviour when no command is given to
 	before the list of commands.  This is necessary so util/info_to_mdb.c
 	doesn't include this in the help of the last command in the list.

tests/debugger/declarative/app.exp:
tests/debugger/declarative/app.inp:
tests/debugger/declarative/browse_arg.exp:
tests/debugger/declarative/browse_arg.inp:
tests/debugger/declarative/browser_mode.exp:
tests/debugger/declarative/browser_mode.inp:
tests/debugger/declarative/confirm_abort.exp:
tests/debugger/declarative/confirm_abort.inp:
tests/debugger/declarative/dependency.exp:
tests/debugger/declarative/dependency.inp:
tests/debugger/declarative/find_origin.exp:
tests/debugger/declarative/find_origin.exp2:
tests/debugger/declarative/info.exp:
tests/debugger/declarative/info.inp:
tests/debugger/declarative/io_stream_test.exp:
tests/debugger/declarative/io_stream_test.exp2:
tests/debugger/declarative/mapinit.exp:
tests/debugger/declarative/mapinit.inp:
tests/debugger/declarative/output_term_dep.exp:
tests/debugger/declarative/output_term_dep.inp:
tests/debugger/declarative/resume.exp:
tests/debugger/declarative/resume.inp:
tests/debugger/declarative/skip.exp:
tests/debugger/declarative/skip.inp:
tests/debugger/declarative/solutions.exp3:
tests/debugger/declarative/tabled_read_decl.exp:
 	Update tests.

trace/mercury_trace_declarative.c:
trace/mercury_trace_help.c:
trace/mercury_trace_help.h:
 	Pass the help system to the frontend.
Index: browser/declarative_analyser.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_analyser.m,v
retrieving revision 1.23
diff -u -b -r1.23 declarative_analyser.m
--- browser/declarative_analyser.m	15 Apr 2005 05:42:33 -0000	1.23
+++ browser/declarative_analyser.m	30 Apr 2005 09:30:21 -0000
@@ -1276,8 +1276,8 @@
  	ReasonStr = reason_to_string(Reason),
  	ReasonSent = "The current question was chosen because " ++ ReasonStr,
  	WrappedReason = string.word_wrap(ReasonSent, 72),
- 	io.format(OutStream, "\n%s\n%s\n\n", [s(InfoMessage), 
-		s(WrappedReason)], !IO),
+ 	io.format(OutStream, "%s\n%s\n", [s(InfoMessage), s(WrappedReason)], 
+		!IO),
  	Node = get_edt_node(SearchSpace, LastId),
  	edt_question(Analyser ^ io_action_map, Store, Node,
  		OracleQuestion),
Index: browser/declarative_debugger.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_debugger.m,v
retrieving revision 1.55
diff -u -b -r1.55 declarative_debugger.m
--- browser/declarative_debugger.m	6 Apr 2005 01:11:29 -0000	1.55
+++ browser/declarative_debugger.m	30 Apr 2005 08:23:21 -0000
@@ -61,6 +61,7 @@
  :- import_module mdb.declarative_analyser.
  :- import_module mdb.declarative_execution.
  :- import_module mdb.declarative_tree.
+:- import_module mdb.help.
  :- import_module mdb.io_action.
  :- import_module mdb.term_rep.
  :- import_module mdbcomp.program_representation.
@@ -271,7 +272,7 @@

  :- pred diagnoser_state_init(io_action_map::in, io.input_stream::in,
  	io.output_stream::in, browser_info.browser_persistent_state::in,
-	diagnoser_state(R)::out) is det.
+	help.system::in, diagnoser_state(R)::out) is det.

  :- pred diagnosis(S::in, analysis_type(edt_node(R))::in, int::in, int::in,
  	int::in, diagnoser_response(R)::out,
@@ -309,7 +310,10 @@
  :- import_module mdb.util.
  :- import_module mdbcomp.prim_data.

-:- import_module exception, int, map, bool.
+:- import_module bool.
+:- import_module exception.
+:- import_module int.
+:- import_module map.

  unravel_decl_atom(DeclAtom, TraceAtom, IoActions) :-
  	(
@@ -357,14 +361,14 @@
  diagnoser_set_oracle(Oracle, diagnoser(Analyser, _),
  	diagnoser(Analyser, Oracle)).

-diagnoser_state_init(IoActionMap, InStr, OutStr, Browser, Diagnoser) :-
+diagnoser_state_init(IoActionMap, InStr, OutStr, Browser, HelpSystem, 
+		Diagnoser) :-
  	analyser_state_init(IoActionMap, Analyser),
-	oracle_state_init(InStr, OutStr, Browser, Oracle),
+	oracle_state_init(InStr, OutStr, Browser, HelpSystem, Oracle),
  	Diagnoser = diagnoser(Analyser, Oracle).

  diagnosis(Store, AnalysisType, UseOldIoActionMap, IoActionStart, IoActionEnd,
-		Response, !Diagnoser, !Browser,
-		!IO) :-
+		Response, !Diagnoser, !Browser, !IO) :-
  	mdb.declarative_oracle.set_browser_state(!.Browser, !.Diagnoser ^
  		oracle_state, Oracle),
  	!:Diagnoser = !.Diagnoser ^ oracle_state := Oracle,
@@ -530,14 +534,15 @@
  	% make it easier to call from C code.
  	%
  :- pred diagnoser_state_init_store(io.input_stream::in, io.output_stream::in,
-	browser_info.browser_persistent_state::in, 
+	browser_info.browser_persistent_state::in, help.system::in,
  	diagnoser_state(trace_node_id)::out) is det.

-:- pragma export(diagnoser_state_init_store(in, in, in, out),
+:- pragma export(diagnoser_state_init_store(in, in, in, in, out),
  		"MR_DD_decl_diagnosis_state_init").

-diagnoser_state_init_store(InStr, OutStr, Browser, Diagnoser) :-
-	diagnoser_state_init(map.init, InStr, OutStr, Browser, Diagnoser).
+diagnoser_state_init_store(InStr, OutStr, Browser, HelpSystem, Diagnoser) :-
+	diagnoser_state_init(map.init, InStr, OutStr, Browser, HelpSystem,
+		Diagnoser).

  :- pred set_fallback_search_mode(
  	mdb.declarative_analyser.search_mode::in,
@@ -601,7 +606,7 @@
  	browser_info.browser_persistent_state::out, io::di, io::uo)
  	is cc_multi.

-:- pragma export(diagnosis_resume_previous(in, in, in, in,out, in, out, in,
+:- pragma export(diagnosis_resume_previous(in, in, in, in, out, in, out, in,
  	out, di, uo), "MR_DD_decl_diagnosis_resume_previous").

  diagnosis_resume_previous(Store, UseOldIoActionMap, IoActionStart, IoActionEnd,
Index: browser/declarative_oracle.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_oracle.m,v
retrieving revision 1.41
diff -u -b -r1.41 declarative_oracle.m
--- browser/declarative_oracle.m	11 Apr 2005 06:43:33 -0000	1.41
+++ browser/declarative_oracle.m	30 Apr 2005 03:21:40 -0000
@@ -27,11 +27,14 @@
  :- interface.

  :- import_module mdb.browser_info.
-:- import_module mdbcomp.prim_data.
  :- import_module mdb.declarative_debugger.
  :- import_module mdb.declarative_execution.
+:- import_module mdb.help.
+:- import_module mdbcomp.prim_data.

-:- import_module io, bool, string.
+:- import_module bool. 
+:- import_module io. 
+:- import_module string.

  	% A response that the oracle gives to a query about the
  	% truth of an EDT node.
@@ -50,7 +53,8 @@
  	% Produce a new oracle state.
  	%
  :- pred oracle_state_init(io.input_stream::in, io.output_stream::in, 
-	browser_info.browser_persistent_state::in, oracle_state::out) is det.
+	browser_info.browser_persistent_state::in, help.system::in, 
+	oracle_state::out) is det.

  	% Add a module to the set of modules trusted by the oracle
  	%
@@ -254,10 +258,10 @@
  			trusted_id_counter	:: counter
  		).

-oracle_state_init(InStr, OutStr, Browser, Oracle) :-
+oracle_state_init(InStr, OutStr, Browser, HelpSystem, Oracle) :-
  	oracle_kb_init(Current),
  	oracle_kb_init(Old),
-	user_state_init(InStr, OutStr, Browser, User),
+	user_state_init(InStr, OutStr, Browser, HelpSystem, User),
  	% Trust the standard library by default.
  	bimap.set(bimap.init, standard_library, 0, Trusted),
  	counter.init(1, Counter),
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.47
diff -u -b -r1.47 declarative_user.m
--- browser/declarative_user.m	6 Apr 2005 01:11:29 -0000	1.47
+++ browser/declarative_user.m	30 Apr 2005 09:14:15 -0000
@@ -18,6 +18,7 @@

  :- import_module mdb.browser_info.
  :- import_module mdb.declarative_debugger.
+:- import_module mdb.help.

  :- import_module io.

@@ -39,7 +40,8 @@
  :- type user_state.

  :- pred user_state_init(io.input_stream::in, io.output_stream::in, 
-	browser_info.browser_persistent_state::in, user_state::out) is det.
+	browser_info.browser_persistent_state::in, help.system::in, 
+	user_state::out) is det.

  	% This predicate handles the interactive part of the declarative
  	% debugging process.  The user is presented with a question,
@@ -69,14 +71,14 @@

  :- import_module mdb.browse.
  :- import_module mdb.browser_term.
-:- import_module mdb.io_action.
-:- import_module mdb.util.
  :- import_module mdb.declarative_execution.
  :- import_module mdb.declarative_tree.
-:- import_module mdbcomp.prim_data.
-:- import_module mdbcomp.program_representation.
+:- import_module mdb.io_action.
  :- import_module mdb.parse.
  :- import_module mdb.term_rep.
+:- import_module mdb.util.
+:- import_module mdbcomp.prim_data.
+:- import_module mdbcomp.program_representation.

  :- import_module bool.
  :- import_module char.
@@ -92,20 +94,43 @@
  	--->	user(
  			instr	:: io.input_stream,
  			outstr	:: io.output_stream,
-			browser	:: browser_persistent_state
+			browser			:: browser_persistent_state,
+
+				% yes if the question should be displayed when 
+				% querying the user.  This is used to 
+				% supress the displaying of the question after
+				% the user issues a command which does not
+				% answer the question (such as an `info'
+				% command).
+			display_question	:: bool,
+			help_system		:: help.system
  		).

-user_state_init(InStr, OutStr, Browser, user(InStr, OutStr, Browser)).
+user_state_init(InStr, OutStr, Browser, HelpSystem, 
+	user(InStr, OutStr, Browser, yes, HelpSystem)).

  %-----------------------------------------------------------------------------%

  query_user(UserQuestion, Response, !User, !IO) :-
  	Question = get_decl_question(UserQuestion),
+	(
+		!.User ^ display_question = yes,
  	write_decl_question(Question, !.User, !IO),
  	user_question_prompt(UserQuestion, Prompt),
+		!:User = !.User ^ display_question := no
+	;
+		!.User ^ display_question = no,
+		Prompt = "dd> "
+	),
  	get_command(Prompt, Command, !User, !IO),
-	handle_command(Command, UserQuestion, Response, !User, 
-		!IO).
+	handle_command(Command, UserQuestion, Response, !User, !IO),
+	(
+		Response \= show_info(_)
+	->
+		!:User = !.User ^ display_question := yes
+	;
+		true
+	).

  :- pred handle_command(user_command::in, user_question(T)::in,
  	user_response(T)::out, user_state::in, user_state::out, 
@@ -158,8 +183,10 @@
  			query_user(UserQuestion, Response,
  				!User, !IO)
  		;
+			%
  			% If the user marks the predicate or function,
-			% we make the call invalid.
+			% we make the atom erroneous.
+			%
  			MaybeMark = yes([]),
  			Node = get_decl_question_node(Question),
  			Answer = truth_value(Node, erroneous),
@@ -233,16 +260,33 @@
  	print_chosen_io_actions(IoActions, From, To, !.User, !IO),
  	query_user(UserQuestion, Response, !User, !IO).

+handle_command(ask, UserQuestion, Response, !User, !IO) :-
+	!:User = !.User ^ display_question := yes,
+	query_user(UserQuestion, Response, !User, !IO).
+
  handle_command(pd, UserQuestion, Response, !User, !IO) :-
  	Question = get_decl_question(UserQuestion),
  	Node = get_decl_question_node(Question),
  	Response = exit_diagnosis(Node).

-handle_command(abort, _, Response, !User, !IO) :-
+handle_command(quit, _, Response, !User, !IO) :-
  	Response = abort_diagnosis.

-handle_command(help, UserQuestion, Response, !User, !IO) :-
-	user_help_message(!.User, !IO),
+handle_command(help(MaybeCmd), UserQuestion, Response, !User, !IO) :-
+	(
+		MaybeCmd = yes(Cmd),
+		Path = ["decl", Cmd]
+	;
+		MaybeCmd = no,
+		Path = ["concepts", "decl_debug"]
+	),
+	help.path(!.User ^ help_system, Path, !.User ^ outstr, Res, !IO),
+	(
+		Res = help.ok
+	;
+		Res = help.error(Message),
+		io.write_strings([Message, "\n"], !IO)
+	),
  	query_user(UserQuestion, Response, !User, !IO).

  handle_command(empty_command, UserQuestion, Response, !User, 
@@ -263,11 +307,9 @@
  			Command = inadmissible
  		)
  	),
-	handle_command(Command, UserQuestion, Response, !User, 
-		!IO).
+	handle_command(Command, UserQuestion, Response, !User, !IO).

-handle_command(illegal_command, UserQuestion, Response, !User, 
-		!IO) :-
+handle_command(illegal_command, UserQuestion, Response, !User, !IO) :-
  	io.write_string(!.User ^ outstr, "Unknown command, 'h' for help.\n",
  		!IO),
  	query_user(UserQuestion, Response, !User, !IO).
@@ -664,11 +706,16 @@
  			% Print some information about the current question.
  	;	info

+			% The user wants the current question re-asked.
+	;	ask
+
  			% Abort this diagnosis session.
-	;	abort 
+	;	quit

-			% Request help before answering.
-	;	help 
+			% Request help before answering.  If the maybe argument
+			% is no then a general help message is displayed,
+			% otherwise help on the given command is displayed.
+	;	help(maybe(string))

  			% User just pressed return.
  	;	empty_command 
@@ -676,42 +723,6 @@
  			% None of the above.
  	;	illegal_command.

-:- pred user_help_message(user_state::in, io::di, io::uo) is det.
-
-user_help_message(User, !IO) :-
-	io.write_strings(User ^ outstr, [
-		"According to the intended interpretation of the program,",
-		" answer one of:\n",
-		"\ty\tyes\t\tthe node is correct\n",
-		"\tn\tno\t\tthe node is incorrect\n",
-		"\ti\tinadmissible\tthe input arguments are out of range\n",
-		"\ts\tskip\t\tskip this question\n",
-		"\tt [module]\ttrust [module]\t\n",
-		"\t\tTrust the predicate/function about which\n",
-		"\t\tthe current question is being asked.  If the word\n",
-		"\t\t`module' is given as an argument then trust all the\n",
-		"\t\tpredicates/functions in the same module as the\n",
-		"\t\tpredicate/function about which the current question is\n",
-		"\t\tbeing asked.\n",
-		"\tb [-x] [<n>]\tbrowse [-x] [<n>]\n",
-		"\t\tBrowse the atom, or its nth argument.\n",
-		"\t\tIf the `-x' or `--xml' option is given, then browse\n",
-		"\t\tthe term with an XML browser.\n",
-		"\tb io <n>\tbrowse io <n>\tbrowse the atom's nth I/O action\n",
-		"\tp <n>\tprint <n>\tprint the nth argument of the atom\n",
-		"\tp <n-m>\tprint <n-m>\tprint the nth to the mth arguments of the atom\n",
-		"\tp io <n>\tprint io <n>\tprint the atom's nth I/O action\n",
-		"\tp io <n-m>\tprint io <n-m>\tprint the atom's nth to mth I/O actions\n",
-		"\tset [-APBfpv] <param> <value>\t",
-		"set a term browser parameter value\n",
-		"\tinfo\t\t\tDisplay some information about the current\n",
-		"\t\t\t\tquestion and the state of the bug search.\n",
-		"\tpd\t\t\tcommence procedural debugging from this point\n",
-		"\ta\tabort\t\t",
-			"abort this diagnosis session and return to mdb\n",
-		"\th, ?\thelp\t\tthis help message\n"
-	], !IO).
-
  :- pred user_confirm_bug_help(user_state::in, io::di, io::uo) is det.

  user_confirm_bug_help(User, !IO) :-
@@ -719,8 +730,8 @@
  		"Answer one of:\n",
  		"\ty\tyes\t\tconfirm that the suspect is a bug\n",
  		"\tn\tno\t\tdo not accept that the suspect is a bug\n",
-%		"\tb\tbrowse\t\tbrowse the suspect\n",
-		"\ta\tabort\t\t",
+		"\tb\tbrowse\t\tbrowse the suspect\n",
+		"\tq\tquit\t\t",
  			"abort this diagnosis session and return to mdb\n",
  		"\th, ?\thelp\t\tthis help message\n"
  	], !IO).
@@ -752,10 +763,10 @@
  		io.error_message(Error, Msg),
  		io.write_string(User ^ outstr, Msg, !IO),
  		io.nl(User ^ outstr, !IO),
-		Command = abort
+		Command = quit
  	;
  		Result = eof,
-		Command = abort
+		Command = quit
  	).

  :- pred cmd_handler(string::in, 
@@ -771,11 +782,11 @@
  cmd_handler("s",	one_word_cmd(skip)).
  cmd_handler("skip",	one_word_cmd(skip)).
  cmd_handler("pd",	one_word_cmd(pd)).
-cmd_handler("a",	one_word_cmd(abort)).
-cmd_handler("abort",	one_word_cmd(abort)).
-cmd_handler("?",	one_word_cmd(help)).
-cmd_handler("h",	one_word_cmd(help)).
-cmd_handler("help",	one_word_cmd(help)).
+cmd_handler("q",		one_word_cmd(quit)).
+cmd_handler("quit",		one_word_cmd(quit)).
+cmd_handler("?",		help_cmd).
+cmd_handler("h",		help_cmd).
+cmd_handler("help",		help_cmd).
  cmd_handler("info",	one_word_cmd(info)).
  cmd_handler("b",	browse_arg_cmd).
  cmd_handler("browse",	browse_arg_cmd).
@@ -811,6 +822,7 @@

  :- func print_arg_cmd(list(string)::in) = (user_command::out) is semidet.

+print_arg_cmd([]) = ask.
  print_arg_cmd([Arg]) = print_arg(From, To) :-
  	string_to_range(Arg, From, To).
  print_arg_cmd(["io", Arg]) = print_io(From, To) :-
@@ -829,6 +841,11 @@
  trust_arg_cmd([]) = trust_predicate.
  trust_arg_cmd(["module"]) = trust_module.

+:- func help_cmd(list(string)::in) = (user_command::out) is semidet.
+
+help_cmd([]) = help(no).
+help_cmd([Cmd]) = help(yes(Cmd)).
+
  string_to_range(Arg, From, To) :-
  	( string.to_int(Arg, Num) ->
  		From = Num,
@@ -864,7 +881,7 @@
  	->
  		Response = overrule_bug
  	;
-		Command = abort
+		Command = quit
  	->
  		Response = abort_diagnosis
  	;
Index: doc/commands
===================================================================
RCS file: doc/commands
diff -N doc/commands
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ doc/commands	30 Apr 2005 08:28:07 -0000
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# Print a list of commands in a portion of mdb help text.
+# Usage: commands file
+#
+grep "^\`" $1 | sed "s/^\(\`[a-z]\+\>\).*$/\"\1',\"/" | sort -u \
+| xargs echo | sed "s/, \(\`[a-z]\+'\)\,$/ and \1\./"
Index: doc/generate_mdb_doc
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/generate_mdb_doc,v
retrieving revision 1.8
diff -u -b -r1.8 generate_mdb_doc
--- doc/generate_mdb_doc	16 Nov 2004 00:45:11 -0000	1.8
+++ doc/generate_mdb_doc	30 Apr 2005 06:48:58 -0000
@@ -14,6 +14,18 @@
  info -f ./mercury_user_guide.info -o $tmp -n "Mercury debugger concepts"
  ../util/info_to_mdb concepts $tmp >> mdb_doc

+# Document the declarative debugger.
+info -f ./mercury_user_guide.info -o $tmp -n "Declarative debugging overview"
+echo "document concepts 10 decl_debug"                           >> mdb_doc
+sed 's/^   //' < $tmp | sed -n '6,1000s/^/     /p'               >> mdb_doc 
+echo                                                             >> mdb_doc
+info -f ./mercury_user_guide.info -o $tmp -n "Declarative debugging commands"
+echo "The following commands are available from within the \
+declarative debugger:" `./commands $tmp` | \
+fold -w72 -s | sed "s/^/     /"                                  >> mdb_doc
+echo end                                                         >> mdb_doc
+../util/info_to_mdb decl $tmp >> mdb_doc
+
  debug_cmd_path="debug debugger"
  for section in interactive forward backward browsing breakpoint \
  	i/o parameter help declarative misc exp developer
@@ -21,7 +33,7 @@
  	case $section in
  		interactive)	category=queries ;;
  		i/o)		category=table_io ;;
-		declarative)	category=dd ;;
+		declarative)	category=mdb_dd ;;
  		*)		category=$section ;;
  	esac
  	info -f ./mercury_user_guide.info -o $tmp $debug_cmd_path $section
Index: doc/mdb_categories
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/mdb_categories,v
retrieving revision 1.25
diff -u -b -r1.25 mdb_categories
--- doc/mdb_categories	14 Apr 2005 11:29:36 -0000	1.25
+++ doc/mdb_categories	30 Apr 2005 07:48:27 -0000
@@ -3,7 +3,7 @@
               The concepts for which documentation is available are
               `break_points', `strict_commands', `print_level',
               `default_print_level', `current_environment',
-             and `procedure_specification'.
+             `procedure_specification' and `decl_debug'.

  end
  document_category 150 queries
@@ -54,9 +54,15 @@
               For help on the `help' command, type `help help help'.

  end
-document_category 850 dd
-dd         - Commands related to declarative debugging.  These are `dd', 
+document_category 850 mdb_dd
+mdb_dd     - mdb commands related to declarative debugging.  These are `dd',
               `trust', `trusted' and `untrust'.
+
+end
+document_category 860 decl
+decl       - Commands available from within the declarative debugger.  These 
+	     are `yes', `no', `inadmissible', `trust', `skip', `browse',
+	     `print', `set', `help', `info', `ask', `mark', `pd' and `quit'.

  end
  document_category 900 misc
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.432
diff -u -b -r1.432 user_guide.texi
--- doc/user_guide.texi	27 Apr 2005 03:21:22 -0000	1.432
+++ doc/user_guide.texi	30 Apr 2005 08:32:02 -0000
@@ -3907,9 +3907,9 @@

  Note that this is a work in progress,
  so there are some limitations in the implementation.
-The main limitations are pointed out in the following sections.

  @menu
+* Declarative debugging overview::
  * Declarative debugging concepts::
  * Oracle questions::
  * Declarative debugging commands::
@@ -3918,6 +3918,21 @@
  * Improving the search::
  @end menu

+ at node Declarative debugging overview
+ at subsection Overview
+
+The declarative debugger tries to find a bug in your program by asking
+questions about the correctness of calls executed in your program.
+
+Because pure Mercury code does not have any side effects, the declarative
+debugger can make inferences such as ``if a call produces incorrect output
+from correct input, then there must be a bug in the code executed by one of 
+the descendents of the call''.
+
+The declarative debugger is therefore able to automate much of the 
+`detective work' that must be done manually when using the
+procedural debugger.
+
  @node Declarative debugging concepts
  @subsection Concepts

@@ -4048,15 +4063,20 @@
  @subsection Commands

  At the above mentioned prompts, the following commands may be given.
-Each command (with the exception of @samp{pd})
-can also be abbreviated to just its first letter.
- at sp 1
+Most commands can be abbreviated by their first letter.
+
+It is also legal to press return without specifying a command.
+If there is a default answer (@pxref{Oracle questions}),
+pressing return is equivalent to giving that answer.
+If there is no default answer,
+pressing return is equivalent to the skip command.
+
  @table @code
  @item yes
-Answer that the assertion is correct.
+Answer `yes' to the current question.
  @sp 1
  @item no
-Answer that the assertion is wrong.
+Answer `no' to the current question.
  @sp 1
  @item inadmissible
  Answer that the call is inadmissible.
@@ -4074,7 +4094,7 @@
  @item skip
  Skip this question and ask a different one if possible.
  @sp 1
- at item browse [@var{n}]
+ at item browse [--xml] [@var{n}]
  Start the interactive term browser and browse the @var{n}th argument
  before answering.  If the argument number
  is omitted then browse the whole call as if it were a data term.
@@ -4086,12 +4106,30 @@
  in @ref{Browsing commands} or type @samp{help} from within the
  interactive query browser.
  @sp 1
+Giving the @samp{--xml} or @samp{-x} option causes the term to be displayed
+in an XML browser.
+ at sp 1
+ at item browse io [--xml] @var{n}
+Browse the @var{n}th IO action.
+ at sp 1
+ at item print [@var{n}]
+Print the @var{n}th argument of the current question.  If no
+argument is given then display the current question.
+ at sp 1
+ at item print io @var{n}
+Print the @var{n}th IO action.
+ at sp 1
+ at item set @var{param} @var{value}
+Updates the given configuration parameter.
+The parameters that can be configured are
+ at samp{format}, @samp{depth}, @samp{size}, @samp{width} and @samp{lines}.
+ at sp 1
  @item mark [@var{term-path}]
  The @samp{mark} command can only be given from within the interactive
  term browser and asserts that the marked subterm is incorrect.  The 
-debugger uses this information to better direct the bug search.  If no
-argument is given the the current subterm is taken to be incorrect.  If a 
- at var{term-path} is given then the subterm at @var{tern-path} relative to
+declarative debugger uses this information to better direct the bug search. 
+If no argument is given the the current subterm is taken to be incorrect. 
+If a @var{term-path} is given then the subterm at @var{tern-path} relative to
  the current subterm will be considered incorrect.
  @sp 1
  @item pd
@@ -4099,10 +4137,10 @@
  This command is notionally the inverse of the @samp{dd} command
  in the procedural debugger.
  The session can be resumed with a @samp{dd --resume} command.
- at item abort
+ at item quit
  End the declarative debugging session and return to
  the event at which the @samp{dd} command was given. 
-The session can be resume with a @samp{dd --resume} command.
+The session can be resumed with a @samp{dd --resume} command.
  @sp 1
  @item info
  List the filename and line number of the predicate the current question
@@ -4112,15 +4150,10 @@
  how many events are yet to be eliminated and the reason for asking
  the current question.
  @sp 1
- at item help
-Summarize the list of available commands.
+ at item help [@var{command}]
+Summarize the list of available commands or give help on a specific
+command.
  @end table
-
-It is also legal to press return without specifying a command.
-If there is a default answer (@pxref{Oracle questions}),
-pressing return is equivalent to giving that answer.
-If there is no default answer,
-pressing return is equivalent to the skip command.

  @node Diagnoses
  @subsection Diagnoses
Index: tests/debugger/mdb_command_test.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/mdb_command_test.inp,v
retrieving revision 1.40
diff -u -b -r1.40 mdb_command_test.inp
--- tests/debugger/mdb_command_test.inp	10 Feb 2005 04:10:32 -0000	1.40
+++ tests/debugger/mdb_command_test.inp	1 May 2005 03:47:32 -0000
@@ -1,3 +1,15 @@
+yes                  xyzzy xyzzy xyzzy xyzzy xyzzy
+no                   xyzzy xyzzy xyzzy xyzzy xyzzy
+inadmissible         xyzzy xyzzy xyzzy xyzzy xyzzy
+trust                xyzzy xyzzy xyzzy xyzzy xyzzy
+skip                 xyzzy xyzzy xyzzy xyzzy xyzzy
+browse               xyzzy xyzzy xyzzy xyzzy xyzzy
+print                xyzzy xyzzy xyzzy xyzzy xyzzy
+set                  xyzzy xyzzy xyzzy xyzzy xyzzy
+mark                 xyzzy xyzzy xyzzy xyzzy xyzzy
+pd                   xyzzy xyzzy xyzzy xyzzy xyzzy
+quit                 xyzzy xyzzy xyzzy xyzzy xyzzy
+info                 xyzzy xyzzy xyzzy xyzzy xyzzy
  query                xyzzy xyzzy xyzzy xyzzy xyzzy
  cc_query             xyzzy xyzzy xyzzy xyzzy xyzzy
  io_query             xyzzy xyzzy xyzzy xyzzy xyzzy
Index: tests/debugger/declarative/app.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/app.exp,v
retrieving revision 1.18
diff -u -b -r1.18 app.exp
--- tests/debugger/declarative/app.exp	6 Jan 2005 03:20:11 -0000	1.18
+++ tests/debugger/declarative/app.exp	30 Apr 2005 09:09:41 -0000
@@ -18,7 +18,7 @@
  app([4, 5], [6, 7, 8], [4, ...])
  Valid? yes
  app([3, 4, 5], [6, 7, 8], [3, ...])
-Valid? abort
+Valid? quit
  Diagnosis aborted.
        E6:     C5 EXIT pred app.app/3-0 (det) app.m:26 (app.m:28)
  mdb> continue
Index: tests/debugger/declarative/app.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/app.inp,v
retrieving revision 1.7
diff -u -b -r1.7 app.inp
--- tests/debugger/declarative/app.inp	16 Dec 2004 00:12:40 -0000	1.7
+++ tests/debugger/declarative/app.inp	30 Apr 2005 07:26:22 -0000
@@ -8,7 +8,7 @@
  finish -n
  dd
  yes
-abort
+quit
  continue
  continue
  continue
Index: tests/debugger/declarative/browse_arg.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/browse_arg.exp,v
retrieving revision 1.6
diff -u -b -r1.6 browse_arg.exp
--- tests/debugger/declarative/browse_arg.exp	11 Apr 2005 06:49:51 -0000	1.6
+++ tests/debugger/declarative/browse_arg.exp	30 Apr 2005 09:13:28 -0000
@@ -17,8 +17,8 @@
  browser> ls
  baz(1, bar)
  browser> quit
-p(1, baz(1, bar))
-Valid? set format verbose
+dd> set format verbose
+dd> print
  p
  1-1
  2-baz
@@ -26,6 +26,7 @@
    2-bar

  Valid? set -B format pretty
+dd> p
  p
  1-1
  2-baz
@@ -33,6 +34,7 @@
    2-bar

  Valid? set -P format pretty
+dd> p
  p(1, baz(1, bar))
  Valid? b -x 2
  Saving term to XML file...
@@ -42,8 +44,7 @@
  	<Int type="int">1</Int>
  	<bar functor="bar" type="browse_arg.foo" arity="0" />
  </baz>
-p(1, baz(1, bar))
-Valid? b --xml
+dd> b --xml
  Saving term to XML file...
  Launching XML browser (this may take some time) ...
  <?xml version="1.0"?>
@@ -64,8 +65,7 @@
  		</List>
  	</List>
  </predicate>
-p(1, baz(1, bar))
-Valid? no
+dd> no
  Found incorrect contour:
  p(1, baz(1, bar))
  Is this a bug? yes
Index: tests/debugger/declarative/browse_arg.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/browse_arg.inp,v
retrieving revision 1.4
diff -u -b -r1.4 browse_arg.inp
--- tests/debugger/declarative/browse_arg.inp	11 Apr 2005 06:49:51 -0000	1.4
+++ tests/debugger/declarative/browse_arg.inp	30 Apr 2005 09:11:36 -0000
@@ -11,8 +11,11 @@
  ls
  quit
  set format verbose
+print
  set -B format pretty
+p
  set -P format pretty
+p
  b -x 2
  b --xml
  no
Index: tests/debugger/declarative/browser_mode.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/browser_mode.exp,v
retrieving revision 1.2
diff -u -b -r1.2 browser_mode.exp
--- tests/debugger/declarative/browser_mode.exp	27 Jan 2005 02:38:58 -0000	1.2
+++ tests/debugger/declarative/browser_mode.exp	30 Apr 2005 09:10:31 -0000
@@ -20,8 +20,7 @@
  browser> mode
  Output
  browser> quit
-p('a', 30)
-Valid? a
+dd> q
  Diagnosis aborted.
        E3:     C2 EXIT pred browser_mode.p/2-0 (nondet)
  mdb> break r
@@ -42,15 +41,13 @@
  browser> mode
  Input
  browser> quit
-Call r('b', _)
-Unsatisfiable? b
+dd> b
  browser> mode 2
  Unbound
  browser> mode 1
  Input
  browser> quit
-Call r('b', _)
-Unsatisfiable? a
+dd> q
  Diagnosis aborted.
        E8:     C3 FAIL pred browser_mode.r/2-0 (semidet)
  mdb> quit -y
Index: tests/debugger/declarative/browser_mode.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/browser_mode.inp,v
retrieving revision 1.1
diff -u -b -r1.1 browser_mode.inp
--- tests/debugger/declarative/browser_mode.inp	18 Jan 2005 03:56:53 -0000	1.1
+++ tests/debugger/declarative/browser_mode.inp	30 Apr 2005 07:26:22 -0000
@@ -12,7 +12,7 @@
  cd ../2
  mode
  quit
-a
+q
  break r
  c
  c
@@ -27,5 +27,5 @@
  mode 2
  mode 1
  quit
-a
+q
  quit -y
Index: tests/debugger/declarative/confirm_abort.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/confirm_abort.exp,v
retrieving revision 1.3
diff -u -b -r1.3 confirm_abort.exp
--- tests/debugger/declarative/confirm_abort.exp	19 Nov 2004 11:54:29 -0000	1.3
+++ tests/debugger/declarative/confirm_abort.exp	30 Apr 2005 09:15:10 -0000
@@ -19,7 +19,8 @@
  Answer one of:
  	y	yes		confirm that the suspect is a bug
  	n	no		do not accept that the suspect is a bug
-	a	abort		abort this diagnosis session and return to mdb
+	b	browse		browse the suspect
+	q	quit		abort this diagnosis session and return to mdb
  	h, ?	help		this help message
  Found incorrect contour:
  q(27)
@@ -27,7 +28,8 @@
  Answer one of:
  	y	yes		confirm that the suspect is a bug
  	n	no		do not accept that the suspect is a bug
-	a	abort		abort this diagnosis session and return to mdb
+	b	browse		browse the suspect
+	q	quit		abort this diagnosis session and return to mdb
  	h, ?	help		this help message
  Found incorrect contour:
  q(27)
@@ -35,18 +37,19 @@
  Answer one of:
  	y	yes		confirm that the suspect is a bug
  	n	no		do not accept that the suspect is a bug
-	a	abort		abort this diagnosis session and return to mdb
+	b	browse		browse the suspect
+	q	quit		abort this diagnosis session and return to mdb
  	h, ?	help		this help message
  Found incorrect contour:
  q(27)
-Is this a bug? abort
+Is this a bug? quit
         5:      2  2 EXIT pred confirm_abort.p/1-0 (det) confirm_abort.m:15 (confirm_abort.m:8)
  mdb> dd
  p(27)
  Valid? [no] n
  Found incorrect contour:
  q(27)
-Is this a bug? a
+Is this a bug? q
         5:      2  2 EXIT pred confirm_abort.p/1-0 (det) confirm_abort.m:15 (confirm_abort.m:8)
  mdb> dd
  p(27)
Index: tests/debugger/declarative/confirm_abort.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/confirm_abort.inp,v
retrieving revision 1.2
diff -u -b -r1.2 confirm_abort.inp
--- tests/debugger/declarative/confirm_abort.inp	19 Nov 2004 11:54:29 -0000	1.2
+++ tests/debugger/declarative/confirm_abort.inp	30 Apr 2005 07:26:22 -0000
@@ -9,10 +9,10 @@
  help
  h
  ?
-abort
+quit
  dd
  n
-a
+q
  dd
  n
  y
Index: tests/debugger/declarative/dependency.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/dependency.exp,v
retrieving revision 1.9
diff -u -b -r1.9 dependency.exp
--- tests/debugger/declarative/dependency.exp	11 Apr 2005 06:43:35 -0000	1.9
+++ tests/debugger/declarative/dependency.exp	30 Apr 2005 09:16:07 -0000
@@ -8,8 +8,7 @@
  turn_on_origin_debug
  Valid? browse 1
  Invalid argument number
-turn_on_origin_debug
-Valid? abort
+dd> quit
  Diagnosis aborted.
         3:      2  2 EXIT pred dependency.turn_on_origin_debug/0-0 (det) dependency.m:69 (dependency.m:12)
  mdb> step
@@ -41,7 +40,7 @@
  browser> mark
  Origin: primitive_op("dependency.m", 22, unification)
  p(1)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
        18:      3  2 EXIT pred dependency.test/1-0 (cc_multi) dependency.m:19 (dependency.m:13)
  mdb> dd
@@ -57,7 +56,7 @@
  browser> mark
  Origin: primitive_op("dependency.m", 29, unification)
  p(1)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
        18:      3  2 EXIT pred dependency.test/1-0 (cc_multi) dependency.m:19 (dependency.m:13)
  mdb> dd
@@ -67,7 +66,7 @@
  browser> mark
  Origin: primitive_op("dependency.m", 41, unification)
  p(1)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
        18:      3  2 EXIT pred dependency.test/1-0 (cc_multi) dependency.m:19 (dependency.m:13)
  mdb> dd
@@ -77,7 +76,7 @@
  browser> mark
  Origin: primitive_op("dependency.m", 22, unification)
  p(1)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
        18:      3  2 EXIT pred dependency.test/1-0 (cc_multi) dependency.m:19 (dependency.m:13)
  mdb> dd
@@ -87,7 +86,7 @@
  browser> mark
  Origin: output(r, any_head_var_from_back(1), [1])
  r(1, [|](3, [|](4, [])), -(3, 4))
-Valid? abort
+Valid? quit
  Diagnosis aborted.
        18:      3  2 EXIT pred dependency.test/1-0 (cc_multi) dependency.m:19 (dependency.m:13)
  mdb> dd
@@ -97,7 +96,7 @@
  browser> mark
  Origin: primitive_op("dependency.m", 43, unification)
  p(1)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
        18:      3  2 EXIT pred dependency.test/1-0 (cc_multi) dependency.m:19 (dependency.m:13)
  mdb> continue
Index: tests/debugger/declarative/dependency.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/dependency.inp,v
retrieving revision 1.3
diff -u -b -r1.3 dependency.inp
--- tests/debugger/declarative/dependency.inp	5 Nov 2004 06:30:21 -0000	1.3
+++ tests/debugger/declarative/dependency.inp	30 Apr 2005 07:26:22 -0000
@@ -3,7 +3,7 @@
  goto 3
  dd
  browse 1
-abort
+quit
  step
  finish
  set depth 20
@@ -14,7 +14,7 @@
  browse 1
  ^1
  mark
-abort
+quit
  dd
  browse 1
  ^2^1
@@ -22,25 +22,25 @@
  browse 2
  print
  mark
-abort
+quit
  dd
  browse 1
  ^2^2^1
  mark
-abort
+quit
  dd
  browse 1
  ^2^2^2^1
  mark
-abort
+quit
  dd
  browse 1
  ^2^2^2^2^1
  mark
-abort
+quit
  dd
  browse 1
  ^2^2^2^2^2
  mark
-abort
+quit
  continue
Index: tests/debugger/declarative/find_origin.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/find_origin.exp,v
retrieving revision 1.4
diff -u -b -r1.4 find_origin.exp
--- tests/debugger/declarative/find_origin.exp	27 Jan 2005 02:38:58 -0000	1.4
+++ tests/debugger/declarative/find_origin.exp	30 Apr 2005 09:16:42 -0000
@@ -41,8 +41,7 @@
  browser> p
  find_origin.polytest4(u("hello"), u("hello"))
  browser> quit
-polytest4(u("hello"), u("hello"))
-Valid? no
+dd> no
  lambda_find_origin_148(u(string), u(u("hello")), u(u("hello")))
  Valid? y
  Call lambda_find_origin_148(u(string), u(u("hello")), v(u("hello")))
Index: tests/debugger/declarative/find_origin.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/find_origin.exp2,v
retrieving revision 1.4
diff -u -b -r1.4 find_origin.exp2
--- tests/debugger/declarative/find_origin.exp2	27 Jan 2005 02:38:58 -0000	1.4
+++ tests/debugger/declarative/find_origin.exp2	30 Apr 2005 12:01:06 -0000
@@ -41,8 +41,7 @@
  browser> p
  find_origin.polytest4(u("hello"), u("hello"))
  browser> quit
-polytest4(u("hello"), u("hello"))
-Valid? no
+dd> no
  lambda_find_origin_148(u(string), u(u("hello")), u(u("hello")))
  Valid? y
  Call lambda_find_origin_148(u(string), u(u("hello")), v(u("hello")))
Index: tests/debugger/declarative/info.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/info.exp,v
retrieving revision 1.2
diff -u -b -r1.2 info.exp
--- tests/debugger/declarative/info.exp	11 Apr 2005 06:43:35 -0000	1.2
+++ tests/debugger/declarative/info.exp	30 Apr 2005 09:18:01 -0000
@@ -13,40 +13,31 @@
  mdb> dd -s divide_and_query
  last([1, 2, 3, 4, 5, 6, 7, 8, ...], t/1)
  Valid? info
-
  Context of current question   : info.m:43 (info.m:15)
  Search mode                   : divide and query
  Estimated questions remaining : 5
  Number of suspect events      : 30
  The current question was chosen because this is the node where the `dd'
  command was issued.
-
-last([1, 2, 3, 4, 5, 6, 7, 8, ...], t/1)
-Valid? n
+dd> n
  last([6, 7, 8, 9, 10], t(10))
  Valid? info
-
  Context of current question   : info.m:43 (info.m:45)
  Search mode                   : divide and query
  Estimated questions remaining : 5
  Number of suspect events      : 30
  The current question was chosen because this node divides the suspect
  area into two regions of 15 and 15 events each.
-
-last([6, 7, 8, 9, 10], t(10))
-Valid? n
+dd> n
  last([9, 10], t(10))
  Valid? info
-
  Context of current question   : info.m:43 (info.m:45)
  Search mode                   : divide and query
  Estimated questions remaining : 4
  Number of suspect events      : 15
  The current question was chosen because this node divides the suspect
  area into two regions of 9 and 6 events each.
-
-last([9, 10], t(10))
-Valid? a
+dd> q
  Diagnosis aborted.
        E3:     C2 EXIT pred info.last/2-0 (semidet)
  mdb> 
@@ -58,64 +49,49 @@
  Valid? n
  last([112, 103, 104, 105, 106, 107, 108], t(108))
  Valid? info
-
  Context of current question : info.m:43 (info.m:45)
  Search mode                 : top down
  Number of suspect events    : 24
  The current question was chosen because this is the next node in the
  top-down search.
-
-last([112, 103, 104, 105, 106, 107, 108], t(108))
-Valid? b 2
+dd> b 2
  browser> mark
  last([108], t(108))
  Valid? info
-
  Context of current question : info.m:43 (info.m:45)
  Search mode                 : binary search on path
  Number of suspect events    : 21
  The current question was chosen because the marked subterm was bound by
  the unification inside the predicate info.last/2 (info.m:43). The path
  to the subterm in the atom is 2.
-
-last([108], t(108))
-Valid? y
+dd> y
  last([104, 105, 106, 107, 108], t(108))
  Valid? info
-
  Context of current question : info.m:43 (info.m:45)
  Search mode                 : binary search on path
  Number of suspect events    : 18
  The current question was chosen because this node divides a path of
  length 6 into two paths of length 3 and 3.
-
-last([104, 105, 106, 107, 108], t(108))
-Valid? n
+dd> n
  last([106, 107, 108], t(108))
  Valid? info
-
  Context of current question : info.m:43 (info.m:45)
  Search mode                 : binary search on path
  Number of suspect events    : 12
  The current question was chosen because this node divides a path of
  length 3 into two paths of length 1 and 2.
-
-last([106, 107, 108], t(108))
-Valid? b 1
+dd> b 1
  browser> cd 1
  browser> mark
  last([105, 106, 107, 108], t(108))
  Valid? info
-
  Context of current question : info.m:43 (info.m:45)
  Search mode                 : binary search on path
  Number of suspect events    : 6
  The current question was chosen because tracking of the marked subterm
  was stopped here, because the binding node lies in a portion of the tree
  which has been eliminated.
-
-last([105, 106, 107, 108], t(108))
-Valid? a
+dd> q
  Diagnosis aborted.
        E5:     C3 EXIT pred info.last/2-0 (semidet)
  mdb> break q
@@ -133,16 +109,13 @@
  browser> mark
  f(0, "lala") = t(t(t("lala")))
  Valid? info
-
  Context of current question : info.m:51 (info.m:34)
  Search mode                 : binary search on path
  Number of suspect events    : 6
  The current question was chosen because the marked subterm was bound by
  the unification inside the function info.f/3 (info.m:52). The path to
  the subterm in the atom is 3/1/1.
-
-f(0, "lala") = t(t(t("lala")))
-Valid? a
+dd> q
  Diagnosis aborted.
        E7:     C4 EXIT pred info.q/4-0 (det)
  mdb> 
@@ -155,30 +128,24 @@
  browser> mark
  fproc(1) = 2
  Valid? info
-
  Context of current question : info.m:57 (info.m:37)
  Search mode                 : binary search on path
  Number of suspect events    : 6
  The current question was chosen because the marked subterm was bound by
  the foreign procedure call inside the function info.fproc/2 (info.m:57).
  The path to the subterm in the atom is 2.
-
-fproc(1) = 2
-Valid? n
+dd> n
  Found incorrect contour:
  fproc(1) = 2
  Is this a bug? n
  fproc(1) = 2
  Valid? [no] info
-
  Context of current question : info.m:57 (info.m:37)
  Search mode                 : top down
  Number of suspect events    : 6
  The current question was chosen because this node is being revised,
  because of an unsuccessful previous bug search.
-
-fproc(1) = 2
-Valid? [no] a
+dd> q
  Diagnosis aborted.
        E9:     C5 EXIT pred info.q/4-0 (det)
  mdb> quit -y
Index: tests/debugger/declarative/info.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/info.inp,v
retrieving revision 1.2
diff -u -b -r1.2 info.inp
--- tests/debugger/declarative/info.inp	11 Apr 2005 06:43:35 -0000	1.2
+++ tests/debugger/declarative/info.inp	30 Apr 2005 07:26:22 -0000
@@ -11,7 +11,7 @@
  info
  n
  info
-a
+q

  f
  dd
@@ -28,7 +28,7 @@
  cd 1
  mark
  info
-a
+q
  break q
  c
  delete *
@@ -38,7 +38,7 @@
  cd 1/1
  mark
  info
-a
+q

  f
  dd
@@ -48,5 +48,5 @@
  n
  n
  info
-a
+q
  quit -y
Index: tests/debugger/declarative/io_stream_test.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/io_stream_test.exp,v
retrieving revision 1.5
diff -u -b -r1.5 io_stream_test.exp
--- tests/debugger/declarative/io_stream_test.exp	6 Jan 2005 03:20:12 -0000	1.5
+++ tests/debugger/declarative/io_stream_test.exp	30 Apr 2005 09:18:24 -0000
@@ -25,11 +25,9 @@
  Valid? print 1-2
  stream(0, input, text, file("tabled_read_decl.data"))
  1456
-test(stream(0, input, text, file("tabled_read_decl.data")), 1456, _, _)
-Valid? p io 1-2
+dd> p io 1-2
  No such IO action.
-test(stream(0, input, text, file("tabled_read_decl.data")), 1456, _, _)
-Valid? no
+dd> no
  test_2(stream(0, input, text, file("tabled_read_decl.data")), 1, 1456, _, _)
  Valid? yes
  Found incorrect contour:
Index: tests/debugger/declarative/io_stream_test.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/io_stream_test.exp2,v
retrieving revision 1.6
diff -u -b -r1.6 io_stream_test.exp2
--- tests/debugger/declarative/io_stream_test.exp2	6 Apr 2005 01:11:31 -0000	1.6
+++ tests/debugger/declarative/io_stream_test.exp2	30 Apr 2005 12:01:27 -0000
@@ -30,22 +30,10 @@
  Valid? print 1-2
  stream(0, input, text, file("tabled_read_decl.data"))
  1123
-test(stream(0, input, text, file("tabled_read_decl.data")), 1123, _, _)
-4 tabled IO actions:
+dd> p io 1-2
  read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 49)
  read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 50)
-read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 51)
-read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 10)
-Valid? p io 1-2
-read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 49)
-read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 50)
-test(stream(0, input, text, file("tabled_read_decl.data")), 1123, _, _)
-4 tabled IO actions:
-read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 49)
-read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 50)
-read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 51)
-read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 10)
-Valid? no
+dd> no
  test_2(stream(0, input, text, file("tabled_read_decl.data")), 1, 1123, _, _)
  4 tabled IO actions:
  read_char_code(stream(0, input, text, file("tabled_read_decl.data")), 49)
Index: tests/debugger/declarative/mapinit.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/mapinit.exp,v
retrieving revision 1.2
diff -u -b -r1.2 mapinit.exp
--- tests/debugger/declarative/mapinit.exp	16 Dec 2004 00:12:40 -0000	1.2
+++ tests/debugger/declarative/mapinit.exp	30 Apr 2005 09:18:44 -0000
@@ -7,7 +7,7 @@
        E3:     C2 EXIT pred mapinit.xmap_init/1-0 (det) mapinit.m:37 (mapinit.m:29)
  mdb> dd
  xmap_init(empty)
-Valid? a
+Valid? q
  Diagnosis aborted.
        E3:     C2 EXIT pred mapinit.xmap_init/1-0 (det) mapinit.m:37 (mapinit.m:29)
  mdb> c
Index: tests/debugger/declarative/mapinit.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/mapinit.inp,v
retrieving revision 1.2
diff -u -b -r1.2 mapinit.inp
--- tests/debugger/declarative/mapinit.inp	16 Dec 2004 00:12:40 -0000	1.2
+++ tests/debugger/declarative/mapinit.inp	30 Apr 2005 07:26:22 -0000
@@ -2,5 +2,5 @@
  step
  finish
  dd
-a
+q
  c
Index: tests/debugger/declarative/output_term_dep.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/output_term_dep.exp,v
retrieving revision 1.10
diff -u -b -r1.10 output_term_dep.exp
--- tests/debugger/declarative/output_term_dep.exp	27 Jan 2005 02:38:59 -0000	1.10
+++ tests/debugger/declarative/output_term_dep.exp	30 Apr 2005 09:20:07 -0000
@@ -140,7 +140,7 @@
  Valid? browse 2
  browser> mark
  sa(7)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
       E15:     C8 EXIT pred output_term_dep.s/3-0 (nondet)
  mdb> continue
@@ -152,7 +152,7 @@
  Valid? browse 3
  browser> mark
  sc(155)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
       E17:     C8 EXIT pred output_term_dep.s/3-0 (nondet)
  mdb> continue
@@ -164,7 +164,7 @@
  Valid? browse 3
  browser> mark
  sa(7)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
       E19:     C8 EXIT pred output_term_dep.s/3-0 (nondet)
  mdb> continue
@@ -176,7 +176,7 @@
  Valid? browse 3
  browser> mark
  sc(155)
-Valid? abort
+Valid? quit
  Diagnosis aborted.
       E21:     C8 EXIT pred output_term_dep.s/3-0 (nondet)
  mdb> continue
Index: tests/debugger/declarative/output_term_dep.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/output_term_dep.inp,v
retrieving revision 1.3
diff -u -b -r1.3 output_term_dep.inp
--- tests/debugger/declarative/output_term_dep.inp	30 Apr 2002 10:12:44 -0000	1.3
+++ tests/debugger/declarative/output_term_dep.inp	30 Apr 2005 07:26:22 -0000
@@ -60,25 +60,25 @@
  dd
  browse 2
  mark
-abort
+quit
  continue
  finish
  dd
  browse 3
  mark
-abort
+quit
  continue
  finish
  dd
  browse 3
  mark
-abort
+quit
  continue
  finish
  dd
  browse 3
  mark
-abort
+quit
  continue
  finish
  continue
Index: tests/debugger/declarative/resume.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/resume.exp,v
retrieving revision 1.1
diff -u -b -r1.1 resume.exp
--- tests/debugger/declarative/resume.exp	2 Mar 2005 01:20:21 -0000	1.1
+++ tests/debugger/declarative/resume.exp	30 Apr 2005 09:20:23 -0000
@@ -29,7 +29,7 @@
        E6:     C4 CALL pred resume.wrapper/6-0 (semidet)
  mdb> dd -r
  l([3, 4, 5]) = 5
-Valid? a
+Valid? q
  Diagnosis aborted.
        E6:     C4 CALL pred resume.wrapper/6-0 (semidet)
  mdb> dd -r
Index: tests/debugger/declarative/resume.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/resume.inp,v
retrieving revision 1.1
diff -u -b -r1.1 resume.inp
--- tests/debugger/declarative/resume.inp	2 Mar 2005 01:20:22 -0000	1.1
+++ tests/debugger/declarative/resume.inp	30 Apr 2005 07:26:22 -0000
@@ -14,7 +14,7 @@
  c
  retry
  dd -r
-a
+q
  dd -r
  pd
  print
Index: tests/debugger/declarative/skip.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/skip.exp,v
retrieving revision 1.2
diff -u -b -r1.2 skip.exp
--- tests/debugger/declarative/skip.exp	6 Jan 2005 03:20:13 -0000	1.2
+++ tests/debugger/declarative/skip.exp	30 Apr 2005 09:20:36 -0000
@@ -81,7 +81,7 @@
        E9:     C6 EXIT pred skip.c/2-0 (det)
  mdb> dd
  c(72, 72)
-Valid? [no] a
+Valid? [no] q
  Diagnosis aborted.
        E9:     C6 EXIT pred skip.c/2-0 (det)
  mdb> break a
Index: tests/debugger/declarative/skip.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/skip.inp,v
retrieving revision 1.1
diff -u -b -r1.1 skip.inp
--- tests/debugger/declarative/skip.inp	19 Nov 2004 11:54:41 -0000	1.1
+++ tests/debugger/declarative/skip.inp	30 Apr 2005 07:26:22 -0000
@@ -37,7 +37,7 @@
  y
  y
  dd
-a
+q
  break a
  c
  retry
Index: tests/debugger/declarative/solutions.exp3
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/solutions.exp3,v
retrieving revision 1.2
diff -u -b -r1.2 solutions.exp3
--- tests/debugger/declarative/solutions.exp3	6 Jan 2005 03:20:13 -0000	1.2
+++ tests/debugger/declarative/solutions.exp3	1 May 2005 03:47:05 -0000
@@ -22,8 +22,7 @@
  q(1, 2)
  Valid? yesy
  Unknown command, 'h' for help.
-q(1, 2)
-Valid? yes
+dd> yes
  q(1, 3)
  Valid? yes
  Call q(1, _)
Index: tests/debugger/declarative/tabled_read_decl.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/tabled_read_decl.exp,v
retrieving revision 1.13
diff -u -b -r1.13 tabled_read_decl.exp
--- tests/debugger/declarative/tabled_read_decl.exp	6 Apr 2005 01:11:31 -0000	1.13
+++ tests/debugger/declarative/tabled_read_decl.exp	30 Apr 2005 09:45:16 -0000
@@ -25,47 +25,21 @@
  Valid? print 1-2
  '<<c_pointer>>'
  1123
-test('<<c_pointer>>', 1123, _, _)
-4 tabled IO actions:
+dd> p io 1-2
  read_char_code('<<c_pointer>>', 49)
  read_char_code('<<c_pointer>>', 50)
-read_char_code('<<c_pointer>>', 51)
-read_char_code('<<c_pointer>>', 10)
-Valid? p io 1-2
-read_char_code('<<c_pointer>>', 49)
-read_char_code('<<c_pointer>>', 50)
-test('<<c_pointer>>', 1123, _, _)
-4 tabled IO actions:
-read_char_code('<<c_pointer>>', 49)
-read_char_code('<<c_pointer>>', 50)
-read_char_code('<<c_pointer>>', 51)
-read_char_code('<<c_pointer>>', 10)
-Valid? print io 2-1
+dd> print io 2-1
  read_char_code('<<c_pointer>>', 49)
  read_char_code('<<c_pointer>>', 50)
-test('<<c_pointer>>', 1123, _, _)
-4 tabled IO actions:
-read_char_code('<<c_pointer>>', 49)
-read_char_code('<<c_pointer>>', 50)
-read_char_code('<<c_pointer>>', 51)
-read_char_code('<<c_pointer>>', 10)
-Valid? browse io 4
+dd> browse io 4
  browser> print
  read_char_code('<<c_pointer>>', 10)
  browser> set num_io_actions 3
  browser> quit
-test('<<c_pointer>>', 1123, _, _)
-4 tabled IO actions: too many to show
-Valid? browse 1
+dd> browse 1
  browser> set num_io_actions 10
  browser> quit
-test('<<c_pointer>>', 1123, _, _)
-4 tabled IO actions:
-read_char_code('<<c_pointer>>', 49)
-read_char_code('<<c_pointer>>', 50)
-read_char_code('<<c_pointer>>', 51)
-read_char_code('<<c_pointer>>', 10)
-Valid? no
+dd> no
  test_2('<<c_pointer>>', 1, 1123, _, _)
  4 tabled IO actions:
  read_char_code('<<c_pointer>>', 49)
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.85
diff -u -b -r1.85 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c	13 Apr 2005 03:50:55 -0000	1.85
+++ trace/mercury_trace_declarative.c	30 Apr 2005 03:30:40 -0000
@@ -44,6 +44,7 @@

  #include "mercury_trace.h"
  #include "mercury_trace_browse.h"
+#include "mercury_trace_help.h"
  #include "mercury_trace_internal.h"
  #include "mercury_trace_tables.h"
  #include "mercury_trace_util.h"
@@ -1346,6 +1347,7 @@
  			MR_trace_node_store = 0;
  			MR_DD_decl_diagnosis_state_init(&mdb_in, &mdb_out,
  				MR_trace_browser_persistent_state,
+				MR_trace_help_system,
  				&MR_trace_front_end_state);
  		);
  		done = MR_TRUE;
Index: trace/mercury_trace_help.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_help.c,v
retrieving revision 1.24
diff -u -b -r1.24 mercury_trace_help.c
--- trace/mercury_trace_help.c	28 Jan 2005 02:47:42 -0000	1.24
+++ trace/mercury_trace_help.c	30 Apr 2005 08:21:31 -0000
@@ -41,7 +41,7 @@

  #include <stdio.h>

-static  MR_Word     MR_trace_help_system;
+MR_Word             MR_trace_help_system;
  static  MR_TypeInfo MR_trace_help_system_type;

  static  const char  *MR_trace_help_add_node(MR_Word path, const char *name,
Index: trace/mercury_trace_help.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_help.h,v
retrieving revision 1.2
diff -u -b -r1.2 mercury_trace_help.h
--- trace/mercury_trace_help.h	6 Mar 2002 14:35:03 -0000	1.2
+++ trace/mercury_trace_help.h	30 Apr 2005 03:30:08 -0000
@@ -16,6 +16,12 @@
  #include "mercury_trace_completion.h"

  /*
+** This global keeps a reference to the help system.
+*/
+
+extern  MR_Word     	MR_trace_help_system;
+
+/*
  ** These function add a help node, which must a category or an item
  ** within a category. It returns NULL if the addition was successful,
  ** and a pointer to an error message otherwise.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list