[m-rev.] diff: more minimal model debugging enhancements

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Mar 10 15:19:58 AEDT 2004


Make debugging of minimal model tabling more convenient.

compiler/handle_options.m:
	Make -Dmm generate HLDS dumps tailored for understanding the
	code of procedures transformed by minimal model tabling.

runtime/mercury_minimal_model.c:
	When printing the stack segments being saved, print the values of
	variables in the affected stack frames.

runtime/mercury_stack_trace.c:
	When dumping the nondet stack, print the name of the procedure
	that established each ordinary frame, and the goal path at which
	control will reenter the stack frame, if this information is available.

	Since mercury_minimal_model.c now asks for the printing of variable
	values (which is done by Mercury code) while execution is outside
	the debugger and hence while execution tracing may be enabled, 
	explicitly turn off debugging while in the Mercury code that prints
	variable values.

runtime/mercury_trace_base.[ch]:
	Provide a simple mechanism for turning off debugging functionality
	in a region of code.

trace/mercury_trace_internal.c:
	Use the new mechanism in mercury_trace_base to handle turning off
	debugging output inside the debugger. This also allows us to simplify
	the code implementing the "flag" mdb command.

	Make the reports generated by the "unhide_events" and "table_io"
	commands follow the same format as other commands.

	Note that mercury_trace_declarative.c doesn't use the new mechanism,
	because it wants the reexecution of the call being debugged to be
	exactly the same as its first execution; in particular, turning off
	I/O tabling for reexecution would generate incorrect results.

tests/debugger/nondet_stack.exp*:
tests/debugger/tabled_read.exp*:
tests/debugger/tabled_read_decl.exp*:
tests/debugger/tabled_read_unitize.exp*:
tests/debugger/io_stream_test.exp*:
tests/debugger/declarative/tabled_read_decl.exp*:
	Update the expected out of these test cases to reflect the new
	functionality above.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.200
diff -u -b -r1.200 handle_options.m
--- compiler/handle_options.m	12 Feb 2004 02:46:31 -0000	1.200
+++ compiler/handle_options.m	10 Mar 2004 04:01:33 -0000
@@ -1912,5 +1912,6 @@
 convert_dump_alias("vanessa", "ltuCIU").
 convert_dump_alias("paths", "cP").
 convert_dump_alias("petdr", "din").
+convert_dump_alias("mm", "bdgvP").		% for debugging minimal model
 convert_dump_alias("osv", "bcdglmnpruvP").	% for debugging
 						% --optimize-saved-vars-cell
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_minimal_model.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_minimal_model.c,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_minimal_model.c
--- runtime/mercury_minimal_model.c	9 Mar 2004 03:47:55 -0000	1.4
+++ runtime/mercury_minimal_model.c	9 Mar 2004 04:30:05 -0000
@@ -23,7 +23,8 @@
 
 static  MR_Word *nearest_common_ancestor(MR_Word *fr1, MR_Word *fr2);
 static  void    save_state(MR_SavedState *saved_state, MR_Word *generator_fr,
-                    const char *who, const char *what);
+                    const char *who, const char *what,
+                    MR_bool can_print_stack_detail);
 static  void    restore_state(MR_SavedState *saved_state, const char *who,
                     const char *what);
 static  void    extend_consumer_stacks(MR_Subgoal *leader,
@@ -457,7 +458,7 @@
 
 static void
 save_state(MR_SavedState *saved_state, MR_Word *generator_fr,
-    const char *who, const char *what)
+    const char *who, const char *what, MR_bool can_print_stack_detail)
 {
     MR_Word *common_ancestor_fr;
     MR_Word *start_non;
@@ -532,8 +533,13 @@
     }
 
     if (MR_tablestackdebug) {
+        if (can_print_stack_detail) {
+            MR_dump_nondet_stack_from_layout(stdout, 0, MR_maxfr,
+                MR_subgoal_debug_cur_proc->MR_sle_call_label, MR_sp, MR_curfr);
+        } else {
         MR_dump_nondet_stack(stdout, 0, MR_maxfr);
     }
+    }
   #endif /* MR_TABLE_DEBUG */
 
     MR_save_transient_registers();
@@ -1067,7 +1073,7 @@
 
     MR_save_transient_registers();
     save_state(&(consumer->MR_cns_saved_state), subgoal->MR_sg_generator_fr,
-        "suspension", "consumer");
+        "suspension", "consumer", MR_TRUE);
     MR_restore_transient_registers();
 
     cur_gen = MR_gen_next - 1;
