[m-rev.] diff: fix declarative debugger `params' and `actions' commands

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Jun 5 16:27:08 AEST 2006


Estimated hours taken: 2
Branches: main, release.

Fix two bugs in the declarative debugger's command handling.  The `params'
command wasn't being parsed and the code to handle the `actions' command
expected it to be called `num_io_actions'.

browser/declarative_user.m:
	Fix the command handler for `actions'.

	Add a command handler for the `params' command.

	Fix a typo: s/supress/suppress/

browser/parse.m:
browser/browser_info.m:
	Fix some formatting.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/dd_params.m:
tests/debugger/declarative/dd_params.inp:
tests/debugger/declarative/dd_params.exp:
	Test case for the above.

Julien.

Index: browser/browser_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/browser_info.m,v
retrieving revision 1.27
diff -u -r1.27 browser_info.m
--- browser/browser_info.m	4 Apr 2006 07:37:10 -0000	1.27
+++ browser/browser_info.m	5 Jun 2006 06:03:56 -0000
@@ -5,12 +5,12 @@
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
 %---------------------------------------------------------------------------%
-
+%
 % File: browser_info.m
 % Main author: Mark Brown
-
+%
 % Basic data structures used by the browser.
-
+%
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%

@@ -646,13 +646,13 @@
 set_browser_param_from_option_table(FromBrowser, OptionTable, Setting,
         !State) :-
     set_browser_param(FromBrowser,
-        lookup_bool_option(OptionTable, set_print):bool,
-        lookup_bool_option(OptionTable, set_browse):bool,
-        lookup_bool_option(OptionTable, set_print_all):bool,
-        lookup_bool_option(OptionTable, set_flat):bool,
-        lookup_bool_option(OptionTable, set_raw_pretty):bool,
-        lookup_bool_option(OptionTable, set_verbose):bool,
-        lookup_bool_option(OptionTable, set_pretty):bool,
+        lookup_bool_option(OptionTable, set_print)      : bool,
+        lookup_bool_option(OptionTable, set_browse)     : bool,
+        lookup_bool_option(OptionTable, set_print_all)  : bool,
+        lookup_bool_option(OptionTable, set_flat)       : bool,
+        lookup_bool_option(OptionTable, set_raw_pretty) : bool,
+        lookup_bool_option(OptionTable, set_verbose)    : bool,
+        lookup_bool_option(OptionTable, set_pretty)     : bool,
         Setting, !State).

 :- pred affected_caller_types(bool::in, maybe(browse_caller_type)::in,
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.60
diff -u -r1.60 declarative_user.m
--- browser/declarative_user.m	4 Apr 2006 07:37:10 -0000	1.60
+++ browser/declarative_user.m	5 Jun 2006 06:05:15 -0000
@@ -5,16 +5,15 @@
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
 %-----------------------------------------------------------------------------%
-
+%
 % File: declarative_user.m.
 % Author: Mark Brown.
-
-% Purpose:
-%   This module performs all the user interaction of the front
-% end of the declarative debugger.  It is responsible for displaying
-% questions and bugs in a human-readable format, and for getting
-% responses to debugger queries from the user.
-
+%
+% This module performs all the user interaction of the front end of the
+% declarative debugger.  It is responsible for displaying questions and bugs
+% in a human-readable format, and for getting responses to debugger queries
+% from the user.
+%
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%

@@ -40,9 +39,9 @@
     ;       trust_module(decl_question(T))

     ;       show_info(io.output_stream)
-            % Request that the analyser display some information
-            % about the state of the search and the current
-            % question to the given output stream.
+            % Request that the analyser display some information about the
+            % state of the search and the current question to the given output
+            % stream.

     ;       change_search(user_search_mode)
             % Request that a new search strategy be used.
@@ -198,7 +197,7 @@
                 browser             :: browser_persistent_state,

                 % Yes if the question should be displayed when querying
-                % the user. This is used to supress the displaying of the
+                % the user. This is used to suppress 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,
@@ -910,7 +909,7 @@
 cmd_handler("size",     format_param_arg_cmd("size")).
 cmd_handler("width",    format_param_arg_cmd("width")).
 cmd_handler("lines",    format_param_arg_cmd("lines")).
-cmd_handler("num_io_actions",  num_io_actions_cmd).
+cmd_handler("actions",  num_io_actions_cmd).
 % cmd_handler("xml_browser_cmd", set_xml_browser_cmd_cmd).
 % cmd_handler("xml_tmp_filename", set_xml_tmp_filename_cmd).
 cmd_handler("t",        trust_arg_cmd).
@@ -918,6 +917,7 @@
 cmd_handler("mode",     search_mode_cmd).
 cmd_handler("m",        search_mode_cmd).
 cmd_handler("undo",     one_word_cmd(undo)).
+cmd_handler("params",   one_word_cmd(param_command(print_params))).

 :- func one_word_cmd(user_command::in, list(string)::in) = (user_command::out)
     is semidet.
Index: browser/parse.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/parse.m,v
retrieving revision 1.29
diff -u -r1.29 parse.m
--- browser/parse.m	4 Apr 2006 07:37:10 -0000	1.29
+++ browser/parse.m	5 Jun 2006 05:46:01 -0000
@@ -169,7 +169,8 @@

     % If the term browser is called from the external debugger, the term
     % browser commands are send through the socket via terms of type
-    %% external_request.
+    % external_request.
+    %
 :- type external_request
     ---> external_request(string).

Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.92
diff -u -r1.92 Mmakefile
--- tests/debugger/declarative/Mmakefile	24 Mar 2006 04:40:54 -0000	1.92
+++ tests/debugger/declarative/Mmakefile	5 Jun 2006 06:18:30 -0000
@@ -19,6 +19,7 @@
 	comp_gen		\
 	confirm_abort		\
 	change_search		\
+	dd_params		\
 	deep_warning		\
 	dependency		\
 	dependency2		\
@@ -262,6 +263,10 @@
 		> change_search.out 2>&1 \
 	|| { grep . $@ /dev/null; exit 1; }

+dd_params.out: dd_params dd_params.inp
+	$(MDB) ./dd_params < dd_params.inp > dd_params.out 2>&1 \
+	|| { grep . $@ /dev/null; exit 1; }
+
 deep_warning.out: deep_warning deep_warning.inp
 	$(MDB) ./deep_warning < deep_warning.inp > deep_warning.out 2>&1 \
 	|| { grep . $@ /dev/null; exit 1; }
Index: tests/debugger/declarative/dd_params.exp
===================================================================
RCS file: tests/debugger/declarative/dd_params.exp
diff -N tests/debugger/declarative/dd_params.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/dd_params.exp	5 Jun 2006 06:20:32 -0000
@@ -0,0 +1,64 @@
+       1:      1  1 CALL pred dd_params.main/2-0 (det) dd_params.m:10
+mdb> echo on
+Command echo enabled.
+mdb> register --quiet
+mdb> break p
+ 0: + stop  interface pred dd_params.p/2-0 (det)
+mdb> continue
+       2:      2  2 CALL pred dd_params.p/2-0 (det) dd_params.m:22 (dd_params.m:11)
+mdb> finish
+       3:      2  2 EXIT pred dd_params.p/2-0 (det) dd_params.m:22 (dd_params.m:11)
+mdb> dd -d 3 -n 7
+p(1, baz(1, bar))
+Valid? params
+Browser default format: flat
+                                 depth     size      width     lines
+Browser flat:                    10        30        80        25
+Browser verbose:                 10        30        80        25
+Browser pretty:                  10        30        80        25
+Browser raw_pretty:              10        30        80        25
+
+Print default format: flat
+                                 depth     size      width     lines
+Print flat:                      3         10        80        25
+Print verbose:                   3         10        80        25
+Print pretty:                    3         10        80        25
+Print raw_pretty:                3         10        80        25
+
+Printall default format: flat
+                                 depth     size      width     lines
+Printall flat:                   3         10        80        2
+Printall verbose:                3         10        80        5
+Printall pretty:                 3         10        80        2
+Printall raw_pretty:             3         10        80        2
+
+Number of I/O actions printed is: 20
+dd> actions 10
+dd> params
+Browser default format: flat
+                                 depth     size      width     lines
+Browser flat:                    10        30        80        25
+Browser verbose:                 10        30        80        25
+Browser pretty:                  10        30        80        25
+Browser raw_pretty:              10        30        80        25
+
+Print default format: flat
+                                 depth     size      width     lines
+Print flat:                      3         10        80        25
+Print verbose:                   3         10        80        25
+Print pretty:                    3         10        80        25
+Print raw_pretty:                3         10        80        25
+
+Printall default format: flat
+                                 depth     size      width     lines
+Printall flat:                   3         10        80        2
+Printall verbose:                3         10        80        5
+Printall pretty:                 3         10        80        2
+Printall raw_pretty:             3         10        80        2
+
+Number of I/O actions printed is: 10
+dd> quit
+Diagnosis aborted.
+       3:      2  2 EXIT pred dd_params.p/2-0 (det) dd_params.m:22 (dd_params.m:11)
+mdb> continue
+baz(1, bar)
Index: tests/debugger/declarative/dd_params.inp
===================================================================
RCS file: tests/debugger/declarative/dd_params.inp
diff -N tests/debugger/declarative/dd_params.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/dd_params.inp	5 Jun 2006 06:20:09 -0000
@@ -0,0 +1,11 @@
+echo on
+register --quiet
+break p
+continue
+finish
+dd -d 3 -n 7
+params
+actions 10
+params
+quit
+continue
Index: tests/debugger/declarative/dd_params.m
===================================================================
RCS file: tests/debugger/declarative/dd_params.m
diff -N tests/debugger/declarative/dd_params.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/dd_params.m	5 Jun 2006 06:19:18 -0000
@@ -0,0 +1,23 @@
+% Invoking the commands `params' and `actions' from within the
+% declarative debugger was broken in rotd-2006-06-04.
+%
+:- module dd_params.
+:- interface.
+:- import_module io.
+:- pred main(io::di, io::uo) is det.
+:- implementation.
+
+main(!IO) :-
+	p(1, X),
+	io.write(X, !IO),
+	io.nl(!IO).
+
+:- type foo
+	--->	bar
+	;	baz(int, foo).
+
+:- pred p(int, foo).
+:- mode p(in, out) is det.
+
+p(N, baz(N, bar)).
+

--------------------------------------------------------------------------
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