Estimated hours taken: 6
trace/mercury_trace_declarative.c:
Deep copy some data to the global heap, as it may need to be
used after being backtracked over.
tests/debugger/declarative/Mmakefile:
Re-enable the test that was failing due to this bug.
Estimated hours taken: 0.75
trace/mercury_trace_vars.c:
trace/mercury_trace_external.c:
Change things so that variable numbers for the `print' and `browse'
commands start from one rather than from zero. This makes more
sense for most users, particluarly at "call" ports, where you want
e.g. `print 3' to show the third argument, not the second argument.
Estimated hours taken: 0.25
browser/.cvsignore:
library/.cvsignore:
profiler/.cvsignore:
runtime/.cvsignore:
trace/.cvsignore:
Update the .cvsignore files to work under linux.
Estimated hours taken: 0.25
trace/mercury_trace_browse.h:
trace/mercury_trace_browse.c:
Put MR_trace_query_external() inside `#ifdef MR_USE_EXTERNAL_DEBUGGER',
because it gets a compile error unless that flag is set.
Estimated hours taken: 0.25
trace/mercury_trace_browse.h:
trace/mercury_trace_browse.c:
Put MR_trace_browse_external() inside
`#ifdef MR_USE_EXTERNAL_DEBUGGER',
because it gets a compile error unless that flag is set.
Estimated hours taken: 1
browser/Mmakefile:
compiler/Mmakefile:
library/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
Simplify the code by deleting unnecessary uses of $(EXTRA_*), etc.
This is now handled once and for all in scripts/Mmake.vars, and
so it doesn't need to be separately handled by */Mmakefile.
This patch also fixes an annoyance where if you set EXTRA_CFLAGS,
the flags that you set were being passed to mgnuc twice.
Estimated hours taken: 6
If calling from the internal debugger, use readline input for the
interactive term browser and interactive queries.
browser/browse.m:
Change some if-then-elses to switches, which will help
catch errors if a new functor is added to the debugger type.
browser/parse.m:
browser/util.m:
Return a string from util__trace_getline/4 rather than a
list of chars, which saves converting from a string to a list
of chars and then back again.
browser/util.m:
Add a version of util__trace_getline that also takes I/O
stream arguments. Pass these arguments to MR_trace_getline.
browser/declarative_oracle.m:
Call util__trace_getline/4 to do input via readline (if
available). Improve error handling.
browser/interactive_query.m:
Call util__trace_getline to get user input, instead of
standard library predicates.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
Add two I/O stream arguments to MR_trace_getline.
Estimated hours taken: 0.1
library/builtin.m:
Include type_ctor_infos for saved succips, hps, curfrs etc
only when doing native gc.
trace/mercury_trace_vars.m:
Ignore type_ctor_infos for saved succips, hps, curfrs etc
only when doing native gc, since otherwise they cannot occur.
Estimated hours taken: 0.8
trace/mercury_trace_vars.[ch]:
Document some data structures better.
Remove an unnecessary parameter.
Avoid using non-ANSI library functions.
trace/mercury_trace_internal.c:
Don't supply the unnecessary parameter.
Estimated hours taken: 14
Add a module layout structure containing a string table and a table of
pointers to the proc layouts of the module's procedures. This speeds up
debugger initialization, and reduces the executable size of the compiler
by almost 1.2 Mb (about 3.7%) when compiled with debugging.
Instead of representing variables names as strings (32 or 64 bit pointers)
in the debugger's static data structures, with the string's prefix representing
the variable's number (e.g. "5:X"), represent them as a 16-bit variable number
and a 16 bit offset into the module-wide string table. This gains simplicity
of processing (no more search for the ":") and reduces the amount of storage
required, a bit on 32-bit platforms (we don't have to store "5:ModuleInfo"
and "10:ModuleInfo" strings separately, and there are no string prefixes to
store) and more on 64-bit platforms.
The 16-bit limits are generous. A procedure with more than 64K variables will
take forever to compile (that is why we impose a 4K limit on the number
of variables in inlining), and even the string tables of typecheck.m and
make_hlds require less than four kilobytes each. Exceeding the limits
would require code no human would write. Automatically generated code may
be a problem, but the help the debugger can give on such code is limited
already. In any case, we detect overflows and handle them sensibly.
This change does not enhance the debugger to take advantage of the easier
availability of variable numbers, except to improve the implementation
of retry; that will come later.
The inclusion of the procedure table in the module layout structure
reduces the cost of registering all procedures in all modules,
a task usually performed at the time of the setting of the first breakpoint.
This used to require processing all the internal labels in the label table,
and thus used to take a few seconds for large executables. The sweep of
all internal labels is no longer required, so registering is now much faster.
runtime/mercury_stack_layout.h:
Add the definition of MR_Module_Layout.
Modify label layouts to represent names as offsets in the string table,
not as raw character pointers. This required modifing proc layouts
to include a pointer to the module's layout, so you can find the
string table.
Update the macros that look up variable names.
runtime/mercury_layout_util.h:
Use the updated macros for looking up variable names.
runtime/mercury_wrapper.[ch]:
Add a new indirect pointer, MR_register_module_layout, which points
to a function that registers a module layout, or is NULL if debugging
is not enabled.
runtime/mercury_init.h:
Declare the function whose address may be assigned to
MR_register_module_layout in a <main>_init.c file.
util/mkinit.c:
Initialize MR_register_module_layout with either the address of
MR_register_module_layout_real or NULL, depending on whether
debugging is enabled or not.
compiler/continuation_info.m:
Don't give names (V_n) to nameless variables, because we don't want
them to be included in the variables debugging knows about.
compiler/llds.m:
Add a new function symbol to the type data_addr, which stands for
the module layout structure of the named (now always the current)
module.
Add a new function symbol to the type rval_const. The new function
symbols, multi_string_const, contains an array of characters of an
explicitly given length, which consists of several strings, each
terminated by a null character.
compiler/llds_out.m:
Accommodate the changes to llds.m, and expand the module initialization
code to register the module layout structure, if the pointer to the
registration function is not NULL.
compiler/stack_layout.m:
Generate the new data structures for representing variable names,
as well as the module layout.
compiler/mercury_compile.m:
Rename some variables to reflect the fact that stack_layout.m can
now include a module layout structure in the list of static layout
structures it returns.
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/jumpopt.m:
compiler/opt_debug.m:
Minor changes to accommodate multi_string_consts.
trace/mercury_trace_tables.[ch]:
Replace the old data structures for recording information about
each debuggable module with the module layout structure, and
register module layout structures directly, instead of trying
to discover them through the internal label table.
trace/mercury_trace.[ch]:
Now that it is more easily accessible, use variable numbers
instead of variable names to find the current locations of
the input arguments when implementing retry. Unlike our previous
method, this works even if the user names some variables HeadVar__1,
etc.
Remove an unnecessary export of an internal function.
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
runtime/mercury_layout_util.c:
Use the updated macros for looking up variable names.
Estimated hours taken: 14
Add a module layout structure containing a string table and a table of
pointers to the proc layouts of the module's procedures. This speeds up
debugger initialization, and reduces the executable size of the compiler
by almost 1.2 Mb (about 3.7%) when compiled with debugging.
Instead of representing variables names as strings (32 or 64 bit pointers)
in the debugger's static data structures, with the string's prefix representing
the variable's number (e.g. "5:X"), represent them as a 16-bit variable number
and a 16 bit offset into the module-wide string table. This gains simplicity
of processing (no more search for the ":") and reduces the amount of storage
required, a bit on 32-bit platforms (we don't have to store "5:ModuleInfo"
and "10:ModuleInfo" strings separately, and there are no string prefixes to
store) and more on 64-bit platforms.
The 16-bit limits are generous. A procedure with more than 64K variables will
take forever to compile (that is why we impose a 4K limit on the number
of variables in inlining), and even the string tables of typecheck.m and
make_hlds require less than four kilobytes each. Exceeding the limits
would require code no human would write. Automatically generated code may
be a problem, but the help the debugger can give on such code is limited
already. In any case, we detect overflows and handle them sensibly.
This change does not enhance the debugger to take advantage of the easier
availability of variable numbers, except to improve the implementation
of retry; that will come later.
The inclusion of the procedure table in the module layout structure
reduces the cost of registering all procedures in all modules,
a task usually performed at the time of the setting of the first breakpoint.
This used to require processing all the internal labels in the label table,
and thus used to take a few seconds for large executables. The sweep of
all internal labels is no longer required, so registering is now much faster.
runtime/mercury_stack_layout.h:
Add the definition of MR_Module_Layout.
Modify label layouts to represent names as offsets in the string table,
not as raw character pointers. This required modifing proc layouts
to include a pointer to the module's layout, so you can find the
string table.
Update the macros that look up variable names.
runtime/mercury_layout_util.h:
Use the updated macros for looking up variable names.
runtime/mercury_wrapper.[ch]:
Add a new indirect pointer, MR_register_module_layout, which points
to a function that registers a module layout, or is NULL if debugging
is not enabled.
runtime/mercury_init.h:
Declare the function whose address may be assigned to
MR_register_module_layout in a <main>_init.c file.
util/mkinit.c:
Initialize MR_register_module_layout with either the address of
MR_register_module_layout_real or NULL, depending on whether
debugging is enabled or not.
compiler/continuation_info.m:
Don't give names (V_n) to nameless variables, because we don't want
them to be included in the variables debugging knows about.
compiler/llds.m:
Add a new function symbol to the type data_addr, which stands for
the module layout structure of the named (now always the current)
module.
Add a new function symbol to the type rval_const. The new function
symbols, multi_string_const, contains an array of characters of an
explicitly given length, which consists of several strings, each
terminated by a null character.
compiler/llds_out.m:
Accommodate the changes to llds.m, and expand the module initialization
code to register the module layout structure, if the pointer to the
registration function is not NULL.
compiler/stack_layout.m:
Generate the new data structures for representing variable names,
as well as the module layout.
compiler/mercury_compile.m:
Rename some variables to reflect the fact that stack_layout.m can
now include a module layout structure in the list of static layout
structures it returns.
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/jumpopt.m:
compiler/opt_debug.m:
Minor changes to accommodate multi_string_consts.
trace/mercury_trace_tables.[ch]:
Replace the old data structures for recording information about
each debuggable module with the module layout structure, and
register module layout structures directly, instead of trying
to discover them through the internal label table.
trace/mercury_trace.[ch]:
Now that it is more easily accessible, use variable numbers
instead of variable names to find the current locations of
the input arguments when implementing retry. Unlike our previous
method, this works even if the user names some variables HeadVar__1,
etc.
Remove an unnecessary export of an internal function.
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
runtime/mercury_layout_util.c:
Use the updated macros for looking up variable names.
Estimated hours taken: 12
Get the debugger to sort variables better.
trace/mercury_trace_vars.[ch]:
A new module to manage the debugger's information about the variables
live at the current program point (which can be defined as the
combination of a specific event and an ancestor level).
This new module centralizes the management of the (sorted) list of
current variables. This in turn allows us to use a better sorting
method, one that orders VarName15 correctly wrt both VarName2 and
VarName.
The new module also uses the type, not the name, of a variable
to decide whether to exclude it from the list of variables
that may be presented to the user (e.g. if it is a typeinfo
or a typeclassinfo).
trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
Use the new module's facilities. This factors out some "mostly"
common code.
trace/Mmakefile:
Add the new module.
runtime/mercury_layout_util.[ch]:
Remove the code recently moved here from trace/mercury_trace_internal,
as well as the filtered versions of some functions, since they are
not needed anymore.
Move the code for MR_make_var_list to trace/mercury_trace_external,
since that is the only place where it is used (or is at all likely
to be used). Since its new home is next to several very similar
functions, this should also reduce the probability that any required
maintenance will be overlooked. Also alter its coding style to conform
to its new neighbours.
Move the definition of MR_Var_Spec to trace/mercury_trace_vars.h.
tests/debugger/*.exp:
Update the expected output files. In most cases, this is just because
the new module outputs different white space, but in some cases, it
also reflects that the debugger now prints variables in a different
order.
Estimated hours taken: 12
Get the debugger to sort variables better.
trace/mercury_trace_vars.[ch]:
A new module to manage the debugger's information about the variables
live at the current program point (which can be defined as the
combination of a specific event and an ancestor level).
This new module centralizes the management of the (sorted) list of
current variables. This in turn allows us to use a better sorting
method, one that orders VarName15 correctly wrt both VarName2 and
VarName.
The new module also uses the type, not the name, of a variable
to decide whether to exclude it from the list of variables
that may be presented to the user (e.g. if it is a typeinfo
or a typeclassinfo).
trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
Use the new module's facilities. This factors out some "mostly"
common code.
trace/Mmakefile:
Add the new module.
runtime/mercury_layout_util.[ch]:
Remove the code recently moved here from trace/mercury_trace_internal,
as well as the filtered versions of some functions, since they are
not needed anymore.
Move the code for MR_make_var_list to trace/mercury_trace_external,
since that is the only place where it is used (or is at all likely
to be used). Since its new home is next to several very similar
functions, this should also reduce the probability that any required
maintenance will be overlooked. Also alter its coding style to conform
to its new neighbours.
Move the definition of MR_Var_Spec to trace/mercury_trace_vars.h.
tests/debugger/*.exp:
Update the expected output files. In most cases, this is just because
the new module outputs different white space, but in some cases, it
also reflects that the debugger now prints variables in a different
order.
Estimated hours taken: 20
Incorporate the term brower stuff in the external debugger.
browser/browse.m:
Define browse__browse_external() which is the same as browse__browse()
but for the case where the term browser is called from the external
debugger.
Add an argument in predicates that need it to indicate whether the term
browser was called from the external or the internal debugger.
Define write_string_debugger/4, nl_debugger/3, write_int_debugger/4,
print_format_debugger/4 predicates and call them in place of
io__write_string/4, io__nl/3, io__write_int/4, and io__print/4
respectively. If the term browser is called from the internal debugger,
those predicates call the predicates they replace; otherwise, they
send their argument to the socket via a term of type
term_browser_response.
browser/debugger_interface.m
Define a new debugger request `browse/1'.
Define get_variable_name/2 that allows to retrieve from
mercury_trace_external.c the name of the variable to browse.
browser/parse.m:
Define parse__read_command_external/3 that parses the browser command
sent through the socket.
runtime/mercury_layout_util.c:
trace/mercury_trace_internal.c:
Move the definition of MR_trace_find_var() and
MR_trace_validate_var_count() from mercury_trace_internal.c to
mercury_layout_util.c to make it available to the external debugger.
runtime/mercury_layout_util.h:
trace/mercury_trace_internal.c:
Move the definition of MR_Var_Spec_Kind and MR_Var_Spec from
mercury_trace_internal.c to mercury_layout_util.h to make it
available to mercury_layout_util.c.
trace/mercury_trace_browse.ch:
Define the function MR_trace_browse_external() which is the same
as MR_trace_browse() except it uses the external debugger socket
instead of mdb_in and mdb_out.
trace/mercury_trace_external.c:
Define MR_trace_browse_one_external(), MR_trace_browse_var_external()
which are the same as MR_trace_browse_one() and MR_trace_browse_var()
of mercury_trace_internal.c, but for the use of the external debugger.
Define MR_get_variable_name() that calls get_variable_name/2 defined
in debugger_interface.m.
Estimated hours taken: 5
Use the same method of input for the browser as for the internal
tracer. Previously, the browser did input via the Mercury library
and the internal tracer did input via readline (if available). This
did not work properly if files were redirected into stdin, which meant
that test cases could not be written for the browser. This change
also adds a test case.
browser/util.m:
Add a predicate, util__trace_getline/4, which does input via
the same method used by the internal debugger.
browser/parse.m:
Call util__trace_getline/4 instead of io__read_line/3.
browser/browse.m:
Pass the prompt to browser/parse.m as a string, rather than
printing it before calling.
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
Declare MR_trace_getline extern.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
Make MR_trace_getline available to the browser via a function
pointer.
tests/debugger/Mmakefile:
Add the new test case.
tests/debugger/browser_test.m:
tests/debugger/browser_test.inp:
tests/debugger/browser_test.exp:
The new test case.
runtime/mercury_trace_base.c:
runtime/mercury_trace_base.h:
Export MR_tracing_not_enabled() for use by browser/util.m.
Estimated hours taken: 2
trace/mercury_trace_internal.c:
Echo commands immediately after calling MR_trace_readline, if
readline is not being used. This is to ensure that echoing
behaviour is the same regardless of whether readline is being
used or not.
Estimated hours taken: 1
trace/mercury_trace_declarative.c:
Bring the declarative debugging back end up to date with the
recent changes to stack layouts. Specifically, use the new
access macros instead of inspecting the data directly.
Estimated hours taken: 16
Allow the compiler to handle create rvals whose arguments have a size
which is different from the size of a word. Use this capability to reduce
the size of RTTI information, in two ways.
The first way is by rearranging the way in which we represent information
about the live values at a label. Instead of an array with an entry for
each live value, the entry being a pair of Words containing a shape
representation and a location description respectively, use an array
of shape representations (still Words), followed by an array of 32-bit ints
(which may be smaller than Word) describing locations whose descriptions
don't fit into 8 bits, followed by an array of 8-bit ints describing
locations whose descriptions do fit into 8 bits.
The second way is by reducing the sizes of some fields in the C structs
used for RTTI. Several of these had to be bigger than necessary in the
past because their fields were represented by the args of a create rval.
On cyclone, this reduces the size of the object file for queens.m by 2.8%.
IMPORTANT
Until this change is reflected in the installed compiler, you will not be
able to use any modules compiled with debugging in your workspaces if the
workspace has been updated to include this change. This is because the RTTI
data structures generated by the old installed compiler will not be compatible
with the new structure definitions.
The workaround is simple: if your workspace contains modules compiled with
debugging, don't do a cvs update until this change has been installed.
configure.in:
Check whether <stdint.h> is present. If not, autoconfigure
types that are at least 16 and 32 bits in size.
runtime/mercury_conf.h.in:
Mention the macros used by the configure script, MR_INT_LEAST32_TYPE
and MR_INT_LEAST16_TYPE.
runtime/mercury_conf_param.h:
Document the macros used by the configure script, MR_INT_LEAST32_TYPE
and MR_INT_LEAST16_TYPE.
runtime/mercury_types.h:
If <stdint.h> is available, get the basic integer types (intptr_t,
int_least8_t, etc) from there. Otherwise, get them from the
autoconfigure script. Define types such as Word in terms of these
(eventually) standard types.
runtime/mercury_stack_layout.h:
Add macros for manipulating short location descriptions, update the
types and macros for manipulating long location descriptions.
Modify the way the variable count is represented (since it now must
count locations with long and short descriptions separately),
and move it to the structure containing the arrays it describes.
Reduce the size of the some fields in structs. This required some
reordering of fields to avoid the insertion of padding by the compiler,
and changes to the definitions of some types (e.g. MR_determinism).
runtime/mercury_layout_util.[ch]:
runtime/mercury_stack_trace.c:
runtime/mercury_accurate_gc.c:
trace/mercury_trace.c:
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
Update the code to conform to the changes to stack_layout.h.
compiler/llds.m:
Modify the create rval in two ways. First, add an extra argument to
represent the types of the arguments, which used to always be implicit
always a word in size, but may now be explicit and possibly smaller
(e.g. uint_least8). Second, since the code generator would do the wrong
thing with creates with smaller than wordsize arguments, replace
the old must-be-unique vs may-be-nonunique bool with a three-valued
marker, must_be_dynamic vs must_be_static vs can_be_either.
Add uint_least8, uint_least16, uint_least32 (and their signed variants)
and string as llds_types.
Add a couple of utility predicates for checking whether an llds_type
denotes a type whose size is the same as word.
compiler/llds_out.m:
Use explicitly given argument types when declaring and initializing
the arguments of a cell, if they are given.
compiler/llds_common.m:
Don't conflate creates with identical argument values but different
C-level argument types. The probability of a match is minuscule anyway.
compiler/stack_layout.m:
Use the new representation of creates to generate the new versions of
RTTI data structures.
compiler/code_exprn.m:
If a create is marked must_be_static, don't inspect the arguments
to decide whether it can be static or not. If it can't, we'll get
an abort later on in llds_out or during C compilation anyway.
compiler/base_type_layout.m:
When creating pseudo typeinfos, return the llds_type of the resulting
rval.
Minor changes required by the change in create.
compiler/base_type_info.m:
compiler/base_typeclass_info.m.m:
compiler/code_util.m:
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/lookup_switch.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/string_switch.m:
compiler/unify_gen.m:
compiler/vn_cost.m:
compiler/vn_filter.m:
compiler/vn_flush.m:
compiler/vn_order.m:
compiler/vn_type.m:
compiler/vn_util.m:
compiler/vn_verify.m:
Minor changes required by the change in create.
library/benchmarking.m:
library/std_util.m:
Use the new macros in hand-constructing proc layout structures.
library/Mmakefile:
Add explicit dependencies for benchmarking.o and std_util.o
on ../runtime/mercury_stack_layout.h. Although this is only a subset
of the truth (in reality, all library objects depend on most of the
runtime headers), it is a good tradeoff between safety and efficiency.
The other runtime header files tend not to change in incompatible ways.
trace/Mmakefile:
Add explicit dependencies for all the object files on
../runtime/mercury_stack_layout.h, for similar reasons.
Estimated hours taken: 12
Clean up the declarative debugger.
browser/declarative_debugger.m:
browser/declarative_oracle.m:
- Add a new type, oracle_data, to store the oracle database.
- Thread an oracle database through a single call to the
front end.
- Replace `unknown' with a less overloaded name in
some type definitions.
trace/mercury_trace_declarative.c:
trace/mercury_trace_declarative.h:
browser/declarative_debugger.m:
- Improve documentation.
browser/declarative_debugger.m:
- Export new type, edt_truth.
- Improve the interface to the oracle.
- Add a new typeclass, evaluation_tree, and update the
previous interface to reflect this.
- Make declarative_bug a polymorphic type, and change the
constructor for buggy nodes from `wrong' to `e_bug'.
Estimated hours taken: 11
This change allows interactive queries to be typed from the external debugger.
browser/debugger_interface.m:
Define new debugger requests: query/1, cc_query/1, io_query/1 and
mmc_options/1.
Define 2 new procedures that are used in trace/mercury_trace_external.c:
get_list_modules_to_import/3 retrieves from a *query/1 request a list
of modules to be imported; and get_mmc_options/2 retrieves from a
mmc_options/1 request the option to pass to mmc to compile the query.
browser/interactive_query.m:
Define a new procedure query_external/7 that does the same job as
query/7 but for the external debugger.
Unset the environment variable `MERCURY_OPTIONS' before compiling a
query; `MERCURY_OPTIONS' is exported before executing a program under
the control of Opium-M (and mdb) and is not supposed to be set before
compiling a program.
trace/mercury_trace_browse.ch:
Add a new function MR_trace_query_external() to interface the
ML_query_external() function defined by browser/interfactive_query.m.
trace/mercury_trace_external.c:
Add code to implement new commands `query', `cc_query', `io_query',
and `mmc_options', using the MR_trace_query_external() function defined
by trace/mercury_trace_browse.h.
trace/mercury_trace_external.h:
Export MR_debugger_socket_in and MR_debugger_socket_out since there
are needed in interactive_query.m.
doc/user_guide.texi:
Add a comment to tell that there exists duplicated documentation betwenn
Opium-M/source/interactive_queries.op and doc/user_guide.texi and to
tell me to update it if someone update the documentation here.
Estimated hours taken: 130
Rewrite significant parts of minimal model tabling so that it works
in a much wider variety of situations, including coups. Also, clean up
the tabling implementation to make it more maintainable, and introduce
a new grade component, .mm, that enables minimal model tabling.
(Minimal model tabling requires distributed fat, and we don't want to
incur such costs unless necessary.)
compiler/options.m:
Add a new option --use-minimal-model, which for now is documented
as "not for general use". This option is a grade option, and is
required if minimal model tabling is to work.
compiler/handle_options.m:
When --use-minimal-model is given, do not allow nondet frame hijacks,
since minimal model tabling cannot cope with hijacks.
Make --use-minimal-model a grade component.
compiler/code_info.m:
When --use-minimal-model is given, insert calls to MR_commit_{mark,cut}
around goals being committed across. This is now necessary, so that we
can detect and handle sitations where a goal being committed across
starts but does not complete a tabled goal.
compiler/table_gen.m:
Rename many of the tabling helper predicates, using a naming scheme
that separates predicates used for model_non procedures from those
used to implement simpler forms of tabling, while bringing out
the parallels between these two sets of predicates.
When calls to two tabling helper predicates always occur
one after the other, merge the two into one.
Generate and use more meaningful variable names; having all of the
several variables inserted by this transformation named TableVar
was quite confusing.
library/private_builtin.m:
Reorganize this file, to separate out the different sections.
The contents of the non-tabling sections were not modified, only
moved around.
Rename the predicates referred to by table_gen.m.
Move most of the type declarations and complex code out of here,
into runtime/mercury_tabling.c. This makes it easier to debug them,
since (a) creating a new executable is quicker, since you don't have
to wait for lots of mercury compiler invocations, and (b) gdb doesn't
get confused by #line directives. It also makes it easier to write
them, since you don't have to !&(*U&( remember to double all your
double quotes and to backslash all your backslashes.
runtime/mercury_grade.h:
Include a grade component reflecting whether MR_USE_MINIMAL_MODEL
is defined.
runtime/mercury_conf_param.h:
Document MR_USE_MINIMAL_MODEL.
runtime/mercury_stacks.[ch]:
The changes to tabling require the addition of two new stacks,
the generator stack and the cut stack. This module defines the
structures of the frames of these stacks and provides the
operations on these stacks.
The header file also contains some additional macros that return
the addresses of fixed nondet stack slots, not their contents,
for use by tabling code.
runtime/mercury_context.[ch]:
runtime/mercury_memory.[ch]:
runtime/mercury_wrapper.[ch]:
Declare and set up the two new stacks, both in saved contexts and in
the active context, if MR_USE_MINIMAL_MODEL is defined.
runtime/mercury_regorder.h:
Add four new global virtual machine registers to hold pointers
to the memory areas of the two new stacks and the current offsets
within them. These are defined whether MR_USE_MINIMAL_MODEL is defined
or not, since the cost is minimal and the potential bugs we avoid
would be hard to track down.
runtime/mercury_engine.h:
runtime/mercury_wrapper.c:
Add support for a new debugging flag, -dS, which prints the contents
of the nondet stack at several points during tabling.
runtime/mercury_tabling.[ch]:
The implementation of the new tabling system. Much of the new code here
is stuff moved from library/private_builtin.m, but in a significantly
rewritten form. There is also substantial new code, e.g. to handle
the extension of saved stack segments, and to manage dependencies
between subgoals in general.
Improve the documentation considerably.
Replace lists stored as Mercury data structures with lists stored
as linked structures in the usual C fashion. This allows us to use
debuggers such as ddd on these data structures, whose complexity
requires this.
Ensure that global names start with MR_.
runtime/mercury_init.h:
Explicitly include mercury_regs.h at the start. Without this,
we get an error, because now mercury_wrappers.h, which mercury_init.h
includes, also includes mercury_regs.h, but not before functions
have been declared.
runtime/Mmakefile:
Refer to the new file mercury_stacks.c (mercury_stacks.h already
existed, but the module consisted entirely of macros.)
Fix a sorting error.
scripts/{init,parse,final}_grade_options.sh-subr:
scripts/mgnuc.in:
Handle the new grade component.
tests/tabling/*
Add several new test cases that we now pass, most of which we couldn't
pass before. Also add some new test cases that we don't pass yet,
due to interactions between tabling and negated contexts.
trace/mercury_trace_internal.c:
If MR_USE_MINIMAL_MODEL is defined, add a new command to print
the generator stack. (The new command is deliberately not documented
in doc/mdb_doc yet, since (a) it is intended for developers only,
and (b) there is no way to test MR_USE_MINIMAL_MODEL in mdb_doc.)
Estimated hours taken: 2
Add the option `--enable-decl-debug' to configure, which enables
declarative debugging support in the internal debugger.
configure.in:
Add the option to configure.
browser/declarative_debugger.m:
runtime/mercury_wrapper.c:
Avoid using MR_address_of_edt_root_node unless configured
for declarative debugging.
runtime/mercury_conf.h.in:
runtime/mercury_conf_param.h:
Move the configuration macro to mercury_conf.h.in.
trace/mercury_trace_declarative.c:
Define MR_edt_root_node only if configured for declarative
debugging, thereby undoing a previous change.
Estimated hours taken: 3
Fix a bug causing the debugger tests to get link errors.
browser/declarative_debugger.m:
Call MR_edt_root_node indirectly via MR_address_of_edt_root_node.
runtime/mercury_wrapper.{c,h}:
Add a global function pointer, MR_address_of_edt_root_node.
util/mkinit.c:
Make sure MR_address_of_edt_root_node is initialized.
trace/mercury_trace_declarative.c:
Define MR_edt_root_node even if the declarative debugger is not
used.
Estimated hours taken: 80
Add a front end to the declarative debugger, written in Mercury. Modify
the back end to call this whenever an EDT is built. Also, various
bug fixes and improvements.
browser/declarative_debugger.m:
New module. This is a first implementation of the front end of
the declarative debugger. It uses a simple top-down algorithm
to search the EDT for a buggy node. The results are printed
in a simple format to the output stream. It is called from the
back end, in trace/mercury_trace_declarative.c.
browser/declarative_oracle.m:
New module. This is a first implementation of an oracle for the
declarative debugger. It simply passes all queries directly
on to the user.
browser/browser_library.m:
Import the new modules.
trace/mercury_trace_declarative.c:
- Various fixes/improvements of comments.
- Fix bugs where `int' is used instead of `Unsigned'.
- Pass the event_info structure to MR_trace_decl_update_path,
rather than passing various components of it.
- Use the copy of MR_trace_event_number in the event_info structure
rather than referring to the global variable directly.
- Remove the EDT printing functions, as they have been superseded by
the new front end. Call the new front end instead of these old
functions.
- Provide an interface to the EDT nodes that is imported by the
front end.
- Ensure that, after diagnosis, we end up at the same event we
started at.
- Fix a bug where it was assumed all procedures had at least one
argument.
- Ensure that the user is notified if the dd_wrong operation cannot
be started due to MR_trace_retry failing.
trace/mercury_trace_declarative.h:
- Move a #include to the correct place.
- Declare the interface to the EDT nodes.
trace/mercury_trace_internal.c:
Fix a bug introduced earlier.
runtime/mercury_conf_param.h:
Add a new configuration macro, MR_DEBUG_DD_BACK_END. When defined
this causes information about the declarative debugger back end
to be printed out during operation.
Estimated hours taken: 2
trace/mercury_trace_internal.c:
GNU readline always echos the inputs, so if readline support is
enabled, then ignore the MR_echo_commands variable,
and report an error if the user tries to use `echo off'.
Also, if we're not using readline, then echo the `echo on' command,
so that the output will be the same as with readline.
tests/debugger/*.inp:
Ensure that `echo on' is always the first command.
tests/debugger/*.exp:
tests/debugger/*.exp2:
Update to reflect the changes to *.inp,
and to include the echo of the `echo on' command.
(Also delete the mdb intro banners from *_lib.exp*,
because mdb is invoked with MERCURY_SUPPRESS_MDB_BANNER=yes.
The *_lib* files are in fact currently not used, so they should
probably be just deleted, I think. But I'll do that as
a separate change.)
Estimated hours taken: 2
Simplify the Mmakefiles. Fix a few minor latent bugs.
*/Mmakefile:
- Factor out some common code by defining a new variable M_ENV
which holds settings of environment variables for mmc, mgnuc, etc.
- For consistency, always override MERCURY_C_ALL_INCL_DIRS rather
than passing extra `-I' options to mgnuc.
- Make sure to always include `$(BOEHM_GC)/include' in the search path,
so that it will work if we try to compile with `-O6'.
- Make sure to always include `--cflags $(ALL_CFLAGS)' in MCS, so
that the EXTRA_CFLAGS etc. will get passed down to gcc via mmc.
- Make sure that the Mmakefiles in all directories set
all the MC* variables: MCPI, MCSI, MCOI, MCTOI, etc.
Estimated hours taken: 16
Add GNU readline support to the debugger.
Because GNU readline is licensed under the GPL, not the LGPL,
I was careful to ensure that (1) the readline library is
only linked into your application if it is compiled with
debugging enabled and (2) even in the latter case, the readline
support is disable-able (if you use the source distribution).
Mmakefile:
bindist/Mmakefile:
Add dependency of configure on new file aclocal.m4.
aclocal.m4:
Define a macro MERCURY_CHECK_READLINE to check for the readline
headers, the readline library, and for libraries needed by readline,
in particular -l{termcap,curses,ncurses}.
If they're not found, define MR_NO_USE_READLINE.
Otherwise, define various variables for using & installing readline.
bindist/bindist.configure.in:
configure.in:
Add call to MERCURY_CHECK_READLINE to check for readline.
scripts/ml.in:
If tracing is enabled, then (by default) link in readline,
and hence also termcap/curses/ncurses.
Add a new option `--no-readline' to disable this.
trace/mercury_trace_internal.c:
Delete the FILE * parameter from the MR_getline() function,
because there are actually two files involved (MR_mdb_in and
MR_mdb_out), and they are always the same for all calls to this
function.
Also change this function so that it calls MR_trace_readline() rather
than printing the prompt and then calling MR_trace_getline_raw().
Delete the MR_trace_getline_raw() function -- this has been renamed
as MR_trace_readline_raw() and moved to mercury_trace_readline.c.
trace/mercury_trace_readline.h:
trace/mercury_trace_readline.c:
New module containing a new function MR_trace_readline() that prints
a prompt and reads a line in by calling the readline library.
I put all this new code inside `#ifndef MR_NO_USE_READLINE' so that
the use of readline can be disabled. If that symbol is defined,
it reverts to the old implementation using MR_trace_readline_raw()
(formerly called MR_trace_getline_raw()).
runtime/mercury_conf.h.in:
Define the new configuration parameter `MR_NO_USE_READLINE'.
trace/Mmakefile:
Add the new files mercury_trace_readline.[ch].
Ensure that this new module is compiled with warnings disabled,
to avoid spurious warnings resulting from the readline header files.
Also simplify the code by deleting unnecessary uses of $(EXTRA_*) --
that's handled by scripts/Mmake.vars now.
NEWS:
Mention the readline support.
.INSTALL.in:
Mention that it is helpful to have GNU Readline installed.
bindist/bindist.INSTALL:
Mention that you may need to have GNU Readline installed.
Estimated hours taken: 16
Add GNU readline support to the debugger.
Because GNU readline is licensed under the GPL, not the LGPL,
I was careful to ensure that (1) the readline library is
only linked into your application if it is compiled with
debugging enabled and (2) even in the latter case, the readline
support is disable-able (if you use the source distribution).
Mmakefile:
bindist/Mmakefile:
Add dependency of configure on new file aclocal.m4.
aclocal.m4:
Define a macro MERCURY_CHECK_READLINE to check for the readline
headers, the readline library, and for libraries needed by readline,
in particular -l{termcap,curses,ncurses}.
If they're not found, define MR_NO_USE_READLINE.
Otherwise, define various variables for using & installing readline.
bindist/bindist.configure.in:
configure.in:
Add call to MERCURY_CHECK_READLINE to check for readline.
scripts/ml.in:
If tracing is enabled, then (by default) link in readline,
and hence also termcap/curses/ncurses.
Add a new option `--no-readline' to disable this.
trace/mercury_trace_internal.c:
Delete the FILE * parameter from the MR_getline() function,
because there are actually two files involved (MR_mdb_in and
MR_mdb_out), and they are always the same for all calls to this
function.
Also change this function so that it calls MR_trace_readline() rather
than printing the prompt and then calling MR_trace_getline_raw().
Delete the MR_trace_getline_raw() function -- this has been renamed
as MR_trace_readline_raw() and moved to mercury_trace_readline.c.
trace/mercury_trace_readline.h:
trace/mercury_trace_readline.c:
New module containing a new function MR_trace_readline() that prints
a prompt and reads a line in by calling the readline library.
I put all this new code inside `#ifndef MR_NO_USE_READLINE' so that
the use of readline can be disabled. If that symbol is defined,
it reverts to the old implementation using MR_trace_readline_raw()
(formerly called MR_trace_getline_raw()).
runtime/mercury_conf.h.in:
Define the new configuration parameter `MR_NO_USE_READLINE'.
trace/Mmakefile:
Add the new files mercury_trace_readline.[ch].
Ensure that this new module is compiled with warnings disabled,
to avoid spurious warnings resulting from the readline header files.
Also simplify the code by deleting unnecessary uses of $(EXTRA_*) --
that's handled by scripts/Mmake.vars now.
NEWS:
Mention the readline support.
.INSTALL.in:
Mention that it is helpful to have GNU Readline installed.
bindist/bindist.INSTALL:
Mention that you may need to have GNU Readline installed.
Estimated hours taken: 3
Add some test cases to test interactive queries.
tests/debugger/queens.inp:
Add tests of interactive queries.
tests/debugger/Mmakefile:
Add dependency of queens.out on queens.ints.
This is needed in order for us to use interactive queries.
tests/debugger/queens.m:
Export qperm/2, for use in interactive queries.
browser/interactive_query.m:
Flush MDB_stdout after printing the prompt, so things work
properly with I/O redirections.
trace/mercury_trace_internal.c:
Fix an off-by-one error detected by the above test cases.
Estimated hours taken: 0.5
Fix a bug where doc/generate_mdb_doc was putting the documentation for
the interactive query commands in the category "interactive" whereas
doc/mdb_categories was expecting this category to be called "queries".
util/info_to_mdb.c:
Print error messages to stderr rather than stdout.
Document the first argument as being a category name
(the name of an mdb help category) rather than a section name.
doc/generate_mdb_doc:
Avoid the assumption that the category name is the same as the
section name; that is still the default, but it now sets the
category for the "interactive" section to "queries".
Invoke info_to_mdb with the category name rather than the
section name.
trace/mercury_trace_internal.c:
Update the category names in the pseudo-automatically-generated
command list to reflect the above change.
(Also improve an error message slightly.)
Estimated hours taken: 0.75
scripts/mdbrc.in:
Alias EMPTY and NUMBER to "step", to simplify the code in
mercury_trace_internal.c for handling those.
trace/mercury_trace_internal.c:
Split the very long and complicated function MR_trace_debug_cmd()
into two, one of which contains all the before-and-after processing,
and the other being the main command dispatch switch.
Delete the special-case handling of EMPTY and NUMBER since it's
now done by scripts/mdbrc.in.
Add some recently-added command names to the list of valid commands.
Estimated hours taken: 1
runtime/mercury_misc.[ch]:
Improve the facilities for printing pointers into the det and nondet
stacks for diagnostic purposes.
runtime/mercury_stack_trace.c:
Use the improved facilities in mercury_misc to improve the output.
trace/mercury_trace_internal.c:
Use the improved facilties in mercury_misc to improve the
formatting of the output of the stack_regs command.
Estimated hours taken: 9
Enable by default the use of the external debugger on architectures that
support sockets.
configure.in:
bindist/bindist.configure.in:
Define MR_USE_EXTERNAL_DEBUGGER for systems that support sockets.
Pass down a variable SOCKET_LIBRARY that contains the name of the
socket library (may varies from one system to another).
scripts/ml.in:
Add the name of the socket library to the libraries passed in
argument of ml.
runtime/mercury_conf.h.in:
Add "#undef MR_USE_EXTERNAL_DEBUGGER".
runtime/mercury_conf_param.h:
Remove a useless comment.
trace/mercury_trace_external.c:
Update a comment.
Estimated hours taken: 17
Add support for invoking interactive queries to mdb.
browser/interactive_query.m:
New module, to implement interactive queries.
browser/dl.m:
browser/name_mangle.m:
Copy these files from extras/dynamic_linking, since
they are needed by browser/interactive_query.m.
configure.in:
runtime/mercury_conf.h.in:
Autodetect the presence of support for dlopen() etc.
browser/dl.m:
Add #ifdefs so that the code will compile (but report
an error at runtime) if dlopen() etc. are not supported.
browser/browser_library.m:
Add interface_query, dl, and name_mangle to the list of
modules in this library.
trace/mercury_trace_browse.h:
trace/mercury_trace_browse.c:
Add a new function MR_trace_query() to interface to the ML_query()
function defined by browser/interfactive_query.m.
trace/mercury_trace_internal.c:
Add code to implement new commands `query', `cc_query', `io_query',
and `mmc_options', using the MR_trace_query() function defined by
trace/mercury_trace_browse.h.
runtime/mercury_grade.h:
Add code to define MR_GRADE_OPT, so that browser/interactive_query.m
can use this to invoke mmc with the same grade that the executable
being debugged was built with.
doc/mdb_categories:
doc/user_guide.texi:
Document the new commands `query', `cc_query', `io_query',
and `mmc_options'.
Estimated hours taken: 0.75
Re-fix a bug that was causing mdb's detailed stack traces to come out
incorrectly on some occaisions. Erwan's recent changes accidentally
removed my previous fix of this bug. Also fix another occurrence
of a very similar bug. And fix a compiler warning in Erwan's new code.
trace/mercury_trace_external.c:
runtime/mercury_stack_trace.c:
Re-fix a bug: `maybe_from_full' should have type `Integer', not `Word'.
runtime/mercury_stack_trace.c:
Fix a compiler warning: delete the unnecessary `extern' from
the definition of MR_detism_names.
runtime/mercury_trace_base.c:
Fix a bug: `maybe_from_full' should have type `Integer', not `bool'.
Estimated hours taken: 3
Moves the definition of MR_dump_stack_record_print() and MR_print_proc_id()
from trace/ to runtime/ to be able to call MR_dump_stack_record_print() from
MR_dump_stack(). Indeed we can not pass down *MR_dump_stack_record_print() as a
parameter of MR_dump_stack() since MR_dump_stack() is called from the library
and we have to repect the invariant "trace -> library -> runtime".
runtime/mercury_stack_trace.c:
Add the missing argument of MR_dump_stack_from_layout() in the body of
MR_dump_stack().
runtime/mercury_stack_trace.[ch]:
trace/mercury_trace_internal.c:
trace/mercury_trace_tables.[ch]:
Move the definition of MR_dump_stack_record_print() from
mercury_trace_internal.c to mercury_stack_trace.c and
MR_print_proc_id() from mercury_trace_tables.c to mercury_stack_trace.c
runtime/mercury_stack_trace.[ch]:
trace/mercury_trace.[ch]:
Move the definition of MR_detism_names[] from mercury_trace.c to
mercury_stack_trace.c.
Estimated hours taken: 3
Moves the definition of MR_dump_stack_record_print() and MR_print_proc_id()
from trace/ to runtime/ to be able to call MR_dump_stack_record_print() from
MR_dump_stack(). Indeed we can not pass down *MR_dump_stack_record_print() as a
parameter of MR_dump_stack() since MR_dump_stack() is called from the library
and we have to repect the invariant "trace -> library -> runtime".
runtime/mercury_stack_trace.c:
Add the missing argument of MR_dump_stack_from_layout() in the body of
MR_dump_stack().
runtime/mercury_stack_trace.[ch]:
trace/mercury_trace_internal.c:
trace/mercury_trace_tables.[ch]:
Move the definition of MR_dump_stack_record_print() from
mercury_trace_internal.c to mercury_stack_trace.c and
MR_print_proc_id() from mercury_trace_tables.c to mercury_stack_trace.c
runtime/mercury_stack_trace.[ch]:
trace/mercury_trace.[ch]:
Move the definition of MR_detism_names[] from mercury_trace.c to
mercury_stack_trace.c.
Estimated hours taken: 5
Generalized the code in the external debugger in order to be able to handle
inter-module inlining and compiler-generated procedures. To handle the former,
I have added the definition module as a slot to the event structure. To handle
the later, I have split output_current_slots() (and found_match()) into two
different functions; one for user defined events, the other one for compiler
generated events.
trace/mercury_trace_external.c:
browser/debugger_interface.m
Split output_current_slots() into output_current_slots_user() and
output_current_slots_comp()
Idem for found_match(), found_match_user() and found_match_comp().
Add a slot in the event for the definition module name in the case of
user-defined event.
Estimated hours taken: 6
Pass around event information for the tracing system in an
MR_Event_Info struct instead of passing each item as a separate
argument. Use Unsigned consistently for the type of the call
depth and call sequence number.
trace/mercury_trace.h:
Add the new MR_Event_Info structure.
trace/mercury_trace.{c,h}:
trace/mercury_trace_declarative.{c,h}:
trace/mercury_trace_external.{c,h}:
trace/mercury_trace_internal.{c,h}:
Use the new structure.
runtime/mercury_trace_base.c:
Use Unsigned as the type of the call depth and sequence number.
Estimated hours taken: 1
Add a pred_or_func attribute to the Mercury event for the external debugger
that indicates if the current procedure is a function or a predicate.
browser/debugger_interface.m:
trace/mercury_trace_external.c:
Add a slot in MR_found_match() and MR_output_current_slots() for the
pred_or_func attribute.
runtime/mercury_stack_layout.h.
Add a comment to say that The MR_PredFunc enummeration should EXACTLY
match the definition of the `pred_or_func' type in
browser/debugger_interface.
Estimated hours taken: 3
Fix a bug in the external debugger. The execution was crashing during the
printing of polymorphic arguments. In runtime/mercury_layout_util.c,
MR_get_type_filtered() and MR_get_type_and_value_filtered() were calling
MR_get_type() and MR_get_type_and_value() without type_info information (third
argument set to NULL), which is needed to retrieve polymorphic types.
runtime/mercury_layout_util.[ch]:
Pass down type_info in argument of MR_get_type_and_value_filtered() and
MR_get_type_filtered() to be able to call MR_get_type_and_value() and
MR_get_type() with type_info information.
runtime/mercury_layout_util.c
Filter out variables which names begin by "TypeClassInfo" in
MR_get_type_and_value_filtered() (as it was already done in
MR_get_type_filtered()).
runtime/mercury_layout_util.c
trace/mercury_trace_external.c:
In a few functions, do not try to retrieve information about live
variables if it does not exist any.
trace/mercury_trace_external.c:
Pass type_info in argument of MR_get_type_and_value_filtered()
and MR_get_type_filtered().
Filter out in MR_trace_make_var_names_list() the variable names
that are also filtered in MR_get_type_and_value_filtered().
Estimated hours taken: 7
This change implement stack dump commands for the external debugger.
The MR_dump_stack_record_print() defined in runtime/mercury_stack_trace.c is
the function that prints the contents of the stack. We move the definition of
this function to mercury_trace_internal.c and we pass down that function as a
parameter of MR_dump_stack_from_layout(). The rational for this change is that
we can then define a new MR_dump_stack_record_print_to_socket() in
mercury_trace_external.c that prints the data to the socket as a Prolog term
and pass down the address of that new function to MR_dump_stack_from_layout().
browser/debugger_interface.m:
Add three new kinds of requests: stack, nondet_stack and stack_regs.
trace/mercury_trace_external.c:
Define new MR_dump_stack_record_print_to_socket() and
MR_print_proc_id_to_socket() that sends data to the socket as Prolog
terms.
Add support for stack, nondet stack and stack_regs requests.
runtime/mercury_stack_trace.[ch]
trace/mercury_trace.[ch]:
trace/mercury_trace_internal.[ch]:
Move the definition of MR_dump_stack_record_print(),
from mercury_stack_trace.c to mercury_trace_internal.c.
Add MR_dump_stack_record_print() as an argument of all the
functions that need it in mercury_stack_trace.c.
Move the definition of detism_names[] from mercury_stack_trace.c
to mercury_trace.c. This function is needed by both versions of
MR_dump_stack_record_print(). Rename detism_names[] by
MR_detism_names[].
runtime/mercury_stack_trace.[ch]
trace/mercury_trace_tables.[ch]:
Move the definition of MR_print_proc_id() and
MR_print_proc_id_for_debugger() from mercury_stack_trace.c to
mercury_trace_tables.c since MR_print_proc_id() is called in that
module.
Include mercury_trace.h since we now make use of detism_names[] there.
Estimated hours taken: 0.5
trace/mercury_trace.h:
trace/mercury_trace.c:
Add a missing const on the return type of MR_trace_retry().
trace/mercury_trace.c:
Delete an old `#include <unistd.h>', since it is no longer needed.
trace/mercury_trace_internal.c:
Fix two bug: check whether the return value from
MR_trace_retry() is null; if it is null, don't try to print it
out (this fixes a bug Erwan introduced), and if it is not null,
then after printing out the message, keep interacting with the
user rather than doing a step (this fixes a bug in Zoltan's
original code).