@@ -1254,7 +1260,8 @@
 
         MR_save_transient_registers();
         save_state(&(MR_cur_leader->MR_sg_resume_info->MR_ri_leader_state),
-            MR_cur_leader->MR_sg_generator_fr, "resumption", "generator");
+            MR_cur_leader->MR_sg_generator_fr, "resumption", "generator",
+            MR_FALSE);
         MR_restore_transient_registers();
 
 #ifdef  MR_TABLE_DEBUG
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.60
diff -u -b -r1.60 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c	5 Jan 2004 08:59:50 -0000	1.60
+++ runtime/mercury_stack_trace.c	9 Mar 2004 11:19:08 -0000
@@ -400,6 +400,7 @@
     MR_bool         print_vars;
     const char      *problem;
     int             frames_traversed_so_far;
+    int             branch;
 
     MR_do_init_modules();
 
@@ -456,7 +457,16 @@
             fprintf(fp, "\n");
         } else {
             MR_print_nondstackptr(fp, base_maxfr);
-            fprintf(fp, ": ordinary, %d words\n", frame_size);
+            fprintf(fp, ": ordinary, %d words", frame_size);
+            if (print_vars && MR_find_matching_branch(base_maxfr, &branch)) {
+                const MR_Label_Layout *label_layout;
+
+                fprintf(fp, ", ");
+                label_layout = MR_nondet_branch_infos[branch].branch_layout;
+                MR_print_proc_id(fp, label_layout->MR_sll_entry);
+                fprintf(fp, " <%s>", MR_label_goal_path(label_layout));
+            }
+            fprintf(fp, "\n");
             fprintf(fp, " redoip: ");
             MR_printlabel(fp, MR_redoip_slot(base_maxfr));
             fprintf(fp, " redofr: ");
@@ -475,9 +485,8 @@
 
             level_number++;
             if (print_vars && base_maxfr > MR_nondet_stack_trace_bottom) {
-                problem = MR_step_over_nondet_frame(
-                        MR_dump_nondet_stack_frame, fp,
-                        level_number, base_maxfr);
+                problem = MR_step_over_nondet_frame(MR_dump_nondet_stack_frame,
+                    fp, level_number, base_maxfr);
                 if (problem != NULL) {
                     fprintf(fp, "%s\n", problem);
                     return;
@@ -523,9 +532,18 @@
     }
 
     if (category != MR_TERMINAL_TOP_FRAME_ON_SIDE_BRANCH) {
+        /*
+        ** The browsing code is in Mercury, so we need to disable debugger
+        ** events and diagnostics inside.
+        */
+
+        MR_SavedDebugState  saved_debug_state;
+
+        MR_turn_off_debug(&saved_debug_state);
         /* XXX we ignore the return value */
         (*MR_address_of_trace_browse_all_on_level) (dump_fp, top_layout,
                 base_sp, base_curfr, level_number, MR_TRUE);
+        MR_turn_debug_back_on(&saved_debug_state);
     }
 }
 
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.54
diff -u -b -r1.54 mercury_trace_base.c
--- runtime/mercury_trace_base.c	24 Oct 2003 03:09:51 -0000	1.54
+++ runtime/mercury_trace_base.c	9 Mar 2004 09:18:47 -0000
@@ -465,6 +465,35 @@
 	return NULL;
 }
 
+void
+MR_turn_off_debug(MR_SavedDebugState *saved_state)
+{
+	int	i;
+
+	saved_state->MR_sds_trace_enabled = MR_trace_enabled;
+	saved_state->MR_sds_io_tabling_enabled = MR_io_tabling_enabled;
+	MR_trace_enabled = MR_FALSE;
+	MR_io_tabling_enabled = MR_FALSE;
+
+	for (i = 0; i < MR_MAXFLAG ; i++) {
+		saved_state->MR_sds_debugflags[i] = MR_debugflag[i];
+		MR_debugflag[i] = MR_FALSE;
+	}
+}
+
+void
+MR_turn_debug_back_on(MR_SavedDebugState *saved_state)
+{
+	int	i;
+
+	MR_trace_enabled = saved_state->MR_sds_trace_enabled;
+	MR_io_tabling_enabled = saved_state->MR_sds_io_tabling_enabled;
+
+	for (i = 0; i < MR_MAXFLAG ; i++) {
+		MR_debugflag[i] = saved_state->MR_sds_debugflags[i];
+	}
+}
+
 static	MR_Word		MR_trace_exception_value = (MR_Word) NULL;
 
 void
Index: runtime/mercury_trace_base.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trace_base.h,v
retrieving revision 1.36
diff -u -b -r1.36 mercury_trace_base.h
--- runtime/mercury_trace_base.h	12 Jan 2004 04:41:40 -0000	1.36
+++ runtime/mercury_trace_base.h	9 Mar 2004 11:18:03 -0000
@@ -19,6 +19,7 @@
 #include "mercury_stack_layout.h"
 #include "mercury_std.h"
 #include "mercury_tabling.h"	/* for MR_TableNode */
