[m-rev.] diff: --mdb-disable-progress
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Aug 1 12:12:30 AEST 2005
Provide a mechanism to shut up progress messages from the declarative debugger
for use in bootchecks, to remove a potential source of spurious test case
failures.
runtime/mercury_wrapper.[ch]:
Add a new global, MR_mdb_decl_print_progress, that controls whether
we print progress messages. Disable it if the new option
--mdb-disable-progress is given.
tools/bootcheck:
Set the new option.
trace/mercury_trace_declarative.c:
Obey MR_mdb_decl_print_progress.
Fix a bunch of departures from our coding standards.
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
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/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
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/gears
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 extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.148
diff -u -b -r1.148 mercury_wrapper.c
--- runtime/mercury_wrapper.c 9 May 2005 08:05:02 -0000 1.148
+++ runtime/mercury_wrapper.c 31 Jul 2005 02:10:58 -0000
@@ -165,6 +165,7 @@
const char *MR_mdb_err_filename = NULL;
MR_bool MR_mdb_in_window = MR_FALSE;
+MR_bool MR_mdb_decl_print_progress = MR_TRUE;
MR_bool MR_mdb_benchmark_silent = MR_FALSE;
/* use readline() in the debugger even if the input stream is not a tty */
@@ -1005,6 +1006,7 @@
MR_MDB_IN,
MR_MDB_OUT,
MR_MDB_ERR,
+ MR_MDB_DISABLE_PROGRESS,
MR_MDB_BENCHMARK_SILENT,
MR_MDB_IN_WINDOW,
MR_FORCE_READLINE,
@@ -1042,6 +1044,7 @@
{ "mdb-out", 1, 0, MR_MDB_OUT },
{ "mdb-err", 1, 0, MR_MDB_ERR },
{ "mdb-in-window", 0, 0, MR_MDB_IN_WINDOW },
+ { "mdb-disable-progress", 0, 0, MR_MDB_DISABLE_PROGRESS },
{ "mdb-benchmark-silent", 0, 0, MR_MDB_BENCHMARK_SILENT },
{ "force-readline", 0, 0, MR_FORCE_READLINE },
{ "num-output-args", 1, 0, MR_NUM_OUTPUT_ARGS },
@@ -1252,6 +1255,10 @@
case 'w':
case MR_MDB_IN_WINDOW:
MR_mdb_in_window = MR_TRUE;
+ break;
+
+ case MR_MDB_DISABLE_PROGRESS:
+ MR_mdb_decl_print_progress = MR_FALSE;
break;
case MR_MDB_BENCHMARK_SILENT:
Index: runtime/mercury_wrapper.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_wrapper.h,v
retrieving revision 1.67
diff -u -b -r1.67 mercury_wrapper.h
--- runtime/mercury_wrapper.h 15 Feb 2005 05:22:33 -0000 1.67
+++ runtime/mercury_wrapper.h 31 Jul 2005 02:01:47 -0000
@@ -240,6 +240,9 @@
/* should mdb be started in a window */
extern MR_bool MR_mdb_in_window;
+/* should the declarative debugger print progress messages */
+extern MR_bool MR_mdb_decl_print_progress;
+
/* should mdb be silent for benchmarking purposes */
extern MR_bool MR_mdb_benchmark_silent;
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 slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
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
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.173
diff -u -b -r1.173 bootcheck
--- tools/bootcheck 3 Jun 2005 06:53:44 -0000 1.173
+++ tools/bootcheck 31 Jul 2005 02:13:52 -0000
@@ -553,7 +553,7 @@
true
fi
-NEW_MERCURY_OPTIONS="$MERCURY_OPTIONS"
+NEW_MERCURY_OPTIONS="$MERCURY_OPTIONS --mdb-disable-progress"
if $do_bootcheck
then
cvs diff: Diffing trace
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.82
diff -u -b -r1.82 mercury_trace.c
Index: trace/mercury_trace_declarative.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_declarative.c,v
retrieving revision 1.92
diff -u -b -r1.92 mercury_trace_declarative.c
--- trace/mercury_trace_declarative.c 19 Jun 2005 02:14:17 -0000 1.92
+++ trace/mercury_trace_declarative.c 31 Jul 2005 13:46:21 -0000
@@ -382,11 +382,9 @@
static MR_Trace_Node MR_trace_decl_neg_enter(MR_Event_Info *event_info,
MR_Trace_Node prev);
static MR_Trace_Node MR_trace_decl_neg_success(
- MR_Event_Info *event_info,
- MR_Trace_Node prev);
+ MR_Event_Info *event_info, MR_Trace_Node prev);
static MR_Trace_Node MR_trace_decl_neg_failure(
- MR_Event_Info *event_info,
- MR_Trace_Node prev);
+ MR_Event_Info *event_info, MR_Trace_Node prev);
static MR_Trace_Node MR_trace_matching_call(MR_Trace_Node node);
static MR_bool MR_trace_first_disjunct(MR_Event_Info *event_info);
static MR_bool MR_trace_matching_cond(const char *path,
@@ -485,6 +483,7 @@
** annotated trace. It must decide which events are included in the
** annotated trace.
*/
+
MR_Code *
MR_trace_decl_debug(MR_Trace_Cmd_Info *cmd, MR_Event_Info *event_info)
{
@@ -496,9 +495,7 @@
MR_Code *jumpaddr;
entry = event_info->MR_event_sll->MR_sll_entry;
-
MR_trace_edt_build_sanity_check(event_info, entry);
-
MR_trace_maybe_show_progress(event_info->MR_event_number);
if (! MR_trace_include_event(entry, event_info, &jumpaddr)) {
@@ -506,7 +503,6 @@
}
event_depth = MR_trace_calculate_event_depth(event_info);
-
MR_trace_count_event_in_implicit_subtree(event_info, event_depth);
if (MR_TRACE_EVENT_TOO_DEEP(event_depth)) {
@@ -633,9 +629,8 @@
*/
MR_edt_inside = MR_TRUE;
return MR_TRUE;
- } else if (event_info->MR_call_seqno ==
- MR_edt_start_seqno && MR_port_is_entry(
- event_info->MR_trace_port))
+ } else if (event_info->MR_call_seqno == MR_edt_start_seqno
+ && MR_port_is_entry(event_info->MR_trace_port))
{
MR_Event_Details event_details;
@@ -648,8 +643,7 @@
** trace from there.
*/
MR_edt_inside = MR_TRUE;
- *jumpaddr = MR_trace_decl_retry_supertree(
- MR_edt_max_depth,
+ *jumpaddr = MR_trace_decl_retry_supertree(MR_edt_max_depth,
event_info, &event_details);
/*
** Reset the depth since we will now
@@ -683,8 +677,8 @@
}
} else {
if (MR_edt_inside) {
- if (event_info->MR_call_seqno == MR_edt_start_seqno &&
- MR_port_is_final(event_info->MR_trace_port))
+ if (event_info->MR_call_seqno == MR_edt_start_seqno
+ && MR_port_is_final(event_info->MR_trace_port))
{
/*
** We are leaving the topmost call.
@@ -719,9 +713,11 @@
MR_trace_calculate_event_depth(MR_Event_Info *event_info)
{
if (event_info->MR_trace_port == MR_PORT_CALL
- || event_info->MR_trace_port == MR_PORT_REDO) {
+ || event_info->MR_trace_port == MR_PORT_REDO)
+ {
return ++MR_edt_depth;
}
+
if (MR_port_is_final(event_info->MR_trace_port)) {
/*
** The depth of the EXIT, FAIL or EXCP event is
@@ -730,6 +726,7 @@
*/
return MR_edt_depth--;
}
+
return MR_edt_depth;
}
@@ -814,6 +811,7 @@
** Retry max_distance if there are that many ancestors, otherwise
** retry as far as possible.
*/
+
static MR_Code *
MR_trace_decl_retry_supertree(MR_Unsigned max_distance,
MR_Event_Info *event_info, MR_Event_Details *event_details)
@@ -851,15 +849,14 @@
if (retry_result == MR_RETRY_ERROR) {
MR_trace_decl_mode = MR_TRACE_INTERACTIVE;
fflush(MR_mdb_out);
- fprintf(MR_mdb_err, "mdb: retry aborted in "
- "MR_trace_decl_retry_supertree: %s\n",
+ fprintf(MR_mdb_err,
+ "mdb: retry aborted in MR_trace_decl_retry_supertree: %s\n",
problem);
return NULL;
} else {
fflush(MR_mdb_out);
fprintf(MR_mdb_err, "mdb: internal error in "
- "MR_trace_decl_retry_supertree: direct retry "
- "impossible\n");
+ "MR_trace_decl_retry_supertree: direct retry impossible\n");
return NULL;
}
}
@@ -915,13 +912,11 @@
maybe_return_label = MR_DD_make_no_maybe_label();
}
- node = (MR_Trace_Node)
- MR_DD_construct_call_node((MR_Word) prev, atom_args,
- (MR_Word) event_info->MR_call_seqno,
+ node = (MR_Trace_Node) MR_DD_construct_call_node((MR_Word) prev,
+ atom_args, (MR_Word) event_info->MR_call_seqno,
(MR_Word) event_info->MR_event_number,
- (MR_Word) at_depth_limit,
- maybe_return_label, event_label_layout,
- MR_io_tabling_counter);
+ (MR_Word) at_depth_limit, maybe_return_label,
+ event_label_layout, MR_io_tabling_counter);
);
return node;
@@ -936,8 +931,7 @@
MR_Word atom_args;
atom_args = MR_decl_make_atom_args(event_info->MR_event_sll,
- event_info->MR_saved_regs,
- MR_PORT_EXIT);
+ event_info->MR_saved_regs, MR_PORT_EXIT);
call = MR_trace_matching_call(prev);
MR_decl_checkpoint_match(call);
@@ -950,16 +944,12 @@
*/
MR_trace_maybe_update_implicit_tree_ideal_depth(
MR_edt_depth + 1, call);
- last_interface = MR_DD_call_node_get_last_interface(
- (MR_Word) call);
- node = (MR_Trace_Node) MR_DD_construct_exit_node(
- (MR_Word) prev, (MR_Word) call, last_interface,
- atom_args,
- (MR_Word) event_info->MR_event_number,
- event_info->MR_event_sll,
+ last_interface = MR_DD_call_node_get_last_interface((MR_Word) call);
+ node = (MR_Trace_Node) MR_DD_construct_exit_node((MR_Word) prev,
+ (MR_Word) call, last_interface, atom_args,
+ (MR_Word) event_info->MR_event_number, event_info->MR_event_sll,
MR_io_tabling_counter);
- MR_DD_call_node_set_last_interface((MR_Word) call,
- (MR_Word) node);
+ MR_DD_call_node_set_last_interface((MR_Word) call, (MR_Word) node);
);
return node;
@@ -982,6 +972,7 @@
{
next = MR_trace_step_left_in_contour(next);
}
+
MR_decl_checkpoint_match(next);
MR_TRACE_CALL_MERCURY(
@@ -994,15 +985,11 @@
);
MR_TRACE_CALL_MERCURY(
- last_interface = MR_DD_call_node_get_last_interface(
- (MR_Word) call);
- node = (MR_Trace_Node) MR_DD_construct_redo_node(
- (MR_Word) prev,
- last_interface,
- (MR_Word) event_info->MR_event_number,
+ last_interface = MR_DD_call_node_get_last_interface((MR_Word) call);
+ node = (MR_Trace_Node) MR_DD_construct_redo_node((MR_Word) prev,
+ last_interface, (MR_Word) event_info->MR_event_number,
event_info->MR_event_sll);
- MR_DD_call_node_set_last_interface((MR_Word) call,
- (MR_Word) node);
+ MR_DD_call_node_set_last_interface((MR_Word) call, (MR_Word) node);
);
return node;
@@ -1037,14 +1024,12 @@
MR_trace_maybe_update_implicit_tree_ideal_depth(
MR_edt_depth + 1, call);
redo = MR_DD_call_node_get_last_interface((MR_Word) call);
- node = (MR_Trace_Node) MR_DD_construct_fail_node(
- (MR_Word) prev, (MR_Word) call,
- (MR_Word) redo,
- (MR_Word) event_info->MR_event_number,
- event_info->MR_event_sll);
- MR_DD_call_node_set_last_interface((MR_Word) call,
- (MR_Word) node);
+ node = (MR_Trace_Node) MR_DD_construct_fail_node((MR_Word) prev,
+ (MR_Word) call, (MR_Word) redo,
+ (MR_Word) event_info->MR_event_number, event_info->MR_event_sll);
+ MR_DD_call_node_set_last_interface((MR_Word) call, (MR_Word) node);
);
+
return node;
}
@@ -1064,17 +1049,14 @@
** event, so 1 should already have been subtracted from
** MR_edt_depth in MR_trace_calculate_event_depth.
*/
- MR_trace_maybe_update_implicit_tree_ideal_depth(
- MR_edt_depth + 1, call);
- last_interface = MR_DD_call_node_get_last_interface(
- (MR_Word) call);
- MR_DD_construct_excp_node(
- (MR_Word) prev, (MR_Word) call, last_interface,
- MR_trace_get_exception_value(),
+ MR_trace_maybe_update_implicit_tree_ideal_depth(MR_edt_depth + 1,
+ call);
+ last_interface = MR_DD_call_node_get_last_interface((MR_Word) call);
+ MR_DD_construct_excp_node((MR_Word) prev, (MR_Word) call,
+ last_interface, MR_trace_get_exception_value(),
(MR_Word) event_info->MR_event_number,
event_info->MR_event_sll, &node);
- MR_DD_call_node_set_last_interface(
- (MR_Word) call, (MR_Word) node);
+ MR_DD_call_node_set_last_interface((MR_Word) call, (MR_Word) node);
);
return node;
@@ -1086,10 +1068,10 @@
MR_Trace_Node node;
MR_TRACE_CALL_MERCURY(
- node = (MR_Trace_Node) MR_DD_construct_cond_node(
- (MR_Word) prev,
+ node = (MR_Trace_Node) MR_DD_construct_cond_node((MR_Word) prev,
event_info->MR_event_sll);
);
+
return node;
}
@@ -1105,20 +1087,17 @@
** Search through current contour for a matching COND event.
*/
next = prev;
- while (!MR_trace_matching_cond(path, next))
- {
+ while (!MR_trace_matching_cond(path, next)) {
next = MR_trace_step_left_in_contour(next);
}
+
cond = next;
MR_decl_checkpoint_match(cond);
MR_TRACE_CALL_MERCURY(
- MR_DD_cond_node_set_status((MR_Word) cond,
- MR_TRACE_STATUS_SUCCEEDED);
- node = (MR_Trace_Node) MR_DD_construct_then_node(
- (MR_Word) prev,
- (MR_Word) cond,
- event_info->MR_event_sll);
+ MR_DD_cond_node_set_status((MR_Word) cond, MR_TRACE_STATUS_SUCCEEDED);
+ node = (MR_Trace_Node) MR_DD_construct_then_node((MR_Word) prev,
+ (MR_Word) cond, event_info->MR_event_sll);
);
return node;
}
@@ -1133,31 +1112,26 @@
/*
** Search through previous contour for a matching COND event.
*/
- if (MR_trace_matching_cond(path, prev))
- {
+ if (MR_trace_matching_cond(path, prev)) {
cond = prev;
- }
- else
- {
+ } else {
MR_Trace_Node next;
next = prev;
- while (!MR_trace_matching_cond(path, next))
- {
+ while (!MR_trace_matching_cond(path, next)) {
next = MR_trace_step_left_in_contour(next);
}
+
cond = next;
}
MR_decl_checkpoint_match(cond);
MR_TRACE_CALL_MERCURY(
- MR_DD_cond_node_set_status((MR_Word) cond,
- MR_TRACE_STATUS_FAILED);
- node = (MR_Trace_Node) MR_DD_construct_else_node(
- (MR_Word) prev,
- (MR_Word) cond,
- event_info->MR_event_sll);
+ MR_DD_cond_node_set_status((MR_Word) cond, MR_TRACE_STATUS_FAILED);
+ node = (MR_Trace_Node) MR_DD_construct_else_node((MR_Word) prev,
+ (MR_Word) cond, event_info->MR_event_sll);
);
+
return node;
}
@@ -1167,8 +1141,7 @@
MR_Trace_Node node;
MR_TRACE_CALL_MERCURY(
- node = (MR_Trace_Node) MR_DD_construct_neg_node(
- (MR_Word) prev,
+ node = (MR_Trace_Node) MR_DD_construct_neg_node((MR_Word) prev,
event_info->MR_event_sll);
);
return node;
@@ -1184,31 +1157,26 @@
/*
** Search through previous contour for a matching NEGE event.
*/
- if (MR_trace_matching_neg(path, prev))
- {
+ if (MR_trace_matching_neg(path, prev)) {
nege = MR_trace_current_node;
- }
- else
- {
+ } else {
MR_Trace_Node next;
next = prev;
- while (!MR_trace_matching_neg(path, next))
- {
+ while (!MR_trace_matching_neg(path, next)) {
next = MR_trace_step_left_in_contour(next);
}
+
nege = next;
}
MR_decl_checkpoint_match(nege);
MR_TRACE_CALL_MERCURY(
- MR_DD_neg_node_set_status((MR_Word) nege,
- MR_TRACE_STATUS_SUCCEEDED);
- node = (MR_Trace_Node) MR_DD_construct_neg_succ_node(
- (MR_Word) prev,
- (MR_Word) nege,
- event_info->MR_event_sll);
+ MR_DD_neg_node_set_status((MR_Word) nege, MR_TRACE_STATUS_SUCCEEDED);
+ node = (MR_Trace_Node) MR_DD_construct_neg_succ_node((MR_Word) prev,
+ (MR_Word) nege, event_info->MR_event_sll);
);
+
return node;
}
@@ -1222,20 +1190,18 @@
** Search through current contour for a matching NEGE event.
*/
next = prev;
- while (!MR_trace_matching_neg(event_info->MR_event_path, next))
- {
+ while (!MR_trace_matching_neg(event_info->MR_event_path, next)) {
next = MR_trace_step_left_in_contour(next);
}
+
MR_decl_checkpoint_match(next);
MR_TRACE_CALL_MERCURY(
- MR_DD_neg_node_set_status((MR_Word) next,
- MR_TRACE_STATUS_FAILED);
- node = (MR_Trace_Node) MR_DD_construct_neg_fail_node(
- (MR_Word) prev,
- (MR_Word) next,
- event_info->MR_event_sll);
+ MR_DD_neg_node_set_status((MR_Word) next, MR_TRACE_STATUS_FAILED);
+ node = (MR_Trace_Node) MR_DD_construct_neg_fail_node((MR_Word) prev,
+ (MR_Word) next, event_info->MR_event_sll);
);
+
return node;
}
@@ -1245,10 +1211,10 @@
MR_Trace_Node node;
MR_TRACE_CALL_MERCURY(
- node = (MR_Trace_Node) MR_DD_construct_switch_node(
- (MR_Word) prev,
+ node = (MR_Trace_Node) MR_DD_construct_switch_node((MR_Word) prev,
event_info->MR_event_sll);
);
+
return node;
}
@@ -1258,16 +1224,12 @@
MR_Trace_Node node;
const char *path = event_info->MR_event_path;
- if (MR_trace_first_disjunct(event_info))
- {
+ if (MR_trace_first_disjunct(event_info)) {
MR_TRACE_CALL_MERCURY(
node = (MR_Trace_Node) MR_DD_construct_first_disj_node(
- (MR_Word) prev,
- event_info->MR_event_sll);
+ (MR_Word) prev, event_info->MR_event_sll);
);
- }
- else
- {
+ } else {
MR_Trace_Node next;
MR_Trace_Node first;
@@ -1275,26 +1237,23 @@
** Search through previous nodes for a matching DISJ event.
*/
next = MR_trace_find_prev_contour(prev);
- while (!MR_trace_matching_disj(path, next))
- {
+ while (!MR_trace_matching_disj(path, next)) {
next = MR_trace_step_left_in_contour(next);
}
+
MR_decl_checkpoint_match(next);
/*
** Find the first disj event of this disjunction.
*/
first = MR_trace_node_first_disj(next);
- if (first == (MR_Trace_Node) NULL)
- {
+ if (first == (MR_Trace_Node) NULL) {
first = next;
}
MR_TRACE_CALL_MERCURY(
node = (MR_Trace_Node) MR_DD_construct_later_disj_node(
- MR_trace_node_store,
- (MR_Word) prev,
- event_info->MR_event_sll,
+ MR_trace_node_store, (MR_Word) prev, event_info->MR_event_sll,
(MR_Word) first);
);
}
@@ -1313,10 +1272,10 @@
** is the correct one.
*/
next = node;
- while (MR_trace_node_port(next) != MR_PORT_CALL)
- {
+ while (MR_trace_node_port(next) != MR_PORT_CALL) {
next = MR_trace_step_left_in_contour(next);
}
+
return next;
}
@@ -1329,12 +1288,11 @@
** Return MR_TRUE iff the last component of the path is "d1;".
*/
path = event_info->MR_event_path;
- while (*path)
- {
- if (MR_string_equal(path, "d1;"))
- {
+ while (*path) {
+ if (MR_string_equal(path, "d1;")) {
return MR_TRUE;
}
+
path++;
}
@@ -1350,12 +1308,12 @@
MR_TRACE_CALL_MERCURY(
port = (MR_Trace_Port) MR_DD_trace_node_port(node);
);
- if (port != MR_PORT_COND)
- {
+
+ if (port != MR_PORT_COND) {
return MR_FALSE;
}
- node_path = MR_trace_node_path(node);
+ node_path = MR_trace_node_path(node);
return MR_trace_same_construct(path, node_path);
}
@@ -1368,11 +1326,12 @@
MR_TRACE_CALL_MERCURY(
port = (MR_Trace_Port) MR_DD_trace_node_port(node);
);
+
if (port != MR_PORT_NEG_ENTER) {
return MR_FALSE;
}
- node_path = MR_trace_node_path(node);
+ node_path = MR_trace_node_path(node);
return MR_trace_same_construct(path, node_path);
}
@@ -1385,6 +1344,7 @@
MR_TRACE_CALL_MERCURY(
port = (MR_Trace_Port) MR_DD_trace_node_port(node);
);
+
if (port == MR_PORT_DISJ) {
node_path = MR_trace_node_path(node);
return MR_trace_same_construct(path, node_path);
@@ -1428,8 +1388,10 @@
if (*path == '\0') {
return MR_FALSE;
}
+
path++;
}
+
path++;
return (*path == '\0');
}
@@ -1444,8 +1406,9 @@
int hv; /* any head variable */
int num_added_args;
MR_TypeInfoParams type_params;
- const MR_Proc_Layout *entry = layout->MR_sll_entry;
+ const MR_Proc_Layout *entry;
+ entry = layout->MR_sll_entry;
MR_trace_init_point_vars(layout, saved_regs, port, MR_TRUE);
MR_proc_id_arity_addedargs_predfunc(entry, &arity, &num_added_args,
&pred_or_func);
@@ -1473,8 +1436,7 @@
/* this head variable is not live at this port */
MR_TRACE_CALL_MERCURY(
MR_DD_add_trace_atom_arg_no_value(hlds_num,
- is_prog_visible_headvar, atom_args,
- &atom_args);
+ is_prog_visible_headvar, atom_args, &atom_args);
);
} else {
MR_TRACE_USE_HP(
@@ -1482,9 +1444,8 @@
);
MR_TRACE_CALL_MERCURY(
- MR_DD_add_trace_atom_arg_value( hlds_num,
- is_prog_visible_headvar, arg,
- atom_args, &atom_args);
+ MR_DD_add_trace_atom_arg_value(hlds_num,
+ is_prog_visible_headvar, arg, atom_args, &atom_args);
);
}
}
@@ -1507,8 +1468,7 @@
MR_TRACE_CALL_MERCURY(
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_browser_persistent_state, MR_trace_help_system,
&MR_trace_front_end_state);
);
done = MR_TRUE;
@@ -1521,8 +1481,7 @@
MR_trace_decl_ensure_init();
MR_TRACE_CALL_MERCURY(
MR_DD_decl_set_fallback_search_mode(search_mode,
- MR_trace_front_end_state,
- &MR_trace_front_end_state);
+ MR_trace_front_end_state, &MR_trace_front_end_state);
);
}
@@ -1537,13 +1496,13 @@
*search_mode = MR_DD_decl_top_down_search_mode();
is_valid = MR_TRUE;
} else if (MR_streq(search_mode_string, "divide_and_query")) {
- *search_mode =
- MR_DD_decl_divide_and_query_search_mode();
+ *search_mode = MR_DD_decl_divide_and_query_search_mode();
is_valid = MR_TRUE;
} else {
is_valid = MR_FALSE;
}
);
+
return is_valid;
}
@@ -1565,14 +1524,12 @@
MR_String aligned_module_name;
MR_TRACE_USE_HP(
- MR_make_aligned_string(aligned_module_name,
- (MR_String) module_name);
+ MR_make_aligned_string(aligned_module_name, (MR_String) module_name);
);
MR_trace_decl_ensure_init();
MR_TRACE_CALL_MERCURY(
MR_DD_decl_add_trusted_module((MR_String)aligned_module_name,
- MR_trace_front_end_state,
- &MR_trace_front_end_state);
+ MR_trace_front_end_state, &MR_trace_front_end_state);
);
}
@@ -1582,8 +1539,7 @@
MR_trace_decl_ensure_init();
MR_TRACE_CALL_MERCURY(
MR_DD_decl_add_trusted_pred_or_func(entry,
- MR_trace_front_end_state,
- &MR_trace_front_end_state);
+ MR_trace_front_end_state, &MR_trace_front_end_state);
);
}
@@ -1593,8 +1549,7 @@
MR_trace_decl_ensure_init();
MR_TRACE_CALL_MERCURY(
MR_DD_decl_trust_standard_library(
- MR_trace_front_end_state,
- &MR_trace_front_end_state);
+ MR_trace_front_end_state, &MR_trace_front_end_state);
);
}
@@ -1606,13 +1561,14 @@
MR_trace_decl_ensure_init();
MR_TRACE_CALL_MERCURY(
- success = MR_DD_decl_remove_trusted(n,
- MR_trace_front_end_state,
+ success = MR_DD_decl_remove_trusted(n, MR_trace_front_end_state,
&new_diagnoser);
);
+
if (success) {
MR_trace_front_end_state = new_diagnoser;
}
+
return success;
}
@@ -1626,6 +1582,7 @@
MR_DD_decl_get_trusted_list(MR_trace_front_end_state,
mdb_command_format, &trusted_list);
);
+
fprintf(fp, trusted_list);
}
@@ -1708,8 +1665,7 @@
out = fopen(outfile, "w");
if (out == NULL) {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: cannot open file `%s' for output: %s.\n",
+ fprintf(MR_mdb_err, "mdb: cannot open file `%s' for output: %s.\n",
outfile, strerror(errno));
return MR_FALSE;
} else {
@@ -1718,11 +1674,8 @@
}
MR_trace_decl_mode = trace_mode;
-
MR_trace_decl_ensure_init();
-
MR_trace_current_node = (MR_Trace_Node) NULL;
-
message = MR_trace_start_collecting(event_info->MR_event_number,
event_info->MR_call_seqno, MR_edt_default_depth_limit,
MR_FALSE, cmd, event_info, event_details, jumpaddr);
@@ -1732,8 +1685,7 @@
return MR_TRUE;
} else {
fflush(MR_mdb_out);
- fprintf(MR_mdb_err,
- "mdb: failed to start collecting events:\n%s\n",
+ fprintf(MR_mdb_err, "mdb: failed to start collecting events:\n%s\n",
message);
return MR_FALSE;
@@ -1759,8 +1711,7 @@
MR_trace_current_node = call_preceding;
message = MR_trace_start_collecting(event, seqno, depth_limit,
- create_supertree, cmd, event_info, event_details,
- &jumpaddr);
+ create_supertree, cmd, event_info, event_details, &jumpaddr);
if (message != NULL) {
fflush(MR_mdb_out);
@@ -1808,8 +1759,7 @@
event_info->MR_event_number > event)
{
retry_distance = MR_find_first_call_less_eq_seq_or_event(
- MR_FIND_FIRST_CALL_BEFORE_SEQ, seqno,
- event_info->MR_event_sll,
+ MR_FIND_FIRST_CALL_BEFORE_SEQ, seqno, event_info->MR_event_sll,
MR_saved_sp(event_info->MR_saved_regs),
MR_saved_curfr(event_info->MR_saved_regs), &problem);
@@ -1826,8 +1776,7 @@
if (retry_result == MR_RETRY_ERROR) {
return problem;
} else {
- return "internal error: direct retry "
- "impossible";
+ return "internal error: direct retry impossible";
}
}
if (unsafe_retry) {
@@ -1986,13 +1935,13 @@
MR_trace_event_number = event_details->MR_event_number;
if (bug_found) {
- return MR_decl_go_to_selected_event(bug_event, cmd,
- event_info, event_details);
+ return MR_decl_go_to_selected_event(bug_event, cmd, event_info,
+ event_details);
}
if (symptom_found) {
- return MR_decl_go_to_selected_event(symptom_event, cmd,
- event_info, event_details);
+ return MR_decl_go_to_selected_event(symptom_event, cmd, event_info,
+ event_details);
}
if (no_bug_found) {
@@ -2010,9 +1959,8 @@
** Restart the declarative debugger with the appropriate depth
** limit.
*/
- return MR_trace_restart_decl_debug(call_preceding,
- final_event, topmost_seqno, MR_FALSE,
- requested_subtree_depth, cmd, event_info,
+ return MR_trace_restart_decl_debug(call_preceding, final_event,
+ topmost_seqno, MR_FALSE, requested_subtree_depth, cmd, event_info,
event_details);
}
@@ -2020,9 +1968,8 @@
/*
** Front end requires a supertree to be made explicit.
*/
- return MR_trace_restart_decl_debug((MR_Trace_Node)NULL,
- final_event, topmost_seqno, MR_TRUE,
- MR_edt_default_depth_limit, cmd,
+ return MR_trace_restart_decl_debug((MR_Trace_Node) NULL, final_event,
+ topmost_seqno, MR_TRUE, MR_edt_default_depth_limit, cmd,
event_info, event_details);
}
@@ -2035,16 +1982,17 @@
MR_Event_Info *event_info, MR_Event_Details *event_details)
{
const char *problem;
- /*
- ** Initialise this to avoid warnings that it might be used
- ** uninitialised.
- */
- MR_Retry_Result retry_result = MR_RETRY_OK_DIRECT;
+ MR_Retry_Result retry_result;
MR_Code *jumpaddr;
int ancestor_level;
MR_bool unsafe_retry;
/*
+ ** Initialise this to avoid warnings that it might be used uninitialised.
+ */
+ retry_result = MR_RETRY_OK_DIRECT;
+
+ /*
** We only need to do a retry if the event number we want to be at is
** less than or equal to the current event number (we need to do a
** retry if the event numbers are equal, because MR_trace_real will
@@ -2068,39 +2016,35 @@
MR_print_stack_regs(stdout, event_info->MR_saved_regs);
MR_print_succip_reg(stdout, event_info->MR_saved_regs);
#endif
- retry_result = MR_trace_retry(event_info,
- event_details, ancestor_level,
- MR_RETRY_IO_INTERACTIVE,
+ retry_result = MR_trace_retry(event_info, event_details,
+ ancestor_level, MR_RETRY_IO_INTERACTIVE,
MR_trace_decl_assume_all_io_is_tabled,
MR_DECL_UNTABLED_IO_RETRY_MESSAGE,
- &unsafe_retry, &problem, MR_mdb_in,
- MR_mdb_out, &jumpaddr);
+ &unsafe_retry, &problem, MR_mdb_in, MR_mdb_out, &jumpaddr);
#ifdef MR_DEBUG_RETRY
MR_print_stack_regs(stdout, event_info->MR_saved_regs);
MR_print_succip_reg(stdout, event_info->MR_saved_regs);
MR_print_r_regs(stdout, event_info->MR_saved_regs);
#endif
}
- if ((ancestor_level < 0) ||
- (retry_result != MR_RETRY_OK_DIRECT)) {
+ if ((ancestor_level < 0) || (retry_result != MR_RETRY_OK_DIRECT)) {
fflush(MR_mdb_out);
fprintf(MR_mdb_err, "mdb: diagnosis aborted:\n");
if (ancestor_level < 0) {
- fprintf(MR_mdb_err, "couldn't find call on "
- "stack: %s\n", problem);
+ fprintf(MR_mdb_err, "couldn't find call on stack: %s\n",
+ problem);
} else {
if (retry_result == MR_RETRY_ERROR) {
fprintf(MR_mdb_err, "%s\n", problem);
} else {
- fprintf(MR_mdb_err,
- "direct retry impossible\n");
+ fprintf(MR_mdb_err, "direct retry impossible\n");
}
}
+
MR_trace_decl_mode = MR_TRACE_INTERACTIVE;
MR_debug_enabled = MR_TRUE;
MR_update_trace_func_enabled();
- return MR_trace_event_internal(cmd, MR_TRUE, NULL,
- event_info);
+ return MR_trace_event_internal(cmd, MR_TRUE, NULL, event_info);
}
} else {
/*
@@ -2131,6 +2075,7 @@
MR_TRACE_CALL_MERCURY(
path = MR_DD_trace_node_path((MR_Word) node);
);
+
return path;
}
@@ -2142,6 +2087,7 @@
MR_TRACE_CALL_MERCURY(
port = (MR_Trace_Port) MR_DD_trace_node_port((MR_Word) node);
);
+
return port;
}
@@ -2152,14 +2098,13 @@
MR_trace_node_store++;
MR_TRACE_CALL_MERCURY(
- if (!MR_DD_trace_node_seqno(MR_trace_node_store,
- (MR_Word) node,
+ if (!MR_DD_trace_node_seqno(MR_trace_node_store, (MR_Word) node,
(MR_Integer *) &seqno))
{
- MR_fatal_error("MR_trace_node_seqno: "
- "not an interface event");
+ MR_fatal_error("MR_trace_node_seqno: not an interface event");
}
);
+
return seqno;
}
@@ -2169,13 +2114,11 @@
MR_Trace_Node first;
MR_TRACE_CALL_MERCURY(
- if (!MR_DD_trace_node_first_disj((MR_Word) node,
- (MR_Word *) &first))
- {
- MR_fatal_error("MR_trace_node_first_disj: "
- "not a DISJ event");
+ if (!MR_DD_trace_node_first_disj((MR_Word) node, (MR_Word *) &first)) {
+ MR_fatal_error("MR_trace_node_first_disj: not a DISJ event");
}
);
+
return first;
}
@@ -2188,9 +2131,10 @@
MR_trace_node_store++;
MR_TRACE_CALL_MERCURY(
- next = (MR_Trace_Node) MR_DD_step_left_in_contour(
- MR_trace_node_store, node);
+ next = (MR_Trace_Node) MR_DD_step_left_in_contour(MR_trace_node_store,
+ node);
);
+
return next;
}
@@ -2203,17 +2147,19 @@
MR_trace_node_store++;
MR_TRACE_CALL_MERCURY(
- next = (MR_Trace_Node) MR_DD_find_prev_contour(
- MR_trace_node_store, node);
+ next = (MR_Trace_Node) MR_DD_find_prev_contour(MR_trace_node_store,
+ node);
);
+
return next;
}
static void
MR_trace_reset_implicit_subtree_counters()
{
- int i = 0;
+ int i;
+ i = 0;
while ((i < MR_edt_implicit_subtree_num_counters)
&& (MR_edt_implicit_subtree_counters[i] != 0))
{
@@ -2227,8 +2173,8 @@
{
int i;
- MR_edt_implicit_subtree_counters = (MR_Unsigned *) malloc(
- size * sizeof(MR_Unsigned));
+ MR_edt_implicit_subtree_counters = (MR_Unsigned *)
+ malloc(size * sizeof(MR_Unsigned));
for (i = 0; i < size; i++) {
MR_edt_implicit_subtree_counters[i] = 0;
@@ -2246,13 +2192,14 @@
static MR_Unsigned
MR_trace_calc_implicit_subtree_ideal_depth()
{
- MR_Integer depth = 0;
- MR_Unsigned total = 0;
+ MR_Integer depth;
+ MR_Unsigned total;
MR_Unsigned events_at_depth;
+ depth = 0;
+ total = 0;
while (depth < MR_edt_implicit_subtree_num_counters) {
events_at_depth = MR_edt_implicit_subtree_counters[depth];
-
total += events_at_depth;
if (total > MR_edt_desired_nodes_in_subtree) {
@@ -2283,6 +2230,7 @@
** NOTE: This function must be called within a MR_TRACE_CALL_MERCURY
** wrapper.
*/
+
static void
MR_trace_maybe_update_implicit_tree_ideal_depth(MR_Unsigned current_depth,
MR_Trace_Node call)
@@ -2293,22 +2241,18 @@
ideal_depth = MR_trace_calc_implicit_subtree_ideal_depth();
/*
- ** Use the lowest depth if the ideal depth was set on a
- ** previous EXIT.
+ ** Use the lowest depth if the ideal depth was set on a previous EXIT.
** XXX In future the implicit subtree information should be
** stored at final events, not CALL events, however this
** goes hand in hand with a change to build pieces of the
** annotated trace only between a REDO and its EXIT, if the
** events between the CALL and the previous EXIT have already
** been materialized (currently the events between the CALL
- ** and EXIT will be materialized twice in this kind of
- ** situation).
+ ** and EXIT will be materialized twice in this kind of situation).
*/
prev_ideal_depth = MR_DD_get_implicit_tree_ideal_depth(call);
- if (prev_ideal_depth == 0 || prev_ideal_depth > ideal_depth)
- {
- MR_DD_call_node_update_implicit_tree_info(call,
- ideal_depth);
+ if (prev_ideal_depth == 0 || prev_ideal_depth > ideal_depth) {
+ MR_DD_call_node_update_implicit_tree_info(call, ideal_depth);
}
}
}
@@ -2318,6 +2262,7 @@
{
MR_Unsigned current_tick;
+ if (MR_mdb_decl_print_progress) {
if (! MR_edt_building_supertree) {
if (event_number % MR_DECL_PROGRESS_CHECK_INTERVAL == 0
|| event_number == MR_edt_last_event)
@@ -2334,16 +2279,15 @@
*/
MR_edt_progress_last_tick = 1;
} else if (MR_edt_progress_last_tick > 0) {
- current_tick = (MR_Unsigned)((
- (float)(event_number - MR_edt_first_event)
- * (float)MR_DECL_PROGRESS_TOTAL)
+ current_tick = (MR_Unsigned) ((
+ (float) (event_number - MR_edt_first_event)
+ * (float) MR_DECL_PROGRESS_TOTAL)
/ (float)(MR_edt_last_event - MR_edt_first_event));
if (current_tick != MR_edt_progress_last_tick) {
for (; MR_edt_progress_last_tick < current_tick;
MR_edt_progress_last_tick++)
{
- fprintf(MR_mdb_out,
- MR_DECL_PROGRESS_TICK_STRING);
+ fprintf(MR_mdb_out, MR_DECL_PROGRESS_TICK_STRING);
fflush(MR_mdb_out);
}
}
@@ -2370,18 +2314,22 @@
< MR_get_user_cpu_miliseconds())
{
MR_edt_progress_last_tick++;
- fprintf(MR_mdb_out,
- MR_DECL_PROGRESS_TICK_STRING);
+ fprintf(MR_mdb_out, MR_DECL_PROGRESS_TICK_STRING);
fflush(MR_mdb_out);
}
}
}
+ }
}
static void
-MR_trace_finish_progress() {
+MR_trace_finish_progress()
+{
+ if (MR_mdb_decl_print_progress) {
fprintf(MR_mdb_out, "\n");
fflush(MR_mdb_out);
+ }
+
MR_edt_progress_last_tick = 0;
}
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