[m-rev.] for review: retry -a
Zoltan Somogyi
zs at cs.mu.OZ.AU
Sun Jul 28 03:05:44 AEST 2002
For review by anyone.
Zoltan.
Add an option to the mdb retry command, -a or --allow-io, whose effect is
that it makes mdb allow retries over I/O without asking the user a question.
Since the exact form of this question depends on compilation options,
this should make it easier to write expected output files for test cases.
trace/mercury_trace_internal.c:
Implement the new option.
doc/user_guide.texi:
Document the new option.
tests/debugger/tabled_read_unitize.{inp,exp}:
Use the new option.
cvs diff: Diffing .
cvs diff: Diffing bench
cvs diff: Diffing bench/progs
cvs diff: Diffing bench/progs/compress
cvs diff: Diffing bench/progs/icfp2000
cvs diff: Diffing bench/progs/icfp2001
cvs diff: Diffing bench/progs/nuc
cvs diff: Diffing bench/progs/ray
cvs diff: Diffing bench/progs/tree234
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
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.314
diff -u -b -r1.314 user_guide.texi
--- doc/user_guide.texi 12 Jun 2002 14:26:55 -0000 1.314
+++ doc/user_guide.texi 27 Jul 2002 15:59:11 -0000
@@ -2201,8 +2201,9 @@
@subsection Backward movement commands
@sp 1
@table @code
- at item retry
+ at item retry [-a]
@kindex retry (mdb command)
+If
Restarts execution at the call port
of the call corresponding to the current event.
@sp 1
@@ -2211,10 +2212,14 @@
(The compiler will keep the values
of the input arguments of traced predicates as long as possible,
but it cannot keep them beyond the point where they are destructively updated.)
- at c XXX THE EXCEPTION IS NOT YET IMPLEMENTED.
- at c The exception is values of type `io__state';
- at c the debugger can perform a retry if the only missing value is of
- at c type `io__state' (there can be only one io__state at any given time).
+The exception is values of type `io__state';
+the debugger can perform a retry if the only missing value is of
+type `io__state' (there can be only one io__state at any given time).
+ at sp 1
+Since retries over I/O actions are not always safe,
+the debugger will normally ask the user if they really want to do this.
+The option @samp{-a} or @samp{--allow-io} suppresses the question,
+and tells the debugger that retrying over I/O is OK.
@c @sp 1
@c A retry in which the values of all input arguments are available
@c works fine, provided that the predicates defined in C code that are
@@ -2247,10 +2252,25 @@
@c XXX not yet
@c and may result in the execution of I/O and/or other side-effects.
@sp 1
- at item retry @var{num}
+ at item retry [-a] @var{num}
Restarts execution at the call port of the call corresponding to
the @var{num}'th ancestor of the call to which the current event belongs.
For example, if @var{num} is 1, it restarts the parent of the current call.
+ at sp 1
+The command will report an error unless
+the values of all the input arguments of the selected call are available
+at the return site at which control would reenter the selected call.
+(The compiler will keep the values
+of the input arguments of traced predicates as long as possible,
+but it cannot keep them beyond the point where they are destructively updated.)
+The exception is values of type `io__state';
+the debugger can perform a retry if the only missing value is of
+type `io__state' (there can be only one io__state at any given time).
+ at sp 1
+Since retries over I/O actions are not always safe,
+the debugger will normally ask the user if they really want to do this.
+The option @samp{-a} or @samp{--allow-io} suppresses the question,
+and tells the debugger that retrying over I/O is OK.
@end table
@sp 1
@node Browsing commands
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/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/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
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
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/tabled_read_unitize.exp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/tabled_read_unitize.exp,v
retrieving revision 1.1
diff -u -b -r1.1 tabled_read_unitize.exp
--- tests/debugger/tabled_read_unitize.exp 26 Jul 2002 04:20:14 -0000 1.1
+++ tests/debugger/tabled_read_unitize.exp 27 Jul 2002 12:37:13 -0000
@@ -14,6 +14,8 @@
38: 12 2 THEN pred tabled_read_unitize:unitize/4-0 (det) t;
39: 12 2 ELSE pred tabled_read_unitize:unitize/4-0 (det) t;c2;e;
40: 12 2 EXIT pred tabled_read_unitize:unitize/4-0 (det)
+mdb> retry -a
+ 37: 12 2 CALL pred tabled_read_unitize:unitize/4-0 (det)
mdb> continue -S
123
4506
Index: tests/debugger/tabled_read_unitize.inp
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/tabled_read_unitize.inp,v
retrieving revision 1.1
diff -u -b -r1.1 tabled_read_unitize.inp
--- tests/debugger/tabled_read_unitize.inp 26 Jul 2002 04:20:14 -0000 1.1
+++ tests/debugger/tabled_read_unitize.inp 27 Jul 2002 11:50:18 -0000
@@ -5,5 +5,5 @@
break unitize
continue
finish -a
-retry
+retry -a
continue -S
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/structure_reuse
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/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
cvs diff: Diffing trace
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.130
diff -u -b -r1.130 mercury_trace_internal.c
--- trace/mercury_trace_internal.c 22 Jul 2002 07:13:12 -0000 1.130
+++ trace/mercury_trace_internal.c 27 Jul 2002 11:49:02 -0000
@@ -466,6 +466,9 @@
static MR_bool MR_trace_options_strict_print(MR_Trace_Cmd_Info *cmd,
char ***words, int *word_count,
const char *cat, const char *item);
+static MR_bool MR_trace_options_retry(MR_bool *allow_io,
+ char ***words, int *word_count,
+ const char *cat, const char *item);
static MR_bool MR_trace_options_when_action_multi_ignore(MR_Spy_When *when,
MR_Spy_Action *action, MR_MultiMatch *multi_match,
MR_Spy_Ignore_When *ignore_when, int *ignore_count,
@@ -1576,10 +1579,16 @@
{
int n;
int ancestor_level;
+ MR_bool unconditional_allow_io;
const char *problem;
MR_Retry_Result result;
- if (word_count == 2 && MR_trace_is_number(words[1], &n)) {
+ unconditional_allow_io = MR_FALSE;
+ if (! MR_trace_options_retry(&unconditional_allow_io,
+ &words, &word_count, "backward", "retry"))
+ {
+ ; /* the usage message has already been printed */
+ } else if (word_count == 2 && MR_trace_is_number(words[1], &n)) {
ancestor_level = n;
} else if (word_count == 1) {
ancestor_level = 0;
@@ -1596,7 +1605,7 @@
}
result = MR_trace_retry(event_info, event_details,
- ancestor_level, MR_FALSE, &problem,
+ ancestor_level, unconditional_allow_io, &problem,
MR_mdb_in, MR_mdb_out, jumpaddr);
switch (result) {
@@ -3718,6 +3727,39 @@
case 's':
cmd->MR_trace_print_level = MR_PRINT_LEVEL_SOME;
+ break;
+
+ default:
+ MR_trace_usage(cat, item);
+ return MR_FALSE;
+ }
+ }
+
+ *words = *words + MR_optind - 1;
+ *word_count = *word_count - MR_optind + 1;
+ return MR_TRUE;
+}
+
+static struct MR_option MR_trace_retry_opts[] =
+{
+ { "allow-io", MR_no_argument, NULL, 'a' },
+ { NULL, MR_no_argument, NULL, 0 }
+};
+
+static MR_bool
+MR_trace_options_retry(MR_bool *unconditional_allow_io,
+ char ***words, int *word_count, const char *cat, const char *item)
+{
+ int c;
+
+ MR_optind = 0;
+ while ((c = MR_getopt_long(*word_count, *words, "a",
+ MR_trace_retry_opts, NULL)) != EOF)
+ {
+ switch (c) {
+
+ case 'a':
+ *unconditional_allow_io = MR_TRUE;
break;
default:
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