+#include "mercury_engine.h"	/* for MR_MAXFLAG */
 #include "mercury_goto.h"	/* for MR_declare_entry */
 
 /*
@@ -327,6 +328,22 @@
 		*MR_trace_get_action(int action_number,
 			MR_ConstString *proc_name_ptr, MR_Word *is_func_ptr,
 			MR_Word *arg_list_ptr);
+
+/*
+** MR_turn_off_debug saves the current values of the variables controlling 
+** debugging (execution tracing and diagnostics) in the structure provided by
+** the caller, and then turns them off. MR_turn_debug_back_on restores the
+** saved values from the structure.
+*/
+
+typedef struct {
+	MR_bool	MR_sds_trace_enabled;
+	MR_bool	MR_sds_io_tabling_enabled;
+	MR_bool	MR_sds_debugflags[MR_MAXFLAG];
+} MR_SavedDebugState;
+
+extern	void	MR_turn_off_debug(MR_SavedDebugState *saved_state);
+extern	void	MR_turn_debug_back_on(MR_SavedDebugState *saved_state);
 
 /*
 ** These functions allow library/exceptions.m to tell the debuggers
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/nondet_stack.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/nondet_stack.exp,v
retrieving revision 1.9
diff -u -b -r1.9 nondet_stack.exp
--- tests/debugger/nondet_stack.exp	20 Jan 2004 02:22:47 -0000	1.9
+++ tests/debugger/nondet_stack.exp	9 Mar 2004 07:31:54 -0000
@@ -92,7 +92,7 @@
 curfr = non 135
 maxfr = non 135
 mdb> nondet_stack -d
-non 135: ordinary, 13 words
+non 135: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;>
  redoip: unnamed label
  redofr: non 135
  succip: unnamed label
@@ -114,7 +114,7 @@
  top frame of a nondet side branch non 116
        HeadVar__2             [3, 4, 5]
        TypeInfo_for_T         int
-non 103: ordinary, 13 words
+non 103: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 103
  succip: unnamed label
@@ -138,7 +138,7 @@
  top frame of a nondet side branch non  84
        HeadVar__2             [2, 3, 4, 5]
        TypeInfo_for_T         int
-non  71: ordinary, 13 words
+non  71: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  71
  succip: unnamed label
@@ -162,7 +162,7 @@
  top frame of a nondet side branch non  52
        HeadVar__2             [1, 2, 3, 4, 5]
        TypeInfo_for_T         int
-non  39: ordinary, 13 words
+non  39: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  39
  succip: unnamed label
@@ -172,7 +172,7 @@
        TypeInfo_for_T         int
        U                      1
        Z                      [2, 3, 4, 5]
-non  26: ordinary, 12 words
+non  26: ordinary, 12 words, pred nondet_stack.queen/2-0 (nondet) <c2;>
  redoip: unnamed label
  redofr: non  26
  succip: unnamed label
@@ -354,7 +354,7 @@
  top frame of a nondet side branch non 180
        HeadVar__2             [5]
        TypeInfo_for_T         int
-non 167: ordinary, 13 words
+non 167: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 167
  succip: unnamed label
@@ -378,7 +378,7 @@
  top frame of a nondet side branch non 148
        HeadVar__2             [4, 5]
        TypeInfo_for_T         int
-non 135: ordinary, 13 words
+non 135: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 135
  succip: unnamed label
@@ -402,7 +402,7 @@
  top frame of a nondet side branch non 116
        HeadVar__2             [3, 4, 5]
        TypeInfo_for_T         int
-non 103: ordinary, 13 words
+non 103: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 103
  succip: unnamed label
@@ -426,7 +426,7 @@
  top frame of a nondet side branch non  84
        HeadVar__2             [2, 3, 4, 5]
        TypeInfo_for_T         int
-non  71: ordinary, 13 words
+non  71: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  71
  succip: unnamed label
@@ -450,7 +450,7 @@
  top frame of a nondet side branch non  52
        HeadVar__2             [1, 2, 3, 4, 5]
        TypeInfo_for_T         int
-non  39: ordinary, 13 words
+non  39: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  39
  succip: unnamed label
@@ -460,7 +460,7 @@
        TypeInfo_for_T         int
        U                      1
        Z                      [2, 3, 4, 5]
-non  26: ordinary, 12 words
+non  26: ordinary, 12 words, pred nondet_stack.queen/2-0 (nondet) <c3;>
  redoip: unnamed label
  redofr: non  26
  succip: unnamed label
@@ -641,7 +641,7 @@
 curfr = non 284
 maxfr = non 284
 mdb> nondet_stack -d
-non 284: ordinary, 12 words
+non 284: ordinary, 12 words, pred nondet_stack.test/2-0 (nondet) <>
  redoip: unnamed label
  redofr: non 284
  succip: unnamed label
@@ -695,7 +695,7 @@
  top frame of a nondet side branch non 228
        HeadVar__2             [4]
        TypeInfo_for_T         int
-non 215: ordinary, 13 words
+non 215: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 215
  succip: unnamed label
@@ -719,7 +719,7 @@
  top frame of a nondet side branch non 196
        HeadVar__2             [2, 4]
        TypeInfo_for_T         int
-non 183: ordinary, 13 words
+non 183: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 183
  succip: unnamed label
@@ -749,7 +749,7 @@
  top frame of a nondet side branch non 158
        HeadVar__2             [5]
        TypeInfo_for_T         int
-non 145: ordinary, 13 words
+non 145: ordinary, 13 words, pred nondet_stack.qdelete/3-0 (nondet) <c2;d2;c3;>
  redoip: unnamed label
  redofr: non 145
  succip: unnamed label
@@ -759,7 +759,7 @@
        A                      4
        TypeInfo_for_T         int
        Z                      [5]
-non 132: ordinary, 13 words
+non 132: ordinary, 13 words, pred nondet_stack.qdelete/3-0 (nondet) <c2;d2;c3;>
  redoip: unnamed label
  redofr: non 132
  succip: unnamed label
@@ -769,7 +769,7 @@
        A                      2
        TypeInfo_for_T         int
        Z                      [4, 5]
-non 119: ordinary, 13 words
+non 119: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 119
  succip: unnamed label
@@ -796,7 +796,7 @@
  top frame of a nondet side branch non  97
        HeadVar__2             [3, 4, 5]
        TypeInfo_for_T         int
-non  84: ordinary, 13 words
+non  84: ordinary, 13 words, pred nondet_stack.qdelete/3-0 (nondet) <c2;d2;c3;>
  redoip: unnamed label
  redofr: non  84
  succip: unnamed label
@@ -806,7 +806,7 @@
        A                      2
        TypeInfo_for_T         int
        Z                      [3, 4, 5]
-non  71: ordinary, 13 words
+non  71: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  71
  succip: unnamed label
@@ -830,7 +830,7 @@
  top frame of a nondet side branch non  52
        HeadVar__2             [1, 2, 3, 4, 5]
        TypeInfo_for_T         int
-non  39: ordinary, 13 words
+non  39: ordinary, 13 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  39
  succip: unnamed label
@@ -840,7 +840,7 @@
        TypeInfo_for_T         int
        U                      1
        Z                      [2, 3, 4, 5]
-non  26: ordinary, 12 words
+non  26: ordinary, 12 words, pred nondet_stack.queen/2-0 (nondet) <c2;>
  redoip: unnamed label
  redofr: non  26
  succip: unnamed label
Index: tests/debugger/nondet_stack.exp2
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/nondet_stack.exp2,v
retrieving revision 1.10
diff -u -b -r1.10 nondet_stack.exp2
--- tests/debugger/nondet_stack.exp2	20 Jan 2004 02:22:47 -0000	1.10
+++ tests/debugger/nondet_stack.exp2	10 Mar 2004 02:51:15 -0000
@@ -92,7 +92,7 @@
 curfr = non 162
 maxfr = non 162
 mdb> nondet_stack -d
-non 162: ordinary, 16 words
+non 162: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;>
  redoip: unnamed label
  redofr: non 162
  succip: unnamed label
@@ -114,7 +114,7 @@
  top frame of a nondet side branch non 140
        HeadVar__2             [3, 4, 5]
        TypeInfo_for_T         int
-non 123: ordinary, 16 words
+non 123: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 123
  succip: unnamed label
@@ -138,7 +138,7 @@
  top frame of a nondet side branch non 101
        HeadVar__2             [2, 3, 4, 5]
        TypeInfo_for_T         int
-non  84: ordinary, 16 words
+non  84: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  84
  succip: unnamed label
@@ -162,7 +162,7 @@
  top frame of a nondet side branch non  62
        HeadVar__2             [1, 2, 3, 4, 5]
        TypeInfo_for_T         int
-non  45: ordinary, 16 words
+non  45: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  45
  succip: unnamed label
@@ -172,7 +172,7 @@
        TypeInfo_for_T         int
        U                      1
        Z                      [2, 3, 4, 5]
-non  29: ordinary, 15 words
+non  29: ordinary, 15 words, pred nondet_stack.queen/2-0 (nondet) <c2;>
  redoip: unnamed label
  redofr: non  29
  succip: unnamed label
@@ -354,7 +354,7 @@
  top frame of a nondet side branch non 218
        HeadVar__2             [5]
        TypeInfo_for_T         int
-non 201: ordinary, 16 words
+non 201: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 201
  succip: unnamed label
@@ -378,7 +378,7 @@
  top frame of a nondet side branch non 179
        HeadVar__2             [4, 5]
        TypeInfo_for_T         int
-non 162: ordinary, 16 words
+non 162: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 162
  succip: unnamed label
@@ -402,7 +402,7 @@
  top frame of a nondet side branch non 140
        HeadVar__2             [3, 4, 5]
        TypeInfo_for_T         int
-non 123: ordinary, 16 words
+non 123: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 123
  succip: unnamed label
@@ -426,7 +426,7 @@
  top frame of a nondet side branch non 101
        HeadVar__2             [2, 3, 4, 5]
        TypeInfo_for_T         int
-non  84: ordinary, 16 words
+non  84: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  84
  succip: unnamed label
@@ -450,7 +450,7 @@
  top frame of a nondet side branch non  62
        HeadVar__2             [1, 2, 3, 4, 5]
        TypeInfo_for_T         int
-non  45: ordinary, 16 words
+non  45: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  45
  succip: unnamed label
@@ -460,7 +460,7 @@
        TypeInfo_for_T         int
        U                      1
        Z                      [2, 3, 4, 5]
-non  29: ordinary, 15 words
+non  29: ordinary, 15 words, pred nondet_stack.queen/2-0 (nondet) <c3;>
  redoip: unnamed label
  redofr: non  29
  succip: unnamed label
@@ -641,7 +641,7 @@
 curfr = non 341
 maxfr = non 341
 mdb> nondet_stack -d
-non 341: ordinary, 16 words
+non 341: ordinary, 16 words, pred nondet_stack.test/2-0 (nondet) <>
  redoip: unnamed label
  redofr: non 341
  succip: unnamed label
@@ -695,7 +695,7 @@
  top frame of a nondet side branch non 278
        HeadVar__2             [4]
        TypeInfo_for_T         int
-non 261: ordinary, 16 words
+non 261: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 261
  succip: unnamed label
@@ -719,7 +719,7 @@
  top frame of a nondet side branch non 239
        HeadVar__2             [2, 4]
        TypeInfo_for_T         int
-non 222: ordinary, 16 words
+non 222: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 222
  succip: unnamed label
@@ -749,7 +749,7 @@
  top frame of a nondet side branch non 194
        HeadVar__2             [5]
        TypeInfo_for_T         int
-non 177: ordinary, 17 words
+non 177: ordinary, 17 words, pred nondet_stack.qdelete/3-0 (nondet) <c2;d2;c3;>
  redoip: unnamed label
  redofr: non 177
  succip: unnamed label
@@ -759,7 +759,7 @@
        A                      4
        TypeInfo_for_T         int
        Z                      [5]
-non 160: ordinary, 17 words
+non 160: ordinary, 17 words, pred nondet_stack.qdelete/3-0 (nondet) <c2;d2;c3;>
  redoip: unnamed label
  redofr: non 160
  succip: unnamed label
@@ -769,7 +769,7 @@
        A                      2
        TypeInfo_for_T         int
        Z                      [4, 5]
-non 143: ordinary, 16 words
+non 143: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non 143
  succip: unnamed label
@@ -796,7 +796,7 @@
  top frame of a nondet side branch non 118
        HeadVar__2             [3, 4, 5]
        TypeInfo_for_T         int
-non 101: ordinary, 17 words
+non 101: ordinary, 17 words, pred nondet_stack.qdelete/3-0 (nondet) <c2;d2;c3;>
  redoip: unnamed label
  redofr: non 101
  succip: unnamed label
@@ -806,7 +806,7 @@
        A                      2
        TypeInfo_for_T         int
        Z                      [3, 4, 5]
-non  84: ordinary, 16 words
+non  84: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  84
  succip: unnamed label
@@ -830,7 +830,7 @@
  top frame of a nondet side branch non  62
        HeadVar__2             [1, 2, 3, 4, 5]
        TypeInfo_for_T         int
-non  45: ordinary, 16 words
+non  45: ordinary, 16 words, pred nondet_stack.qperm/2-0 (nondet) <s2;c2;>
  redoip: unnamed label
  redofr: non  45
  succip: unnamed label
@@ -840,7 +840,7 @@
        TypeInfo_for_T         int
        U                      1
        Z                      [2, 3, 4, 5]
-non  29: ordinary, 15 words
+non  29: ordinary, 15 words, pred nondet_stack.queen/2-0 (nondet) <c2;>
  redoip: unnamed label
  redofr: non  29
  succip: unnamed label
Index: tests/debugger/tabled_read.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/tabled_read.exp,v
retrieving revision 1.7
diff -u -b -r1.7 tabled_read.exp
--- tests/debugger/tabled_read.exp	17 Jan 2003 05:56:57 -0000	1.7
+++ tests/debugger/tabled_read.exp	9 Mar 2004 13:31:34 -0000
@@ -6,11 +6,11 @@
 Contexts will not be printed.
 mdb> table_io allow
 mdb> table_io
-io tabling has not yet started
+I/O tabling has not yet started.
 mdb> break tabled_read__test
  0: + stop  interface pred tabled_read.test/5-0 (det)
 mdb> table_io start
-io tabling started
+I/O tabling started.
 mdb> continue
       E2:     C2  3 CALL pred tabled_read.test/5-0 (det)
 mdb> finish -n
@@ -34,7 +34,7 @@
        N (arg 3)              	123
        DCG_2 (arg 5)          	state('<<c_pointer>>')
 mdb> table_io end
-io tabling stopped
+I/O tabling stopped.
 mdb> continue
 123
 456
Index: tests/debugger/tabled_read_decl.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/tabled_read_decl.exp,v
retrieving revision 1.8
diff -u -b -r1.8 tabled_read_decl.exp
--- tests/debugger/tabled_read_decl.exp	17 Jan 2003 05:56:57 -0000	1.8
+++ tests/debugger/tabled_read_decl.exp	9 Mar 2004 13:31:40 -0000
@@ -6,11 +6,11 @@
 Contexts will not be printed.
 mdb> table_io allow
 mdb> table_io
-io tabling has not yet started
+I/O tabling has not yet started.
 mdb> break tabled_read_decl__test
  0: + stop  interface pred tabled_read_decl.test/5-0 (det)
 mdb> table_io start
-io tabling started
+I/O tabling started.
 mdb> continue
       E2:     C2  3 CALL pred tabled_read_decl.test/5-0 (det)
 mdb> finish -n
@@ -65,7 +65,7 @@
 456
       E6:     C4  2 CALL pred tabled_read_decl.part_2/3-0 (det)
 mdb> table_io end
-io tabling stopped
+I/O tabling stopped.
 mdb> print action 0
 open_input("tabled_read_decl.data", 0, '<<c_pointer>>')
 mdb> print action 1
Index: tests/debugger/tabled_read_unitize.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/tabled_read_unitize.exp,v
retrieving revision 1.6
diff -u -b -r1.6 tabled_read_unitize.exp
--- tests/debugger/tabled_read_unitize.exp	17 Jan 2003 05:56:57 -0000	1.6
+++ tests/debugger/tabled_read_unitize.exp	9 Mar 2004 13:31:36 -0000
@@ -6,7 +6,7 @@
 Contexts will not be printed.
 mdb> table_io allow
 mdb> table_io start
-io tabling started
+I/O tabling started.
 mdb> break unitize
  0: + stop  interface pred tabled_read_unitize.unitize/4-0 (det)
 mdb> continue
cvs diff: Diffing tests/debugger/declarative
Index: tests/debugger/declarative/io_stream_test.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/declarative/io_stream_test.exp,v
retrieving revision 1.1
diff -u -b -r1.1 io_stream_test.exp
--- tests/debugger/declarative/io_stream_test.exp	14 Sep 2003 22:24:41 -0000	1.1
+++ tests/debugger/declarative/io_stream_test.exp	10 Mar 2004 02:53:46 -0000
@@ -6,7 +6,7 @@
 Contexts will not be printed.
 mdb> table_io allow
 mdb> table_io start
-io tabling started
+I/O tabling started.
 mdb> break io_stream_test__test
  0: + stop  interface pred io_stream_test.test/4-0 (det)
 mdb> continue
Index: tests/debugger/declarative/io_stream_test.exp2
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/declarative/io_stream_test.exp2,v
retrieving revision 1.1
diff -u -b -r1.1 io_stream_test.exp2
--- tests/debugger/declarative/io_stream_test.exp2	14 Sep 2003 22:24:41 -0000	1.1
+++ tests/debugger/declarative/io_stream_test.exp2	9 Mar 2004 07:33:25 -0000
@@ -6,7 +6,7 @@
 Contexts will not be printed.
 mdb> table_io allow
 mdb> table_io start
-io tabling started
+I/O tabling started.
 mdb> break io_stream_test__test
  0: + stop  interface pred io_stream_test.test/4-0 (det)
 mdb> continue
Index: tests/debugger/declarative/tabled_read_decl.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/declarative/tabled_read_decl.exp,v
retrieving revision 1.8
diff -u -b -r1.8 tabled_read_decl.exp
--- tests/debugger/declarative/tabled_read_decl.exp	17 Jan 2003 05:57:02 -0000	1.8
+++ tests/debugger/declarative/tabled_read_decl.exp	9 Mar 2004 23:29:53 -0000
@@ -6,7 +6,7 @@
 Contexts will not be printed.
 mdb> table_io allow
 mdb> table_io start
-io tabling started
+I/O tabling started.
 mdb> break tabled_read_decl__test
  0: + stop  interface pred tabled_read_decl.test/4-0 (det)
 mdb> continue
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
Index: tests/tabling/mday.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/tabling/mday.m,v
retrieving revision 1.1
diff -u -b -r1.1 mday.m
--- tests/tabling/mday.m	30 Oct 2002 01:42:19 -0000	1.1
+++ tests/tabling/mday.m	8 Mar 2004 07:30:41 -0000
@@ -9,26 +9,26 @@
 :- implementation.
 
 main(IO0, IO) :-
-	( a(_) ->
+	( x(_) ->
 		write_string("yes\n", IO0, IO)
 	;
 		write_string("no\n", IO0, IO)
 	).
 
-:- pred a(int::out) is nondet.
+:- pred x(int::out) is nondet.
+:- pred y(int::out) is nondet.
+:- pred z(int::out) is nondet.
 :- pred b(int::out) is multi.
 :- pred c(int::out) is multi.
 :- pred d(int::out) is det.
-:- pred a1(int::out) is nondet.
-:- pred a2(int::out) is nondet.
 
-:- pragma minimal_model(a1/1).
-:- pragma minimal_model(a2/1).
+:- pragma minimal_model(y/1).
+:- pragma minimal_model(z/1).
 
-a(A) :- a2(A), d(A).
+x(A) :- y(A), d(A).
 
-a2(A) :- a1(A), a1(A).
-a1(A) :- b(A), c(A).
+y(A) :- z(A), z(A).
+z(A) :- b(A), c(A).
 
 b(3).
 b(4).
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.167
diff -u -b -r1.167 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	12 Feb 2004 06:54:59 -0000	1.167
+++ trace/mercury_trace_internal.c	9 Mar 2004 12:32:34 -0000
@@ -162,14 +162,6 @@
 static	MR_bool			MR_trace_internal_interacting = MR_FALSE;
 
 /*
-** The saved value of MR_io_tabling_enabled. We set that variable to MR_FALSE
-** when executing Mercury code from within the debugger, to avoid tabling I/O
-** primitives that aren't part of the user's program.
-*/
-
-static	MR_bool			MR_saved_io_tabling_enabled;
-
-/*
 ** We include values of sometimes-useful types such as typeinfos in the set of
 ** variables whose values we collect at events for possible later printing
 ** only if MR_print_optionals is true.
@@ -641,7 +633,7 @@
 static	char	*MR_trace_command_completer_next(const char *word,
 			size_t word_len, MR_Completer_Data *data);
 
-static	MR_bool	MR_saved_tabledebug;
+static	MR_SavedDebugState	MR_saved_debug_state;
 
 MR_Code *
 MR_trace_event_internal(MR_Trace_Cmd_Info *cmd, MR_bool interactive,
@@ -667,11 +659,7 @@
 	** do any I/O tabling.
 	*/
 
