[m-rev.] for review: dd_speedtest
Ian MacLarty
maclarty at cs.mu.OZ.AU
Wed Aug 3 23:38:28 AEST 2005
For review by anyone.
Estimated hours taken: 4
Branches: main
Include a script to test the performance of the debugger in the tools
directory.
Add a --test dd command option. The --test option causes the declarative
debugger to simulate a session where the user answers `no' to all questions
until a bug is found.
Remove the dd_dd mdb command and add a --debug option to the dd command which
does the same thing. The double maintenance of the dd_dd and dd commands was
becoming onerous.
browser/declarative_debugger.m:
Export a predicate to set the testing flag in the user state.
browser/declarative_oracle.m:
Add a predicate to set the testing flag of the user state.
browser/declarative_user.m:
Add a new flag to the user state which indicates whether user answers
should be simulated.
If the new flag is set then simulate answers instead of asking the
user.
doc/user_guide.texi:
Document the --test and --debug developer options.
tools/dd_speedtest:
Script for testing the performance of the declarative debugger.
tools/extract_dd_stats.awk:
Script for summarizing the output of dd_speedtest.
trace/mercury_trace_declarative.c:
Add a predicate to set the testing flag of the diagnoser.
Rename the global variable which says whether the declarative debugger
is being debugged.
Use the -p ps option to print the Memory consumption of the current
process instead of using grep.
trace/mercury_trace_declarative.h:
Fix a typo.
Export the predicate to set the testing flag.
Rename the global variable which says whether the declarative debugger
is being debugged.
trace/mercury_trace_internal.c:
Add the --test and --debug options and remove the dd_dd command.
Index: browser/declarative_debugger.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_debugger.m,v
retrieving revision 1.61
diff -u -b -r1.61 declarative_debugger.m
--- browser/declarative_debugger.m 28 Jul 2005 06:44:07 -0000 1.61
+++ browser/declarative_debugger.m 3 Aug 2005 12:57:57 -0000
@@ -584,6 +584,20 @@
diagnoser_state_init_store(InStr, OutStr, Browser, HelpSystem, Diagnoser) :-
diagnoser_state_init(InStr, OutStr, Browser, HelpSystem, Diagnoser).
+
+ % Set the testing flag of the user_state in the given diagnoser.
+ %
+:- pred set_diagnoser_testing_flag(bool::in,
+ diagnoser_state(trace_node_id)::in,
+ diagnoser_state(trace_node_id)::out) is det.
+
+:- pragma export(set_diagnoser_testing_flag(in, in, out),
+ "MR_DD_decl_set_diagnoser_testing_flag").
+
+set_diagnoser_testing_flag(Testing, !Diagnoser) :-
+ Oracle0 = !.Diagnoser ^ oracle_state,
+ set_oracle_testing_flag(Testing, Oracle0, Oracle),
+ !:Diagnoser = !.Diagnoser ^ oracle_state := Oracle.
:- pred set_fallback_search_mode(
mdb.declarative_analyser.search_mode::in,
Index: browser/declarative_oracle.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_oracle.m,v
retrieving revision 1.44
diff -u -b -r1.44 declarative_oracle.m
--- browser/declarative_oracle.m 28 Jul 2005 06:44:07 -0000 1.44
+++ browser/declarative_oracle.m 3 Aug 2005 12:58:42 -0000
@@ -142,6 +142,11 @@
%
:- func get_user_output_stream(oracle_state) = io.output_stream.
+ % Set the testing flag of the user_state in the given oracle.
+ %
+:- pred set_oracle_testing_flag(bool::in, oracle_state::in, oracle_state::out)
+ is det.
+
%-----------------------------------------------------------------------------%
:- implementation.
@@ -731,3 +736,8 @@
get_user_output_stream(Oracle) = mdb.declarative_user.get_user_output_stream(
Oracle ^ user_state).
+
+set_oracle_testing_flag(Testing, !Oracle) :-
+ User0 = !.Oracle ^ user_state,
+ set_user_testing_flag(Testing, User0, User),
+ !:Oracle = !.Oracle ^ user_state := User.
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.50
diff -u -b -r1.50 declarative_user.m
--- browser/declarative_user.m 28 Jul 2005 06:44:07 -0000 1.50
+++ browser/declarative_user.m 3 Aug 2005 12:59:48 -0000
@@ -20,6 +20,7 @@
:- import_module mdb.declarative_debugger.
:- import_module mdb.help.
+:- import_module bool.
:- import_module io.
:- type user_question(T)
@@ -71,6 +72,11 @@
%
:- func get_user_output_stream(user_state) = io.output_stream.
+ % Set the testing flag of the user_state.
+ %
+:- pred set_user_testing_flag(bool::in, user_state::in, user_state::out)
+ is det.
+
%-----------------------------------------------------------------------------%
:- implementation.
@@ -109,17 +115,29 @@
% answer the question (such as an `info'
% command).
display_question :: bool,
- help_system :: help.system
+ help_system :: help.system,
+
+ % If this following flag is set to yes then
+ % user responses will be simulated and will
+ % always be `no', except when confirmining a
+ % bug in which case the response will be `yes'.
+ testing :: bool
).
user_state_init(InStr, OutStr, Browser, HelpSystem,
- user(InStr, OutStr, Browser, yes, HelpSystem)).
+ user(InStr, OutStr, Browser, yes, HelpSystem, no)).
%-----------------------------------------------------------------------------%
query_user(UserQuestion, Response, !User, !IO) :-
Question = get_decl_question(UserQuestion),
(
+ !.User ^ testing = yes,
+ Node = get_decl_question_node(Question),
+ Response = user_answer(Question, truth_value(Node, erroneous))
+ ;
+ !.User ^ testing = no,
+ (
!.User ^ display_question = yes,
write_decl_question(Question, !.User, !IO),
user_question_prompt(UserQuestion, Prompt),
@@ -136,6 +154,7 @@
!:User = !.User ^ display_question := yes
;
true
+ )
).
:- pred handle_command(user_command::in, user_question(T)::in,
@@ -933,6 +952,11 @@
%-----------------------------------------------------------------------------%
user_confirm_bug(Bug, Response, !User, !IO) :-
+ (
+ !.User ^ testing = yes,
+ Response = confirm_bug
+ ;
+ !.User ^ testing = no,
write_decl_bug(Bug, !.User, !IO),
get_command("Is this a bug? ", Command, !User, !IO),
(
@@ -961,12 +985,13 @@
Command = browse_io(ActionNum)
->
decl_bug_io_actions(Bug, MaybeIoActions),
- browse_chosen_io_action(MaybeIoActions, ActionNum, _MaybeMark,
- !User, !IO),
+ browse_chosen_io_action(MaybeIoActions, ActionNum,
+ _MaybeMark, !User, !IO),
user_confirm_bug(Bug, Response, !User, !IO)
;
user_confirm_bug_help(!.User, !IO),
user_confirm_bug(Bug, Response, !User, !IO)
+ )
).
%-----------------------------------------------------------------------------%
@@ -1203,5 +1228,7 @@
!:User = !.User ^ browser := Browser.
get_user_output_stream(User) = User ^ outstr.
+
+set_user_testing_flag(Testing, User, User ^ testing := Testing).
%-----------------------------------------------------------------------------%
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.448
diff -u -b -r1.448 user_guide.texi
--- doc/user_guide.texi 1 Aug 2005 02:40:05 -0000 1.448
+++ doc/user_guide.texi 2 Aug 2005 14:04:56 -0000
@@ -3352,17 +3352,31 @@
@sp 1
@table @code
@item dd [-r] [-n at var{nodes}] [-s at var{search-mode}]
- at c @item dd [--assume-all-io-is-tabled] [-d at var{depth}]
+ at c @item dd [--assume-all-io-is-tabled] [-d at var{depth}] [-t]
+ at c [--debug [filename]]
@c The --assume-all-io-is-tabled option is for developers only. Specifying it
@c makes an assertion, and if the assertion is incorrect, the resulting
@c behaviour would be hard for non-developers to understand. The option is
@c therefore deliberately not documented.
+ at c @sp 1
@c The value of the @samp{-d} or @samp{--depth} option determines
@c how much of the annotated trace to build initially. Subsequent runs
@c will try to add @var{nodes} events to the annotated trace, but initially
@c there is not enough information available to do this. We do not document
@c this option since it requires an understanding of the internal workings of
@c the declarative debugger.
+ at c @sp 1
+ at c The @samp{-t} or @samp{--test} option causes the declarative debugger
+ at c to simulate a user who answers `no' to all questions, except for
+ at c `Is this a bug?' questions to which the simulated user answers `yes'.
+ at c @sp 1
+ at c The @samp{--debug} option causes events generated by the declarative
+ at c debugger to become visible. This allows the declarative debugger to be
+ at c debugged.
+ at c If a filename is provided, the front end of the debugger is not called
+ at c at all. Instead a representation of the debugging tree is dumped to
+ at c the file.
+ at c @sp 1
Starts declarative debugging using the current event as the initial symptom.
@sp 1
When searching for bugs the declarative debugger needs to keep portions of the
@@ -3830,22 +3844,6 @@
@sp 1
@item unhide_events off
Tells the debugger to hide events that are normally hidden.
- at sp 1
- at item dd_dd
- at c @item dd_dd [-d at var{depth}] [-s at var{search-mode}] [filename]
- at c @item dd_dd [--assume-all-io-is-tabled]
- at c The --assume-all-io-is-tabled option is for developers only. Specifying it
- at c makes an assertion, and if the assertion is incorrect, the resulting
- at c behaviour would be hard for non-developers to understand. The option is
- at c therefore deliberately not documented.
-Starts declarative debugging
-using the current event as the initial symptom,
-but unlike the standard @samp{dd} command,
-does not turn off the events generated by the declarative debugger itself.
-This makes it possible to debug the declarative debugger itself.
- at c If a filename is provided, the front end of the debugger is not called
- at c at all. Instead a representation of the debugging tree is dumped to
- at c the file, which may help diagnose problems in the debugger itself.
@sp 1
@item table @var{proc} [@var{num1} ...]
@kindex table (mdb command)
Index: tools/dd_speedtest
===================================================================
RCS file: tools/dd_speedtest
diff -N tools/dd_speedtest
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tools/dd_speedtest 3 Aug 2005 12:55:27 -0000
@@ -0,0 +1,101 @@
+#!/bin/sh
+#---------------------------------------------------------------------------#
+# Copyright (C) 2005 The University of Melbourne.
+# This file may only be copied under the terms of the GNU General
+# Public License - see the file COPYING in the Mercury distribution.
+#---------------------------------------------------------------------------#
+#
+# This script runs the declarative debugger on a given test case.
+# The test program should be compiled in a .decldebug or .debug grade.
+# A simulated debugging session is run where the program is debugged from
+# the top call to main and `no' is answered to all questions until a bug is
+# found.
+# Before compiling the test program the following should be
+# included in the trace/Mmake.trace.params file in the workspace which will be
+# used to compile the test program:
+# EXTRA_CFLAGS=-DMR_DD_PRINT_EDT_STATS
+#
+# This script is useful for comparing the memory consumption and/or the
+# speed of different versions of the declarative debugger.
+# Typical usage might be:
+# dd_speedtest -c ./myprog -n 10 -d "-s divide_and_query -n 50000"
+# where myprog is a program compiled in a .debug or .decldebug grade that
+# generates lots of events (otherwise the times will be too small).
+#
+# The output of this script is two files: dd.stats which contains
+# data for each reexecution of the program performed by the declarative
+# debugger; and dd.stdout which records the output of the debugging session.
+#
+# The script extract_dd_stats.awk in this directory can be used to summarize
+# the data in dd.stats.
+#
+# This script will append data to dd.stats and dd.stdout, so they should be
+# deleted first if this behaviour is not desired.
+#
+
+usage="Usage: dd_speedtest -c cmd [-n num_tests] [-d dd_options]"
+cmd=""
+limit=6
+ddopts="-s divide_and_query -n 50000 -d 1"
+
+while test $# -gt 0
+do
+ case $1 in
+
+ -c|--cmd)
+ cmd="$2" ; shift ;;
+
+ -d|--ddopts)
+ ddopts="$2" ; shift ;;
+
+ -n)
+ limit="$2" ; shift ;;
+
+ -*)
+ echo "$0: unknown option \`$1'" 2>&1
+ echo $usage
+ exit 1 ;;
+
+ *) break ;;
+ esac
+ shift
+done
+
+if test "$cmd" == ""; then
+ echo $usage
+ exit 1
+fi
+
+total_runs=`expr $limit + 2`
+
+echo START $ddopts >> dd.stats
+
+count=1
+while test $count -le $total_runs
+do
+ if test $count == 1; then
+ run_name="FIRST"
+ else
+ if test $count == $total_runs; then
+ run_name="FINAL"
+ else
+ during_cnt=`expr $count - 1`
+ run_name="DURING$during_cnt"
+ fi
+ fi
+
+ echo $run_name >> dd.stats
+ echo STARTWCTIME = `date +"%s"` >> dd.stats
+
+mdb $cmd << END1 2>> dd.stats >> dd.stdout
+table_io start
+finish
+dd $ddopts --test
+quit -y
+END1
+
+ echo ENDWCTIME = `date +"%s"` >> dd.stats
+
+ count=`expr $count + 1`
+done
+echo END >> dd.stats
Index: tools/extract_dd_stats.awk
===================================================================
RCS file: tools/extract_dd_stats.awk
diff -N tools/extract_dd_stats.awk
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tools/extract_dd_stats.awk 3 Aug 2005 13:04:07 -0000
@@ -0,0 +1,126 @@
+#---------------------------------------------------------------------------#
+# Copyright (C) 2005 The University of Melbourne.
+# This file may only be copied under the terms of the GNU General
+# Public License - see the file COPYING in the Mercury distribution.
+#---------------------------------------------------------------------------#
+#
+# This awk script summarizes the stats generated by the dd_speedtest script.
+#
+# It prints the options passed to the dd command followed by the following
+# fields:
+#
+# reexec = number of reexecutions minus first and last reexecutions.
+# nodes = number of nodes constructed in all reexecutions except first and
+# last.
+# ratio = nodes/reexec
+# CPU = total CPU time from start of session to end of last reexecution.
+# WC = total time from start of session to end of session.
+# RSS = resident set size at end of last reexecution.
+# VSZ = virtual size of process at end of last reexecution.
+#
+# To run this script do:
+# awk -f extract_dd_stats.awk dd.stats
+#
+
+BEGIN {
+ FS = " = "
+ printf("%6s %11s %10s %7s %7s %7s %7s\n", \
+ "reexec", "nodes", "ratio", "CPU", \
+ "WC", "RSS", "VSZ");
+}
+
+/^START / {
+ reset_per_run();
+ num_runs = 0;
+ total_time = 0;
+ total_wc_time = 0;
+ last_time = 0;
+
+ start = 1;
+ final = 0;
+ during = 0;
+
+ match($0, /START (.*)$/, a);
+ dd_opts = a[1];
+ printf("Options = %s\n", dd_opts);
+}
+/^DURING/ {
+ reset_per_run();
+ num_runs++;
+ if (start != 1) {
+ total_time += last_time;
+ }
+
+ start = 0;
+ final = 0;
+ during = 1;
+
+ last_time = 0;
+}
+/^FINAL/ {
+ reset_per_run();
+ total_time += last_time;
+
+ start = 0;
+ final = 1;
+ during = 0;
+}
+/^END$/ {
+ # discard the first and last re-execution.
+ reexec -= 2;
+ total_nodes = actual_nodes_for_run - nodes_in_first_reexecution \
+ - last_nodes_constructed_in_run;
+
+ if (out_of_memory == 1){
+ mem = "Out of Memory";
+ out_of_memory = 0;
+ } else {
+ mem = sprintf("%.1f", rss/1024);
+ }
+ printf("%6i %11i %10d %7.1f %7.1f %7s %7.1f\n", \
+ reexec, \
+ total_nodes, total_nodes/reexec, \
+ total_time/num_runs, total_wc_time/num_runs, \
+ mem, vsz/1024);
+}
+
+/Total CPU time/ {last_time = $2}
+
+/Nodes constructed in this run/ {
+ if (start_of_run) {
+ nodes_in_first_reexecution = $2;
+ start_of_run = 0;
+ }
+ actual_nodes_for_run += $2
+ last_nodes_constructed_in_run = $2;
+}
+/Total reexecutions so far/ {
+ reexec = $2
+}
+
+/RSS =/ {
+ rss = $2
+}
+/VSZ =/ {
+ vsz = $2
+}
+/Out of Memory/ {
+ out_of_memory = 1;
+}
+
+/^STARTWCTIME/ {
+ start_wc_time = $2;
+}
+
+/^ENDWCTIME/ {
+ if (during == 1) {
+ total_wc_time += ($2 - start_wc_time);
+ }
+}
+
+function reset_per_run() {
+ actual_nodes_for_run = 0;
+ nodes_in_first_reexecution = 0;
+ start_of_run = 1;
+ last_nodes_constructed_in_run = 0;
+}
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.93
diff -u -b -r1.93 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c 1 Aug 2005 02:26:25 -0000 1.93
+++ trace/mercury_trace_declarative.c 3 Aug 2005 13:05:52 -0000
@@ -469,7 +469,7 @@
MR_Unsigned MR_edt_desired_nodes_in_subtree = MR_TRACE_DESIRED_SUBTREE_NODES;
MR_Unsigned MR_edt_default_depth_limit = MR_TRACE_DECL_INITIAL_DEPTH;
-MR_bool MR_trace_decl_in_dd_dd_mode = MR_FALSE;
+MR_bool MR_trace_decl_debug_debugger_mode = MR_FALSE;
/*
** We filter out events which are deeper than the limit given by
@@ -1485,6 +1485,16 @@
);
}
+void
+MR_trace_decl_set_testing_flag(MR_bool testing)
+{
+ MR_trace_decl_ensure_init();
+ MR_TRACE_CALL_MERCURY(
+ MR_DD_decl_set_diagnoser_testing_flag(testing,
+ MR_trace_front_end_state, &MR_trace_front_end_state);
+ );
+}
+
MR_bool
MR_trace_is_valid_search_mode_string(const char *search_mode_string,
MR_Decl_Search_Mode *search_mode)
@@ -1877,7 +1887,7 @@
return MR_trace_event_internal(cmd, MR_TRUE, NULL, event_info);
}
- if (MR_trace_decl_in_dd_dd_mode) {
+ if (MR_trace_decl_debug_debugger_mode) {
/*
** This is a quick and dirty way to debug the front end.
*/
@@ -2396,8 +2406,8 @@
fprintf(stderr, "Total CPU time = %.2f\n",
MR_get_user_cpu_miliseconds() / 1000.0);
pid = getpid();
- sprintf(cmdstr, "ps -o pid,rss | grep %i | awk '{print $2}' 1>&2", pid);
- fprintf(stderr, "RSS = ");
+ sprintf(cmdstr, "ps -hp %i -o rss,vsz | "
+ "awk '{print \"RSS = \" $1 \"\\nVSZ = \" $2}' 1>&2", pid);
system(cmdstr);
MR_debug_enabled = MR_FALSE;
Index: trace/mercury_trace_declarative.h
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_declarative.h,v
retrieving revision 1.24
diff -u -b -r1.24 mercury_trace_declarative.h
--- trace/mercury_trace_declarative.h 20 May 2005 05:40:37 -0000 1.24
+++ trace/mercury_trace_declarative.h 2 Aug 2005 13:53:54 -0000
@@ -85,7 +85,7 @@
MR_Decl_Search_Mode *search_mode);
/*
-** Return the default search mode to use when then --search-mode option for the
+** Return the default search mode to use when the --search-mode option for the
** `dd' command is not given.
*/
@@ -99,6 +99,14 @@
extern void MR_decl_print_all_trusted(FILE *fp,
MR_bool mdb_command_format);
+
+/*
+** Set the testing flag of the diagnoser.
+** See the user_state type in browser/declarative_user.m for more details.
+*/
+
+extern void MR_trace_decl_set_testing_flag(MR_bool testing);
+
/*
** The following macros are provided to help C code manipulate the
** Mercury data structure. The values here must match the corresponding
@@ -183,11 +191,11 @@
/*
** The following variable indicates whether the declarative debugger was
-** invoked using the dd_dd command. It is needed so that the declarative
+** invoked with the --debug option. It is needed so that the declarative
** debugger can continue to be debugged after a new portion of the
** annotated trace has been generated.
*/
-extern MR_bool MR_trace_decl_in_dd_dd_mode;
+extern MR_bool MR_trace_decl_debug_debugger_mode;
#endif /* MERCURY_TRACE_DECLARATIVE_H */
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.209
diff -u -b -r1.209 mercury_trace_internal.c
--- trace/mercury_trace_internal.c 1 Aug 2005 02:40:13 -0000 1.209
+++ trace/mercury_trace_internal.c 2 Aug 2005 13:53:04 -0000
@@ -520,7 +520,6 @@
static MR_TraceCmdFunc MR_trace_cmd_save;
static MR_TraceCmdFunc MR_trace_cmd_quit;
static MR_TraceCmdFunc MR_trace_cmd_dd;
-static MR_TraceCmdFunc MR_trace_cmd_dd_dd;
static MR_TraceCmdFunc MR_trace_cmd_trust;
static MR_TraceCmdFunc MR_trace_cmd_untrust;
static MR_TraceCmdFunc MR_trace_cmd_trusted;
@@ -602,6 +601,7 @@
MR_Integer *default_depth, MR_Integer *num_nodes,
MR_Decl_Search_Mode *search_mode,
MR_bool *search_mode_was_set, MR_bool *new_session,
+ MR_bool *testing, MR_bool *debug,
char ***words, int *word_count, const char *cat,
const char *item);
static MR_bool MR_trace_options_stats(char **filename, char ***words,
@@ -5791,84 +5791,50 @@
MR_Decl_Search_Mode search_mode;
MR_bool search_mode_was_set = MR_FALSE;
MR_bool new_session = MR_TRUE;
-
- MR_trace_decl_assume_all_io_is_tabled = MR_FALSE;
- MR_edt_default_depth_limit = MR_TRACE_DECL_INITIAL_DEPTH;
- search_mode = MR_trace_get_default_search_mode();
- MR_trace_decl_in_dd_dd_mode = MR_FALSE;
-
- if (! MR_trace_options_dd(&MR_trace_decl_assume_all_io_is_tabled,
- &MR_edt_default_depth_limit, &MR_edt_desired_nodes_in_subtree,
- &search_mode, &search_mode_was_set, &new_session,
- &words, &word_count, "dd", "dd"))
- {
- ; /* the usage message has already been printed */
- } else if (word_count == 1) {
- if (MR_trace_have_unhid_events) {
- fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: dd doesn't work after `unhide_events on'.\n");
- return KEEP_INTERACTING;
- }
- if (search_mode_was_set) {
- MR_trace_decl_set_fallback_search_mode(search_mode);
- } else if (new_session) {
- MR_trace_decl_set_fallback_search_mode(search_mode);
- }
- if (MR_trace_start_decl_debug(MR_TRACE_DECL_DEBUG,
- NULL, new_session, cmd, event_info, event_details, jumpaddr))
- {
- return STOP_INTERACTING;
- }
- } else {
- MR_trace_usage("dd", "dd");
- }
-
- return KEEP_INTERACTING;
-}
-
-static MR_Next
-MR_trace_cmd_dd_dd(char **words, int word_count, MR_Trace_Cmd_Info *cmd,
- MR_Event_Info *event_info, MR_Event_Details *event_details,
- MR_Code **jumpaddr)
-{
- MR_Trace_Mode trace_mode;
+ MR_bool testing = MR_FALSE;
+ MR_bool debug = MR_FALSE;
const char *filename;
- MR_Decl_Search_Mode search_mode;
- MR_bool search_mode_was_set = MR_FALSE;
- MR_bool new_session = MR_TRUE;
+ MR_Trace_Mode trace_mode;
MR_trace_decl_assume_all_io_is_tabled = MR_FALSE;
MR_edt_default_depth_limit = MR_TRACE_DECL_INITIAL_DEPTH;
search_mode = MR_trace_get_default_search_mode();
- MR_trace_decl_in_dd_dd_mode = MR_TRUE;
+ MR_trace_decl_debug_debugger_mode = MR_FALSE;
if (! MR_trace_options_dd(&MR_trace_decl_assume_all_io_is_tabled,
&MR_edt_default_depth_limit, &MR_edt_desired_nodes_in_subtree,
- &search_mode, &search_mode_was_set, &new_session,
- &words, &word_count, "dd", "dd_dd"))
+ &search_mode, &search_mode_was_set, &new_session, &testing,
+ &MR_trace_decl_debug_debugger_mode,
+ &words, &word_count, "dd", "dd"))
{
; /* the usage message has already been printed */
} else if (word_count <= 2) {
- if (word_count == 2) {
+ if (word_count == 2 && MR_trace_decl_debug_debugger_mode) {
trace_mode = MR_TRACE_DECL_DEBUG_DUMP;
filename = (const char *) words[1];
} else {
trace_mode = MR_TRACE_DECL_DEBUG;
filename = (const char *) NULL;
}
+ if (MR_trace_have_unhid_events) {
+ fflush(MR_mdb_out);
+ fprintf(MR_mdb_err,
+ "mdb: dd doesn't work after `unhide_events on'.\n");
+ return KEEP_INTERACTING;
+ }
+ MR_trace_decl_set_testing_flag(testing);
if (search_mode_was_set) {
MR_trace_decl_set_fallback_search_mode(search_mode);
} else if (new_session) {
MR_trace_decl_set_fallback_search_mode(search_mode);
}
- if (MR_trace_start_decl_debug(trace_mode, filename,
- new_session, cmd, event_info, event_details, jumpaddr))
+ if (MR_trace_start_decl_debug(trace_mode, filename, new_session, cmd,
+ event_info, event_details, jumpaddr))
{
return STOP_INTERACTING;
}
} else {
- MR_trace_usage("dd", "dd_dd");
+ MR_trace_usage("dd", "dd");
}
return KEEP_INTERACTING;
@@ -7098,10 +7064,12 @@
static struct MR_option MR_trace_dd_opts[] =
{
{ "assume-all-io-is-tabled", MR_no_argument, NULL, 'a' },
+ { "debug", MR_no_argument, NULL, 'z' },
{ "depth", MR_required_argument, NULL, 'd' },
{ "nodes", MR_required_argument, NULL, 'n' },
- { "search-mode", MR_required_argument, NULL, 's' },
{ "resume", MR_no_argument, NULL, 'r' },
+ { "search-mode", MR_required_argument, NULL, 's' },
+ { "test", MR_no_argument, NULL, 't' },
{ NULL, MR_no_argument, NULL, 0 }
};
@@ -7109,13 +7077,13 @@
MR_trace_options_dd(MR_bool *assume_all_io_is_tabled,
MR_Integer *default_depth, MR_Integer *num_nodes,
MR_Decl_Search_Mode *search_mode, MR_bool *search_mode_was_set,
- MR_bool *new_session, char ***words, int *word_count, const char *cat,
- const char *item)
+ MR_bool *new_session, MR_bool *testing, MR_bool *debug,
+ char ***words, int *word_count, const char *cat, const char *item)
{
int c;
MR_optind = 0;
- while ((c = MR_getopt_long(*word_count, *words, "ad:n:s:r",
+ while ((c = MR_getopt_long(*word_count, *words, "ad:n:rs:tz",
MR_trace_dd_opts, NULL)) != EOF)
{
switch (c) {
@@ -7138,6 +7106,10 @@
}
break;
+ case 'r':
+ *new_session = MR_FALSE;
+ break;
+
case 's':
if (MR_trace_is_valid_search_mode_string(MR_optarg,
search_mode))
@@ -7149,8 +7121,12 @@
}
break;
- case 'r':
- *new_session = MR_FALSE;
+ case 't':
+ *testing = MR_TRUE;
+ break;
+
+ case 'z':
+ *debug = MR_TRUE;
break;
default:
@@ -8430,8 +8406,6 @@
MR_trace_on_off_args, MR_trace_null_completer },
{ "developer", "unhide_events", MR_trace_cmd_unhide_events,
MR_trace_on_off_args, MR_trace_null_completer },
- { "developer", "dd_dd", MR_trace_cmd_dd_dd,
- MR_trace_dd_cmd_args, MR_trace_filename_completer },
{ "developer", "table", MR_trace_cmd_table,
NULL, MR_trace_null_completer },
{ "developer", "type_ctor", MR_trace_cmd_type_ctor,
--------------------------------------------------------------------------
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