... in some previously overlooked test cases.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/debugger/completion.completion_helper_1.m:
tests/debugger/completion.completion_helper_2.completion_helper_3.m:
tests/debugger/completion.completion_helper_2.m:
tests/debugger/completion.exp:
tests/debugger/completion.inp:
tests/debugger/completion.m:
Rename completion.sub1.m to completion.completion_helper_1.m,
rename completion.sub2.m to completion.completion_helper_2.m, and
rename completion.sub2.sub3.m to
completion.completion_helper_2.completion_helper_3.m.
tests/debugger/poly_io_retry_1.exp:
tests/debugger/poly_io_retry_1.inp:
tests/debugger/poly_io_retry_1.m:
tests/debugger/poly_io_retry_2.exp:
tests/debugger/poly_io_retry_2.inp:
tests/debugger/poly_io_retry_2.m:
Rename poly_io_retry/poly_io_retry2 to poly_io_retry_[12].
tests/debugger/shallow.exp:
tests/debugger/shallow.m:
tests/debugger/shallow_helper_1.m:
Rename shallow2.m to shallow_helper_1.m.
tests/debugger/user_event_1.exp:
tests/debugger/user_event_1.inp:
tests/debugger/user_event_1.m:
Rename user_event to user_event_1, due to the existence of user_event_2.
tests/general/Mmakefile:
tests/general/det_complicated_unify_1.exp:
tests/general/det_complicated_unify_1.m:
tests/general/det_complicated_unify_2.exp:
tests/general/det_complicated_unify_2.m:
Rename det_complicated_unify/det_complicated_unify2 to
det_complicated_unify_[12]. Note: only det_complicated_unify_1
is currently enabled.
tests/general/double_error_1.exp:
tests/general/double_error_1.m:
tests/general/double_error_2.exp:
tests/general/double_error_2.m:
Rename double_error/double_error2 as double_error_[12].
tests/general/liveness_1.exp:
tests/general/liveness_1.m:
tests/general/liveness_2.exp:
tests/general/liveness_2.m:
Rename liveness/liveness2 as liveness_[12].
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/user_defined_equality_1.exp:
tests/hard_coded/user_defined_equality_1.m:
tests/hard_coded/user_defined_equality_2.exp:
tests/hard_coded/user_defined_equality_2.m:
Rename user_defined_equality/user_defined_equality2 as
user_defined_equality_[12].
tests/tabling/Mmakefile:
tests/tabling/expand_tuple_1.exp:
tests/tabling/expand_tuple_1.m:
tests/tabling/expand_tuple_2.exp:
tests/tabling/expand_tuple_2.m:
Rename expand_tuple/expand_tuple2 as expand_tuple_[12].
Mdb supports the location of a breakpoint to be specified either
as a procedure name, or as a source location in the form of a
filename/linenumber pair. It has long had readline auto-complete
on procedure names; this diff adds auto-complete on source locations as well.
NEWS:
Announce the new capability.
trace/mercury_trace_completion.{h,c}:
Add a completer for break commands that is separate from the existing
one that completes only procedure specifications. The new one completes
on both those AND on the filename:linenumber of all the events in all
the debuggable modules of the program.
Move all the forward declarations of static functions to the top
of mercury_trace_completion.c, and put them in the same order as
the corresponding definitions.
trace/mercury_trace_internal.c:
Use the new completer for the "break" command.
trace/mercury_trace_spy.c:
trace/mercury_trace_tables.c:
Fix some documentation.
tests/debugger/completion.{inp,exp}:
Update this test. Update the input, because in some cases, this diff
causes the shortest unambiguous extension of the current line so far
to become shorter, due to the addition of source locations to the set
of strings being given to readline. And update the output to show
the now-expanded set of matching strings at the points at which
completion is taking place.
Estimated hours taken: 16
Branches: main, release
Replace the "set" command of mdb with a bunch of commands: the `format',
`format_param', `list_context_lines', `list_path', `xml_browser_cmd',
`xml_tmp_filename', `fail_trace_counts', `pass_trace_counts' and
`max_io_actions' commands. Each of these set just one parameter
or one of set of closely related parameters.
Move all these commands, and some existing commands that set parameters
that were elsewhere, to the "parameter" command category.
Extend some of these commands so that if given no arguments, they report
the current values of the parameters they would otherwise set.
Replace the "set" commands of the mdb browser and of the declarative debugger
with a bunch of commands: "format", "depth", "size", "width", "lines",
"actions" and "params" (the last prints the current value of the parameters).
For each category of mdb commands, create files mercury_trace_cmd_<cat>.[ch],
and move the functions dealing with that category of commands there from
mercury_trace_internal.c. Give each of these new files a logical structure
that was sometimes missing from the relevant parts of mercury_trace_internal.c.
NEWS:
Mention these changes.
doc/mdb_categories:
Document these changes.
doc/user_guide.texi:
Document these changes.
Fix an old documentation bug: you couldn't set listing paramaters
from a declarative debugger command.
Fix an old documentation bug: the description of the goal_path step
for scopes was obsolete.
Fix some obsolete references to : as module qualifier.
browser/parse.m:
Update the browser command set along the lines at the top.
browser/declarative_user.m:
Update the declarative debugger command set along the lines at the top.
Move the declaration for the type representing declarative debugger
commands to near the top of the file.
browser/browser_info.m:
Provide some access predicates.
Update the predicate that generates mdb commands to save the persistent
state of the debugger to generate the new forms of parameter commands.
Move types and predicates for dealing with browser parameters from
browse.m to here, so that declarative_user.m can use them too.
browser/browse.m:
Delete the code moved to browser_info.m, and conform to the other
changes in the other modules.
browser/listing.m:
Provide a predicate to return the type of listing paths.
scripts/mdbrc.in:
Update the commands that set the XML parameters.
scripts/Mmakefile:
Get mmake to rebuild mdbrc from mdbrc.in when mdbrc.in changes.
trace/mercury_trace_internal.c:
trace/mercury_trace_cmds.h:
trace/mercury_trace_cmd_*.[ch]:
Implement the changes described at the top.
Fix an old bug: the commands that update the search path for the "list"
command don't make the search path term permanent, which is needed in
non-conservative-gc grades.
trace/mercury_trace_spy.c:
Fix some obsolete references to : as module qualifier.
trace/mercury_trace_browse.[ch]:
Delete the functionality now moved to mercury_trace_cmd_parameter.c.
tests/debugger/mdb_command_test.inp:
Update the set of commands being tested.
tests/debugger/save.{inp,exp}:
Update the parameter commands in this test case.
Estimated hours taken: 3
Branches: main
Provide a mechanism for gathering statistics about which predicates occur most
frequently in the I/O action table.
Instead of adding a new mdb command, consolidate three existing mdb commands
(proc_stats, label_stats and var_name_stats) into a single "stats" command,
and add a new variant for stats on I/O tabling.
doc/mdb_categories:
doc/user_guide.texi:
Document the changes in mdb commands.
runtime/mercury_trace_base.[ch]:
Add a new function for printing stats on the predicate in the I/O
action table.
Add headers to each section of this file.
runtime/mercury_hash_table.[ch]:
Remove the const qualifier from the return type of the lookup function,
since mercury_trace_base.c now needs to modify a looked-up record.
Move the documentation on the functions in this module to the header
file.
trace/mercury_trace_internal.c:
Merge the three previous mdb commands into one, and add the new
alternative.
trace/mercury_trace_tables.c:
Minor change in formatting.
trace/mercury_trace_tables.c:
Minor style fix.
tests/debugger/completion.{inp,exp}:
tests/debugger/mdb_command_test.inp:
Change these test cases to account for the disappearance of the
three old mdb commands and the appearance of the new one.
Estimated hours taken: 8
Branches: main
Add two new capabilities to the debugger.
The first capability is the idea of "held variables", variables that the
debugger holds onto even when execution has left the event they came from.
You can hold onto a variable via the mdb command "hold varname heldvarname".
You can suffix the name of the existing variable with a term path, in which
case the new held variable will refer only to the specified part of the term.
Later mdb commands can refer to the held variable by prefixing its name with
a dollar sign. For example, after "hold HeadVar__1^2 x", "$x" will refer to
the term that was the second argument of HeadVar__1 at the program point
at which the "hold" command was executed.
The second capability is the ability to compute the diff of two terms and
express those diffs as the term paths of the function symbols at which the two
terms differ, instead of the line numbers you get by using save_to_file and the
usual Unix diff command. The mdb command is "diff var1 var2". We limit the
number of term paths of difference sites that we display at any one time;
the mdb diff command has options to control this.
NEWS:
Mention the new capabilities.
doc/user_guide.texi:
Document the new mdb commands "hold" and "diff", the new mdb command
"held_vars" which simply lists the names of all the held variables
(just as "vars" lists the names of all the nonheld variables currently
accessible), and the concept of held variables.
doc/mdb_categories:
Update this file for the new mdb commands and concepts.
browser/browse_diff.m:
This new module implements the diff operation on terms.
browser/mdb.m:
Add the new module to the list of submodules of the mdb package.
browser/*.m:
Minor cleanups, such as importing only one module per line; there
are no algorithmic changes.
trace/mercury_trace_hold_vars.[ch]:
This new module implements the database of held variables.
trace/Mmakefile:
Mention the new module.
trace/mercury_trace_internal.c:
Implement the three new mdb commands.
trace/mercury_trace_vars.[ch]:
Modify the functions that recognize variable specifications or
process them to work with held variables as well as variables from
the current environment. This required some reorganization of the
internals of this module.
Provide some a utility function, MR_trace_parse_lookup_var_path,
for converting a string representing the specification of a term
(a variable and possibly some path within it) to the type and value
of that term. Make the utility function this is based upon,
MR_lookup_unambiguous_var_spec, replace the previous but less capable
MR_convert_var_spec_to_type_value.
trace/mercury_trace_spy.c:
Conform to the change in mercury_trace_vars.c.
trace/mercury_trace_util.c:
Make a utility function more robust.
trace/mercury_trace_alias.c:
Minor cleanups.
tests/debugger/queens.{inp,exp*}:
Update this test case to test the debugger's new capabilities.
tests/debugger/completion.{inp,exp*}:
Update this test case to expect the new mdb commands, and avoid the
ambiguity between "help" and "held_vars".
Estimated hours taken: 10
Branches: main
Added `trusted' and `untrust' commands. Also allowed individual predicates to
be trusted.
browser/declarative_debugger.m
Exported predicates to add a trusted predicate or function, remove
a trusted object and return a list of the trusted objects.
browser/declarative_oracle.m
Changed trusted set so it can also contains individual predicates and
functions. Added predicates to add a trusted predicate or function
to the set, remove a trusted object from the set and return a list
of the trusted objects.
doc/mdb_categories
Added dd category.
doc/user_guide.texi
Documented `untrust' and `trusted' commands.
runtime/mercury_stack_trace.c
runtime/mercury_stack_trace.h
Added a print_mode argument to MR_print_proc_id_internal, so that
printing of mode information can be turned on or off. When a list
of matching predicates for the trust command is shown then mode
information is superfluous, since a predicate/function is trusted, not
a procedure.
Added MR_print_pred_id to print predicate id - i.e. proc id without
the mode info.
tests/debugger/completion.exp
New commands shown in completion list.
tests/debugger/completion.inp
Added a space, since a --More-- prompt is now displayed when showing
all the commands.
tests/debugger/mdb_command_test.inp
untrust and trusted added.
tests/debugger/declarative/trust.exp
tests/debugger/declarative/trust.inp
Testing of new commands.
trace/mercury_trace_declarative.c
trace/mercury_trace_declarative.h
Added functions to add a trusted predicate and remove a trusted
object. Also added a function to print a list of the trusted objects.
These all call the predicates exported from declarative_debugger.m.
trace/mercury_trace_internal.c
Added handlers for `trusted' and `untrust' commands.
trace/mercury_trace_tables.c
trace/mercury_trace_tables.h
Added a function to filter out only the user predicates and functions
from a list of procedures. This filters out uci procs and also
filters out all procs with a mode number > 0 (thus leaving one proc
for each predicate/function). This is used when displaying the
predicates matching an ambiguous proc-spec with a trust command.
NEWS
Updated NEWS file.
Estimated hours taken: 8
Branches: main
Reduce the size of .c and .o files with debugging enabled by compressing
tables of variable numbers. Previously, in the array indexed by variable
numbers whose entries gave each variable's name, the number we used to
identify a variable was its HLDS variable number. Variables whose names
weren't needed, or which didn't have names, or which were optimized away,
still had an entry in this array, which took up space in the .c and .o files
and at runtime.
This diff eliminates these unused array elements by identifying each variable
not via its HLDS variable number, but via a unique id number taken from a dense
set. This id number is used nowhere else, but this is OK.
This change reduces the sizes of .c files with debugging enabled by about 1.5%.
compiler/stack_layout.m:
Implement the change described above.
Bring most of this module up to date with our coding standards:
use state variable syntax where appropriate. (Updating the rest
would cause unnecessary conflicts with another workspace.)
Use 3-tuples instead of pairs of pairs.
trace/mercury_trace_internals.c:
Implement a new command, var_name_stats, that displays statistics
about the amount of space occupied by variable name arrays and the
string tables they point into.
trace/mercury_trace_tables.[ch]:
Provide the function implementing the new mdb command.
doc/user_guide.texi:
doc/mdb_categories:
Document the new command.
tests/debugger/completion.inp:
tests/debugger/mdb_command_test.{inp}:
Update these test cases to account for the new mdb command.
(tests/debugger/completion.exp will be updated later.)
Estimated hours taken: 0.1
Branches: main
tests/debugger/completion.{inp,exp}:
Update this test case to account for my recent addition of two new
mdb commands.
Branches: main
Estimated hours taken: 0.25
tests/debugger/completion.inp:
Update to reflect Ralph's recent change to use `.' rather than `:'
as the module separator.
Estimated hours taken: 2
Branches: main
Fix (most of) the expected outputs of the debugger test cases after my recent
changes. In some cases, this involved modifying the input scripts to make tests
less dependent on event numbers.
tests/debugger/Mmakefile:
Use MDB_STD instead of MDB for more test cases than before.
Disable the output_term_dep test case, since it doesn't actually test
anything that the other test cases don't test, and it prints so many
events that its .exp files depend on event numbers far too much.
tests/debugger/*.exp*:
tests/debugger/*.inp:
Update expected outputs, and in some cases, the inputs.
Estimated hours taken: 10
Branches: main
Improve variable naming in the debugger. Where possible, use
the user's argument names rather than `HeadVar__N'.
compiler/clause_to_proc.m:
Use the user's names for the arguments of
`:- pragma foreign_proc' procedures.
compiler/simplify.m:
When performing excess assignment elimination with `--trace deep',
don't replace a variable with a meaningful name with `HeadVar__N'
or an unnamed variable.
compiler/trace_params.m:
Add a predicate `trace_level_needs_meaningful_var_names'
for use by simplify.m.
compiler/typecheck.m:
For predicates with a single clause, attempt to replace the
`HeadVar__N' variables with the user's original head variables.
trace/mercury_trace_declarative.c:
trace/mercury_trace_vars.c:
Don't assume head variables have names of the form `HeadVar__N'.
Print the argument number when printing the names of
head variables.
tests/debugger/browser_test.inp:
tests/debugger/completion.inp:
Change names of variables in `print' commands.
tests/debugger/*.exp:
tests/debugger/*.exp2:
tests/debugger/declarative/dependency.exp:
tests/invalid/aditi_errors.err_exp:
tests/invalid/mode_inf.err_exp:
tests/invalid/record_syntax_errors.err_exp:
Update expected output.
Estimated hours taken: 0.25
tests/debugger/Mmakefile:
tests/debugger/completion.inp:
tests/debugger/completion.exp:
tests/debugger/completion.exp2:
Fix dependencies on the contents of the standard library.
Estimated hours taken: 40
Branches: main
Add support for command line completion to mdb.
NEWS:
Document the change.
trace/mercury_trace_completion.{c,h}:
Define the framework for completion.
Examine command lines to determine which completers to use.
trace/mercury_trace_alias.{c,h}:
trace/mercury_trace_help.{c,h}:
trace/mercury_trace_internal.{c,h}:
trace/mercury_trace_tables.{c,h}:
trace/mercury_trace_vars.{c,h}:
Define context-specific completers.
trace/mercury_trace_help.c:
Record all help topics in an array for use by the completer.
trace/mercury_trace_internal.c:
Add completion information to the list of commands.
Add a function MR_trace_command_completion_info to access
that information.
runtime/mercury_wrapper.{c,h}
Add a runtime option `--force-readline', which tells mdb to
use readline even if MR_mdb_in is not a tty. This is needed
for tests/debugger/completion. `--force-readline' is not
documented because I'm not sure that it will work properly
in all situations (it's fine for the test).
Fix capitalisation in references to the Mercury User's Guide
in error messages.
trace/mercury_trace_readline.c:
Tell Readline to use our completer.
Handle `--force-readline'. Disable some Readline terminal
initialisation code which reports spurious warnings if the
input stream is not a tty.
trace/Mmakefile:
Add mercury_trace_completion.{c,h}.
runtime/mercury_array_macros.h:
Define a macro MR_find_first_match, which is like MR_bsearch
except that it finds the first match, not an arbitrary match.
runtime/mercury_memory.c:
Handle NULL pointers in MR_copy_string();
runtime/mercury_memory.h:
Add a macro MR_free_func which returns the address of free().
Used where it is necessary to pass the address of MR_free().
tests/debugger/Mmakefile:
tests/debugger/completion.m:
tests/debugger/completion.exp:
tests/debugger/completion.inp:
tests/debugger/completion.inputrc:
tests/debugger/completion.sub1.m:
tests/debugger/completion.sub2.m:
tests/debugger/completion.sub2.sub3.m:
Test case.