-	MR_trace_enabled = MR_FALSE;
-	MR_saved_tabledebug = MR_tabledebug;
-	MR_tabledebug = MR_FALSE;
-	MR_saved_io_tabling_enabled = MR_io_tabling_enabled;
-	MR_io_tabling_enabled = MR_FALSE;
+	MR_turn_off_debug(&MR_saved_debug_state);
 
 	MR_trace_internal_ensure_init();
 
@@ -716,9 +704,7 @@
 	MR_trace_event_number = event_details.MR_event_number;
 
 	MR_scroll_next = 0;
-	MR_trace_enabled = MR_TRUE;
-	MR_tabledebug = MR_saved_tabledebug;
-	MR_io_tabling_enabled = MR_saved_io_tabling_enabled;
+	MR_turn_debug_back_on(&MR_saved_debug_state);
 	return jumpaddr;
 }
 
@@ -794,7 +780,7 @@
 		MR_trace_internal_init_from_local();
 		MR_trace_internal_init_from_home_dir();
 
-		MR_saved_io_tabling_enabled = MR_TRUE;
+		MR_saved_debug_state.MR_sds_io_tabling_enabled = MR_TRUE;
 		MR_io_tabling_phase = MR_IO_TABLING_BEFORE;
 		MR_io_tabling_start = MR_IO_ACTION_MAX;
 		MR_io_tabling_end = MR_IO_ACTION_MAX;
@@ -3280,18 +3266,13 @@
 	found = MR_FALSE;
 	for (i = 0; i < MR_MAXFLAG; i++) {
 		if (MR_streq(MR_debug_flag_info[i].MR_debug_flag_name, name)) {
-			flagptr = &MR_debugflag[
-				MR_debug_flag_info[i].MR_debug_flag_index];
-
-			if (flagptr == &MR_tabledebug) {
 				/*
-				** The true value of MR_tabledebug is stored
-				** in MR_saved_tabledebug inside the call tree
+			** The true values of the debugging flags are stored
+			** in MR_saved_debug_state inside the call tree
 				** of MR_trace_event.
 				*/
-				flagptr = &MR_saved_tabledebug;
-			}
-
+			flagptr = &MR_saved_debug_state.MR_sds_debugflags[
+				MR_debug_flag_info[i].MR_debug_flag_index];
 			found = MR_TRUE;
 			break;
 		}
@@ -3590,16 +3571,16 @@
 
 		if (MR_io_tabling_phase == MR_IO_TABLING_BEFORE) {
 			fprintf(MR_mdb_out,
-				"io tabling has not yet started\n");
+				"I/O tabling has not yet started.\n");
 		} else if (MR_io_tabling_phase == MR_IO_TABLING_DURING) {
 			fprintf(MR_mdb_out,
-				"io tabling has started\n");
+				"I/O tabling has started.\n");
 		} else if (MR_io_tabling_phase == MR_IO_TABLING_AFTER) {
 			fprintf(MR_mdb_out,
-				"io tabling has stopped\n");
+				"I/O tabling has stopped.\n");
 		} else {
 			MR_fatal_error(
-				"io tabling in impossible phase\n");
+				"I/O tabling in impossible phase.\n");
 		}
 	} else if (word_count == 2 && (MR_streq(words[1], "start")
 		|| MR_streq(words[1], "begin")))
@@ -3620,16 +3601,16 @@
 #ifdef	MR_DEBUG_RETRY
 			MR_io_tabling_debug = MR_TRUE;
 #endif
-			fprintf(MR_mdb_out, "io tabling started\n");
+			fprintf(MR_mdb_out, "I/O tabling started.\n");
 		} else if (MR_io_tabling_phase == MR_IO_TABLING_DURING) {
 			fprintf(MR_mdb_out,
-				"io tabling has already started\n");
+				"I/O tabling has already started.\n");
 		} else if (MR_io_tabling_phase == MR_IO_TABLING_AFTER) {
 			fprintf(MR_mdb_out,
-				"io tabling has already stopped\n");
+				"I/O tabling has already stopped.\n");
 		} else {
 			MR_fatal_error(
-				"io tabling in impossible phase\n");
+				"I/O tabling in impossible phase.\n");
 		}
 	} else if (word_count == 2 && (MR_streq(words[1], "stop")
 		|| MR_streq(words[1], "end")))
@@ -3643,19 +3624,19 @@
 
 		if (MR_io_tabling_phase == MR_IO_TABLING_BEFORE) {
 			fprintf(MR_mdb_out,
-				"io tabling has not yet started\n");
+				"I/O tabling has not yet started.\n");
 		} else if (MR_io_tabling_phase == MR_IO_TABLING_DURING) {
 			MR_io_tabling_phase = MR_IO_TABLING_AFTER;
 			MR_io_tabling_end = MR_io_tabling_counter_hwm;
 			MR_io_tabling_stop_event_num =
 				event_info->MR_event_number;
-			fprintf(MR_mdb_out, "io tabling stopped\n");
+			fprintf(MR_mdb_out, "I/O tabling stopped.\n");
 		} else if (MR_io_tabling_phase == MR_IO_TABLING_AFTER) {
 			fprintf(MR_mdb_out,
-				"io tabling has already stopped\n");
+				"I/O tabling has already stopped.\n");
 		} else {
 			MR_fatal_error(
-				"io tabling in impossible phase\n");
+				"I/O tabling in impossible phase.\n");
 		}
 	} else if (word_count == 2 && MR_streq(words[1], "stats")) {
 		if (! MR_io_tabling_allowed) {
@@ -3779,14 +3760,14 @@
 {
 	if (word_count == 2 && MR_streq(words[1], "off")) {
 		MR_trace_unhide_events = MR_FALSE;
-		fprintf(MR_mdb_out, "hidden events are hidden\n");
+		fprintf(MR_mdb_out, "Hidden events are hidden.\n");
 	} else if (word_count == 2 && MR_streq(words[1], "on")) {
 		MR_trace_unhide_events = MR_TRUE;
 		MR_trace_have_unhid_events = MR_TRUE;
-		fprintf(MR_mdb_out, "hidden events are exposed\n");
+		fprintf(MR_mdb_out, "Hidden events are exposed.\n");
 	} else if (word_count == 1)  {
 		fprintf(MR_mdb_out,
-			"hidden events are %s\n",
+			"Hidden events are %s.\n",
 			MR_trace_unhide_events? "exposed" : "hidden");
 	} else {
 		MR_trace_usage("developer", "unhide_events");
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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