browser/browser_info.m:
browser_params_to_string supported an option to print the browser
persistent state in a friendly format instead of as mdb commands.
The option was never used, so delete it.
(Fixes an unreachable bug where that unused code path did not print
the web_browser_cmd value.)
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_misc.c:
Update the caller.
browser/browse.m:
Add save_and_browse_browser_term_web to be called when
"browse --web" is entered at the mdb prompt.
Add browser_term_to_html_flat_string, a helper predicate for
term_to_html.
Make portray_flat_write_browser_term work take a stream parameter
instead of writing to the current output stream. It is called by
browser_term_to_html_flat_string, writing to a string builder
stream.
browser/browser_info.m:
Add web_browser_cmd field to browser_persistent_state.
browser/mdb.m:
browser/term_to_html.m:
Add new module to generate an HTML document. The document contains a
JavaScript represention of a Mercury term.
(The JavaScript string escaping code is adapted from Julien's
mercury-json project.)
browser/percent_encoding.m:
Add new module to perform percent-encoding.
scripts/mdb_term_browser.css:
scripts/mdb_term_browser.js:
Add JavaScript and CSS files referenced by the generated HTML file
to create a tree view of a Mercury term using jstree.
scripts/32px.png:
scripts/40px.png:
scripts/throbber.gif:
scripts/jstree.min.js:
scripts/jstree.style.min.css:
Add local copy of jstree files <https://www.jstree.com/>
scripts/jquery.slim.min.js:
Add local copy of jquery <https://jquery.com/>
scripts/Mmakefile:
Install the new files into the same directory as mdbrc and other
mdb-related files.
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
Add "browse --web" and "web_browser_cmd" commands.
doc/user_guide.texi:
Document "browse --web" and "web_browser_cmd" commands.
configure.ac:
scripts/mdbrc.in:
Set a reasonable default command to launch a web browser from mdb.
(Only tested on Linux.)
NEWS:
Announce the new feature.
.README.in:
Mention jquery and jstree licensing.
tests/debugger/Mmakefile:
tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
tests/debugger/save.exp2:
Update debugger tests for new commands.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/debugger_interface.m:
browser/declarative_analyser.m:
browser/declarative_debugger.m:
browser/declarative_edt.m:
browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_test.m:
browser/declarative_tree.m:
browser/declarative_user.m:
browser/diff.m:
browser/dl.m:
browser/frame.m:
browser/help.m:
browser/interactive_query.m:
browser/io_action.m:
browser/listing.m:
browser/mdb.m:
browser/mer_browser.m:
browser/name_mangle.m:
browser/term_rep.m:
browser/tree234_cc.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most modules, either the order of the declarations or the order
of the definitions made sense, and I changed the other to match.
In some modules, neither made sense, so I changed *both* to an order
that *does* make sense (i.e. it has related predicates together).
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style.
browser/MDB_FLAGS.in:
Since all the modules in this directory are now free from any warnings
generated by --warn-inconsistent-pred-order-clauses, specify that option
by default in this directory to keep it that way.
browser/browser_info.m:
Avoid using "output" (and "input", for the sake of symmetry)
as function symbols.
browser/debugger_interface.m:
Avoid using "pred" and "func" as function symbols by putting a prefix
before each function symbol in the affected type.
browser/dl.m:
Avoid using "local" (and "global", again for symbols) as function symbols.
profiler/output_prof_info.m:
Avoid using "output" as a type name and as a function symbol.
browser/browse.m:
browser/collect_lib.m:
browser/declarative_user.m:
browser/interactive_query.m:
profiler/generate_output.m:
profiler/output.m:
Conform to the changes above.
extras/morphine/source/browse.op:
extras/morphine/source/collect.op:
extras/morphine/source/current_arg.op:
extras/morphine/source/current_slots.op:
extras/morphine/source/exec_control.op:
extras/morphine/source/forward_move.op:
extras/morphine/source/interactive_queries.op:
Conform to the renames of the function symbols in debugger_interface.m.
Since this code is in Prolog, I cannot be sure that I changed all the
places that should be changed, but that does not matter much.
Since Morphine was designed to work with the Prolog dialects of 1999,
had its last update in 2002, and we never test it, it is very likely
that it hasn't worked in a long time. We keep it around because
(a) it may interest someone, and (b) it doesn't require significant
maintenance. The fact that it does not run may be regrettable, but
it is not actually regretted by many would-be users, or (even) any at all.
(I actually noticed and fixed a bug while doing the above change:
it was a typo in a function symbol name.)
Packages are modules whose only job is to serve as a container for submodules.
Modules like top_level.m, hlds.m, parse_tree.m and ll_backend.m are packages
in this (informal) sense.
Besides the include_module declarations for their submodules, most of the
packages in the compiler used to import some modules, mostly other packages
whose component modules their submodules may need. For example, ll_backend.m
used to import parse_tree.m. This meant that modules in the ll_backend package
did not have to import parse_tree.m before importing modules in the parse_tree
package.
However, this had a price. When we add a new module to the parse_tree package,
parse_tree.int would change, and this would require the recompilation of ALL
the modules in the ll_backend package, even the ones that did NOT import ANY
of the modules in the parse_tree package.
This happened even at one remove. Pretty much all modules in every one
of the backend have to import one or more modules in the hlds package,
and they therefore have import hlds.m. Since hlds.m imported transform_hlds.m,
any addition of a new middle pass to the transform_hlds package required
the recompilation of all backend modules, even in the usual case of the two
having nothing to do with each other.
This diff removes all import_module declarations from the packages,
and replaces them with import_module declarations in the modules that need
them. This includes only a SUBSET of their child modules and of the non-child
modules that import them.
browser/browser_info.m:
Replace the old "dir" type and "dir_no_parent" inst with
two distinct types: up_down_dir and down_dir.
browser/browse.m:
browser/declarative_user.m:
browser/parse.m:
Replace uses of the old dir type with one of the new types,
adding conversions as needed. The separate types make it much clearer
where ".." dir steps may appear and where they may not.
In one case, this extra clarity allows us to avoid calling simplify_dirs
(which eliminates ".." dir steps) twice in a row.
In some other cases, it allows us to replace three-way switches
in which the .. case contained a "this can't happen" assertions
with a two-way switch (between numbered and named child directories).
This should be faster as well as safer. We now allow ".." dir steps
only when the user types in directory paths, and we convert them to
downward-only directory paths immediately afterward.
Simplify the code that writes out directory paths.
If a module has two or more import_module or use_module declarations
for the same module, (typically, but not always, one being in its interface
and one in its implementation), generate an informational message about
each redundant declaration if --warn-unused-imports is enabled.
compiler/hlds_module.m:
We used to record the set of imported/used modules, and the set of
modules imported/used in the interface of the current module. However,
these sets
- did not record the distinction between imports and uses;
- did not allow distinction between single and multiple imports/uses;
- did not record the locations of the imports/uses.
The first distinction was needed only by module_qual.m, which *did*
pay attention to it; the other two were not needed at all.
To generate messages for imports/uses shadowing other imports/uses,
we need all three, so change the data structure storing such information
for *direct* imports to one that records all three of the above kinds
of information. (For imports made by read-in interface and optimization
files, the old set of modules approach is fine, and this diff leaves
the set of thus *indirectly* imported module names alone.)
compiler/unused_imports.m:
Use the extra information now available to generate a
severity_informational message about any import or use that is made
redundant by an earlier, more general import or use.
Fix two bugs in the code that generated warnings for just plain unused
modules.
(1) It did not consider that a use of the builtin type char justified
an import of char.m, but without that import, the type is not visible.
(2) It scanned cons_ids in goals in procedure bodies, but did not scan
cons_ids that have been put into the const_struct_db. (I did not update
the code here when I added the const_struct_db.)
Also, add a (hopefully temporary) workaround for a bug in
make_hlds_passes.m, which is noted below.
However, there are at least three problems that prevent us from enabling
--warn-unused-imports by default.
(1) In some places, the import of a module is used only by clauses for
a predicate that also has foreign procs. When compiled in a grade that
selects one of those foreign_procs as the implementation of the predicate,
the clauses are discarded *without* being added to the HLDS at all.
This leads unused_imports.m to generate an uncalled-for warning in such
cases. To fix this, we would need to preserve the Mercury clauses for
*all* predicates, even those with foreign procs, and do all the semantic
checks on them before throwing them away. (I tried to do this once, and
failed, but the task should be easier after the item list change.)
(2) We have two pieces of code to generate import warnings. The one in
unused_imports.m operates on the HLDS after type and mode checking,
while module_qual.m operates on the parse tree before the creation of
the HLDS. The former is more powerful, since it knows e.g. what types and
modes are used in the bodies of predicates, and hence can generate warnings
about an import being unused *anywhere* in a module, as opposed to just
unused in its interface.
If --warn-unused-imports is enabled, we will get two separate set of
reports about an interface import being unused in the interface,
*unless* we get a type or mode error, in which case unused_imports.m
won't be invoked. But in case we do get such errors, we don't want to
throw away the warnings from module_qual.m. We could store them and
throw them away only after we know we won't need them, or just get
the two modules to generate identical error_specs for each warning,
so that the sort_and_remove_dups of the error specs will do the
throwing away for us for free, if we get that far.
(3) The valid/bug100.m test case was added as a regression test for a bug
that was fixed in module_qual.m. However the bug is still present in
unused_imports.m.
compiler/make_hlds_passes.m:
Give hlds_module.m the extra information it now needs for each item_avail.
Add an XXX for a bug that cannot be fixed right now: the setting of
the status of abstract instances to abstract_imported. (The "abstract"
part is correct; the "imported" part may not be.)
compiler/intermod.m:
compiler/try_expand.m:
compiler/xml_documentation.m:
Conform to the change in hlds_module.m.
compiler/module_qual.m:
Update the documentation of the relationship of this module
with unused_imports.m.
compiler/hlds_data.m:
Document a problem with the status of instance definitions.
compiler/hlds_out_module.m:
Update the code that prints out the module_info to conform to the change
to hlds_module.m.
Print status information about instances, which was needed to diagnose
one of the bugs in unused_imports.m. Format the output for instances
nicer.
compiler/prog_item.m:
Add a convenience predicate.
compiler/prog_data.m:
Remove a type synonym that makes things harder to understand, not easier.
compiler/modules.m:
Delete an XXX that asks for the feature this diff implements.
Add another XXX about how that feature could be improved.
compiler/Mercury.options.m:
Add some more modules to the list of modules on which the compiler
should be invoked with --no-warn-unused-imports.
compiler/*.m:
library/*.m:
mdbcomp/*.m:
browser/*.m:
deep_profiler/*.m:
mfilterjavac/*.m:
Delete unneeded imports. Many of these shadow other imports, and some
are just plain unneeded, as shown by --warn-unused-imports. In a few
modules, there were a *lot* of unneeded imports, but most had just
one or two.
In a few cases, removing an import from a module, because it *itself*
does not need it, required adding that same import to those of its
submodules which *do* need it.
In a few cases, conform to other changes above.
tests/invalid/Mercury.options:
Test the generation of messages about import shadowing on the existing
import_in_parent.m test case (although it was also tested very thoroughly
when giving me the information needed for the deletion of all the
unneeded imports above).
tests/*/*.{m,*exp}:
Delete unneeded imports, and update any expected error messages
to expect the now-smaller line numbers.
Estimated hours taken: 3
Branches: main
Implement a command within the term browser that prints the representation
of the selected term. The command is named "addr" or "memory_addr", since
it adds new functionality only if the term is a possibly tagged pointer.
(If it is an integer or character, a plain "print" command would already
do the job.) This is intended mainly for Mercury system developers.
Note that this diff does not add documentation of the new browser command,
because I cannot find anyplace the existing browser commands are documented,
so I do not know where to add the documentation to.
browser/parse.m:
Put the browser command types in a logical order, with related commands
being together.
Make the code that recognizes browser command types have the same order
as the definition of the browser command type.
Add code to recognize the new command for the new functionality.
Add prefixes to the function symbols of the command and token types
to avoid ambiguities, and avoid using graphic characters that need to
be quoted.
browser/browser_info.m:
Add prefixes to the function symbols of the debugger type
to avoid using the keyword "external" as a function symbol.
browser/browse.m:
Make the switch on the browser command type have the same order as the
definition of the browser command type.
Add code to implement the new command.
browser/declarative_user.m:
Conform to the changes above.
Estimated hours taken: 20
Branches: main
Add a new compiler option. --inform-ite-instead-of-switch. If this is enabled,
the compiler will generate informational messages about if-then-elses that
it thinks should be converted to switches for the sake of program reliability.
Act on the output generated by this option.
compiler/simplify.m:
Implement the new option.
Fix an old bug that could cause us to generate warnings about code
that was OK in one duplicated copy but not in another (where a switch
arm's code is duplicated due to the case being selected for more than
one cons_id).
compiler/options.m:
Add the new option.
Add a way to test for the bug fix in simplify.
doc/user_guide.texi:
Document the new option.
NEWS:
Mention the new option.
library/*.m:
mdbcomp/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
Convert if-then-elses to switches at most of the sites suggested by the
new option. At the remaining sites, switching to switches would have
nontrivial downsides. This typically happens with the switched-on type
has many functors, and we treat one or two specially (e.g. cons/2 in
the cons_id type).
Perform misc cleanups in the vicinity of the if-then-else to switch
conversions.
In a few cases, improve the error messages generated.
compiler/accumulator.m:
compiler/hlds_goal.m:
(Rename and) move insts for particular kinds of goal from
accumulator.m to hlds_goal.m, to allow them to be used in other
modules. Using these insts allowed us to eliminate some if-then-elses
entirely.
compiler/exprn_aux.m:
Instead of fixing some if-then-elses, delete the predicates containing
them, since they aren't used, and (as pointed out by the new option)
would need considerable other fixing if they were ever needed again.
compiler/lp_rational.m:
Add prefixes to the names of the function symbols on some types,
since without those prefixes, it was hard to figure out what type
the switch corresponding to an old if-then-else was switching on.
tests/invalid/reserve_tag.err_exp:
Expect a new, improved error message.
Estimated hours taken: 3
Branches: main
Use the pretty_print module to pretty print terms in
the debugger, rather than pprint.
browser/browse.m:
Use the new pretty_printer.
browser/browser_info.m:
Make the debugger type a member of the stream
typeclass, so that we can use it from the new
pretty printer.
Estimated hours taken: 3
Branches: main
Clean up in unused module imports in the Mercury system detected
by --warn-unused-imports.
analysis/*.m:
browser/*.m:
deep_profiler/*.m:
compiler/*.m:
library/*.m:
mdbcomp/*.m:
profiler/*.m:
slice/*.m:
Remove unused module imports.
Fix some minor departures from our coding standards.
analysis/Mercury.options:
browser/Mercury.options:
deep_profiler/Mercury.options:
compiler/Mercury.options:
library/Mercury.options:
mdbcomp/Mercury.options:
profiler/Mercury.options:
slice/Mercury.options:
Set --no-warn-unused-imports for those modules that are used as
packages or otherwise break --warn-unused-imports, e.g. because they
contain predicates with both foreign and Mercury clauses and some of
the imports only depend on the latter.
Estimated hours taken: 6
Branches: main
browser/*.m:
compiler/*.m:
Rename a bunch of predicates and function symbols to eliminate
ambiguities.
The only real change is factoring out some common code in the mlds
and llds code generators, replacing them with single definitions
in switch_util.m.
Estimated hours taken: 1
Branches: main
Use `pragma foreign_export' in preference to `pragma export' throughout
the Mercury distribution.
Convert more of the extras distribution to four-space indentation and
other minor cleanups.
browser/*.m:
library/*.m:
samples/*:
extras/*:
As above.
Estimated hours taken: 5
Branches: main, release
Fix a bug that was causing debugger/declarative/browse_arg to fail. The
problem was that the default format command in the the declarative debugger
was setting format for the browser rather than for the print command.
browser/browser_info.m:
If a format command with no options is issued at the dd> prompt make
sure we update the correct set of params. The existing code was
written in such a way that it would _always_ update the params for the
browser regardless of where the format command was invoked.
borwser/declarative_user.m:
The default format command at the dd> prompt should change the
settings for the print command, not the browser.
browser/RESERVED_MACRO_NAMES:
s/polution/pollution/
tests/debugger/declarative/browse_arg.exp:
Update the expected output for this test case to match the current
input.
Estimated hours taken: 2
Branches: main, release.
Fix two bugs in the declarative debugger's command handling. The `params'
command wasn't being parsed and the code to handle the `actions' command
expected it to be called `num_io_actions'.
browser/declarative_user.m:
Fix the command handler for `actions'.
Add a command handler for the `params' command.
Fix a typo: s/supress/suppress/
browser/parse.m:
browser/browser_info.m:
Fix some formatting.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/dd_params.m:
tests/debugger/declarative/dd_params.inp:
tests/debugger/declarative/dd_params.exp:
Test case for the above.
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
XXX: the change to the mdb "set" command is not yet documented; that will be
addressed in the next change.
Fix the debugger's save command so that it saves everything it should save
(with one unavoidable exception). Rename the "save_to_file" command to "dump",
as we agreed.
NEWS:
doc/user_guide.texi:
doc/mdb_categories:
Document these facts.
browser/browser_info.m:
Provide a predicate to save the entire persistent state of the browser.
Provide a predicate to set the number of I/O actions printed by the
declarative debugger.
Check that the XML browser command and temp file name being set aren't
empty, since those are not meaningful.
Rename predicates to avoid ambiguities and excessively long names.
Simplify some code.
browser/browse.m:
Generate better error messages if the user tries to use XML browsing
without setting it up.
browser/browse.m:
browser/declarative_user.m:
Conform to the changes in browser_info.m
browser/listing.m:
Use the correct prefix on global C symbols.
trace/mercury_trace_internal.c:
Change the save command to save everything of the persistent debugger
state that can be saved.
Allow the set command to set the number of I/O actions printed by the
declarative debugger. Without this, there would be no way to restore
this part of the debugger persistent state, since a source command
cannot start the declarative debugger.
Rename save_to_file as dump.
Use the correct prefix on global C symbols.
Avoid misleading capitalization.
trace/mercury_trace_spy.c:
Extend the code that saves the state of breakpoints to save conditions
on breakpoints as well.
trace/mercury_trace_browser.[ch]:
Add a utility function for saving the persistent browser state.
Conform to the changes in browser/browser_info.m.
trace/mercury_trace_alias.[ch]
Convert to four-space indentation.
tests/debugger/browser_test.{inp,exp}:
tests/debugger/mdb_command_test.inp:
Use dump instead of save_to_file.
tests/debugger/save.{m,inp,exp}:
New test case to test the new behavior of the save command.
tests/debugger/Mmakefile:
Enable the new test case.
Estimated hours taken: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 12
Branches: main
Remove from std_util.m the predicates that merely call predicates in
the type_desc, construct and deconstruct modules, to reduce clutter
in std_util.m.
library/std_util.m:
Remove those predicates from std_util.m.
library/deconstruct.m:
Add a type we need that was previously defined in std_util.m.
library/construct.m:
Delete some module qualifications that have now become unnecessary,
browser/browse.m:
browser/browser_info.m:
browser/declarative_tree.m:
browser/dl.m:
browser/help.m:
browser/sized_pretty.m:
browser/term_rep.m:
compiler/bytecode_gen.m:
compiler/llds_out.m:
compiler/mlds_to_il.m:
compiler/mlds_to_managed.m:
library/assoc_list.m:
library/hash_table.m:
library/io.m:
library/pprint.m:
library/private_builtin.m:
library/prolog.m:
library/require.m:
library/rtti_implementation.m:
library/store.m:
library/term.m:
library/term_to_xml.m:
library/version_hash_table.m:
mdbcomp/program_representation.m:
Import type_desc.m, construct.m and/or deconstruct.m to provide
definitions of functions or predicates that up till now were in
std_util.m. Modify the calls if the called function or predicate
had a slightly different interface in std_util.m.
Also, convert term_to_xml.m to four-space indentation, and delete
unnecessary module qualifications in term.m.
tests/debugger/polymorphic_output.{m,inp,exp,exp2}:
tests/hard_coded/copy_pred_2.m:
tests/hard_coded/deconstruct_arg.exp:
tests/hard_coded/deconstruct_arg.exp2:
tests/hard_coded/deconstruct_arg.m:
tests/hard_coded/elim_special_pred.m:
tests/hard_coded/existential_bound_tvar.m:
tests/hard_coded/expand.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/higher_order_type_manip.m:
tests/hard_coded/nullary_ho_func.m:
tests/hard_coded/tuple_test.m:
tests/hard_coded/type_ctor_desc.m:
tests/hard_coded/type_qual.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/sub-modules/class.m:
tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested2.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
tests/hard_coded/sub-modules/parent2.child.m:
tests/hard_coded/typeclasses/existential_rtti.m:
tests/recompilation/type_qual_re.m.1:
cvs update: Updating tests/submodules
cvs update: Updating tests/tabling
cvs update: Updating tests/term
cvs update: Updating tests/tools
cvs update: Updating tests/trailing
cvs update: Updating tests/typeclasses
cvs update: Updating tests/valid
tests/valid/agc_unbound_typevars.m:
tests/valid/agc_unbound_typevars2.m:
tests/valid/agc_unused_in.m:
Replace references to the deleted predicates in std_util with
references to the equivalent predicates in type_desc, construct
and/or deconstruct. In test cases that already tested both the
functionality in std_util and in the other modules, simply delete
the part exercising std_util.
Estimated hours taken: 2
Branches: main
browser/*.m:
Replace __ with . as the module qualifier everywhere in all the modules
of the browser directory. Convert the currently tab-indented modules
to four-space indentation. Delete some unnecessary module
qualifications. Change some type names and function symbols to avoid
ambiguities. Replace a bunch of uses of DCGs with state variable
notation.
Estimated hours taken: 5
Branches: main
Allow field names to be used in the paths used with subterm dependency
tracking.
Allow the user to cd to the return value of a function by giving the
number of arguments plus one as an argument to the `cd' command.
browser/browse.m:
Export the predicate that removed ".." from paths.
Make the return value of this predicate a subtype, so we can be
sure the simplification has been applied to the path.
Allow the user to do `cd N', where N is the number of arguments of
a function plus one. This will cd to the return value of the function.
Add some more aliases for the directory name of the return value of a
function.
browser/browser_info.m:
Use the new simplified_dirs inst.
When converting a list of directories to a term path, look at the
value the path applies to to resolve field names in the path.
browser/declarative_user.m:
Report an error if the user tries to track an I/O action.
Call the new version of convert_dirs_to_term_path which handles
field names in the path.
browser/term_rep.m:
Add predicates to lookup a subterm in a term representation and
also to look up a named field in a term representation.
tests/debugger/declarative/Mercury.options:
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/named_fields.exp:
tests/debugger/declarative/named_fields.inp:
tests/debugger/declarative/named_fields.m:
Test tracking of subterms using a path with a field name.
tests/debugger/polymorphic_output.exp*
The output of this test has changed, because cd's to the return value
of a function, using a number, are now allowed.
Estimated hours taken: 20
Branches: main
Implement a second version of the subterm dependency tracking algorithm
that uses the following heuristic to speed things up: If the subterm is being
tracked through an output argument, and there is an input argument with the
same name as the output argumnet, except for a numerical suffix, then the new
algorithm will check if the subterm appears in the same position in the input
argument. If it does then it will continue tracking the subterm in the input
argument, thus bypassing the subtree rooted at the call. Since dereferencing a
subterm in a large structure can be expensive, the new algorithm will only try
to bypass calls to procedures it has not tried to bypass before. The set of
procedures it has tried is reset each time a new explicit subtree or supertree
is generated.
Add a `track' command that behaves in the same way as `mark', except that
it doesn't assert that the node is erroneous or inadmissible.
Add an optional `--accurate' argument which tells the declarative debugger to
use the original tracking algorithm.
We still allow the old algorithm to be used, because there
are situations where the new algorithm could find the wrong call (i.e.
when a subterm appears in the same position in an input argument,
but the subterm in the output argument is actually bound by a descendent call
-- it just happens to be bound to the same value as the input subterm).
doc/user_guide.texi:
Change the documentation accordingly.
browser/browse.m:
browser/browser_info.m:
browser/parse.m:
browser/declarative_user.m:
Add a `track' command that does the same thing as a `mark' command,
except it doesn't assert the atom to be erroneous or inadmissible.
Allow an `--accurate' or `-a' argument for the `mark' and `track'
commands which indicates that the old subterm dependency tracking
algorithm should be used.
Pass information about tracked subterms to the declarative debugger.
Do not allow a whole atom to be tracked or marked as this doesn't
make sense.
browser/declarative_analyser.m:
browser/declarative_debugger.m:
browser/declarative_edt.m:
browser/declarative_oracle.m:
Implement the new tracking algorithm.
browser/term_rep.m:
Add a predicate to dereference a subterm in another term.
mdbcomp/rtti_access.m:
Add a predicate to find a candidate input argument on which to
apply the new heuristic.
runtime/Mmakefile:
runtime/mercury_layout_util.h:
runtime/mercury_stack_layout.h:
trace/mercury_trace_vars.c:
trace/mercury_trace_vars.h:
Move the function for finding the name of a variable to the runtime,
so that it can be called from the declarative debugger.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/nodescend_tracking.exp:
tests/debugger/declarative/nodescend_tracking.inp:
tests/debugger/declarative/nodescend_tracking.m:
Test the new heuristic.
tests/debugger/declarative/closure_dependency.inp2:
tests/debugger/declarative/closure_dependency.exp2:
Expect an error message when marking a whole atom.
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: 6
Branches: main
Allow an XML term browser to be called from the declarative debugger.
browser/browse.m
Add a predicate to save a term to an XML file and then launch an
XML browser.
Add a predicate that saves a term to an XML file and doesn't print
any error messages, but just returns an io.res result. Use this
in save_term_to_file_xml and the predicate mentioned above.
browser/browser_info.m
Add two fields to the browser's persistent state - one to record the
temporary filename to use when saving a term to an XML file and one
to hold the command to launch the XML browser. Previously these were
stored in C global variables which were not accessible from the
declarative debugger.
Export the browser_persistent_state type so the field access functions
can be used from browse.m.
browser/declarative_user.m
Allow the user to give an -x or --xml option to the browse command from
within the declarative debugger.
Reformat the user_command type and add a new functor: browse_xml_arg/1.
Describe the -x or --xml browse option in the help message and reformat
the trust command help message as it was looking a bit untidy.
tests/debugger/browser_test.exp
tests/debugger/browser_test.inp
Test the --xml option from within the declarative debugger.
trace/mercury_trace_browse.c
trace/mercury_trace_browse.h
trace/mercury_trace_internal.c
Move MR_trace_save_and_invoke_xml_browser from mercury_trace_internal.c
to mercury_trace_browse.c so it can call the new Mercury code in
browser/browse.m.
Handle the `set xml_browser_cmd' and `set xml_tmp_filename' commands by
calling Mercury code to set the appropriate fields in the persistent
browser state.
Estimated hours taken: 0.2
Branches: main
browser/*.m:
Fix the current mixture of __ and . to module qualify module names
by standardizing on the latter.
Estimated hours taken: 5
Branches: main
Add `mode' command to interactive term browser to display the mode of a
sub-term. At the moment this command only works when the term browser is
invoked from inside the declarative debugger.
browser/browser_info.m
Allow a function to be passed to the browser which it can call to
work out the mode of a sub-term.
browser/browse.m
Export versions of the browser invocation predicates that don't
accept a mode function.
Handle the `mode' browser command by calling the supplied function
if it's present.
Document the `mode' command in the browser help message.
browser/declarative_debugger.m
To determine the mode of a sub-term we compare the state of
instantiation of the sub-term at the CALL event and at the EXIT, FAIL
or EXCP event. To do this we need the initial and final
atoms for incorrect contour bugs and wrong answer nodes (for
other nodes the initial and final atoms are the same).
browser/declarative_oracle.m
Conform to the fact that wrong answers now also have the
initial atom.
browser/declarative_tree.m
Export trace_atom_subterm_is_ground/3 for use in declarative_user.m.
Include the initial atom in wrong answer nodes and incorrect contour
bugs.
browser/declarative_user.m
Add function arg_num_to_arg_pos to replace some duplicated code.
Alter the edt_node_trace_atom predicate to find the initial and the
final atoms for a question.
Add a function to find the mode of a sub-term given the path to the
sub-term and the initial and final atoms. Pass this function to
the browser so it can work out the mode of a sub-term.
browser/parse.m
Parse `mode' command.
tests/debugger/declarative/Mmakefile
tests/debugger/declarative/browser_mode.exp
tests/debugger/declarative/browser_mode.inp
tests/debugger/declarative/browser_mode.m
Test the `mode' command.
Estimated hours taken: 2
Branches: main
Make `set' mdb command work from within the declarative debugger.
browser/browse.m
Make set_browse_param call a new predicate set_param/5 in
browser_info.m.
browser/browser_info.m
Add set_param/5 to set browser parameters from an option table.
browser/declarative_user.m
Add and handle `set' command.
Add help text.
browser/parse.m
Make parse/2 public so it can be called from the declarative debugger.
tests/debugger/declarative/browse_arg.exp
tests/debugger/declarative/browse_arg.inp
Add test case.
Estimated hours taken: 2
Branches: main
Factor out common code in the handling of plain terms and synthetic terms.
We already had a mechanism (the browser_term type and operations on it) for
handling them in a unified manner, we just didn't use them everywhere we could.
browser/browser_term.m:
Add this new module to hold the browser_term type and the operations
on it, which previously were in two different modules (browser_info
and browse respectively).
Make the operations function, since that is their natural form.
browser/mdb.m:
Add the new module.
browser/browser_into.m:
Delete the type moved to browser_term.m.
browser/browse.m:
Delete the operations moved to browser_term.m.
Replace operation pairs on plain terms and synthetic terms with
generalized operations on browser terms.
browser/declarative_user.m:
browser/io_action.m:
browser/sized_pretty.m:
trace/mercury_trace_browser.c:
Conform to the changes listed above.
Estimated hours taken: 10
Branches: main
Split the existing browser library into two libraries, by making the
program_representation module into its own library. This is useful because
the compiler refers to program_representation.m, whose code thus needs to be
linked into compiler executables even if the compiler isn't compiled with
debugging enabled. By creating a new library for this module, we avoid any
chance of the linker dragging in the rest of the modules in the browser
library. (This is a problem with an upcoming diff.).
The name of the new library is "mdbcomp", because the intention is that it
contain code that is shared between the debugger and the compiler. This means
mostly the definitions of data structures that the compiler generates for the
debugger, and the predicates that operate on them.
Mmake.common.in:
Allow MDB_COMP_ as a prefix for symbol names in the browser directory.
Mmake.workspace:
Add a make variable holding for the name of the new library, and
add the name to the relevant lists of libraries.
Avoid duplicating the lists of filenames that need to be updated
when adding new libraries or changing their names.
Mmakefile:
Use make variables to refer to library names.
browser/mdbcomp.m:
browser/mer_mdbcomp.m:
Add these files as the top modules of the new library.
browser/program_representation.m:
Make program_representation.m a submodule of mdbcomp, not mdb.
browser/program_representation.m:
browser/browser_info.m:
Move a predicate from program_representation.m to browser_info.m
to avoid the mdbcomp library depend on the browser library, since
this would negate the point of the exercise.
browser/mdb.m:
Delete program_representation.m from the list of submodules.
browser/Mmakefile:
Update this file to handle the new module.
browser/Mercury.options:
Mention the new module.
browser/*.m:
Update the lists of imported modules. Import only one browser module
per line.
compiler/notes/overall_design.html:
Document the new library.
compiler/compile_target_code.m:
Add the mdbcomp library to the list of libraries we need to link with.
compiler/prog_rep.m:
trace/mercury_trace_internal.c:
Import program_representation.m by its new name.
scripts/c2init.in:
Centralize knowledge about which files need to be updated when the list
of libraries changes here.
scripts/c2init.in:
scripts/ml.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/linear:
tools/lml:
Update the list of libraries programs are linked with.
Estimated hours taken: 8
Branches: main
Make browsing in the debugger more flexible by adding options to the "ls",
"print" and "set" commands of the browser. Make browsing in the debugger less
confusing by making the "set" command by default set the parameters used
not just by the "ls" command but also by the "print" command, both inside and
outside the browser. This is done by making "ls" and "print" synonyms inside
the term browser.
browser/parse.m:
Replace the commands ls/0, ls/1 and print/1 with a single command,
print/2. The arguments of print/2 specify
- the presence or absence of options controlling which formatter to
use, and
- the path to the subterm to look at (which the "ls" command had,
but not the "print" command).
Change the set/1 command into the set/2 command, adding a field
specifying the presence or absence of options controlling which
caller type and/or which formatter parameters to set. The set/2
command within the browser prompt now functions the same as the "set"
command from the mdb prompt, because they now call the same code
to update the parameter sets.
Change the parsing infrastructure to allow the use of getopt to
process the options, by keeping around the word structure even after
tokenization.
Comment out code that isn't called, but may be needed later
for debugging.
Update the block comment documenting the command syntax.
browser/browse.m:
Conform to the change in the type of commands.
Change the implementation of the "set" command. Instead of the default
being to change only the parameter set used by the "ls" command, make
the default the application of the change to all the parameter sets.
If users want to restrict the change to apply only to the "ls" command,
they can specify the -B option.
Change the implementation of the set/0 command to report not just one
set of parameters, but all of them, since they can now all be changed
by the set/2 command.
Update the help message, to show the new options and to group related
commands together.
browser/browser_info.m:
Provide variants of the predicates for changing settings that are
specialized for the requirements of mdb and of the term browser.
Change the default format for the browser to "flat", to match the
default for the mdb "print" command. This was the default for the
browser's print command as well. This changes the default behavior
of the browser's "ls" command. Since "print" and "ls" had different
defaults but are now synonyms, we had to break backward compatibility
for one or the other. (Preserving different defaults for these two
browser commands would create an unnecessarily complicated user
interface with respect to the meaning of their options.)
browser/declarative_user.m:
Make it possible to switch the parameter set used to by the declarative
debugger to print atoms quickly yet consistently.
trace/mercury_trace_browse.c:
Call the C versions of the parameter setting predicates. (The versions
for use from within the term browser specify the parameters a different
way).
tests/debugger/browser_test.exp:
tests/debugger/exception_value.exp:
tests/debugger/polymorphic_output.exp:
tests/debugger/declarative/browse_arg.exp:
Update the expected outputs to comply with the changes above.
Estimated hours taken: 6
Branches: main
Print streams sensibly in the debugger.
runtime/mercury_library_types.h:
Define MercuryFilePtr as a shorthand for MercuryFile *.
library/io.m:
Define a user-friendly representation for streams that includes not
just the stream's name but all the info about the stream that user
using mdb may wish to know about the stream, as well as a unique stream
id.
Make the changes required to maintain this improved stream database.
If the program is being executed under mdb, then do not ever delete
items from the stream database, since e.g. the declarative debugger
may need to print the stream's representation even after the stream
is closed. (If executing outside mdb, then we delete a stream's entry
from the stream database when the stream is closed, as before.)
To allow the debugger to detect which variables are I/O streams,
change the stream types from being equivalent to c_pointer (and thus
indistinguishable from other c_pointers) to their own type. Implement
this type as MercuryFilePtr in the C backend. In the IL backend, we
represent it as Object[], the minimum representation change possible.
Use the C type definition to get rid of many casts.
When writing streams, write the user-friendly representation, not
a meaningless <<c_pointer>>.
runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
runtime/mercury_layout_util.c:
The change in stream's representation changes the types of some of the
arguments of functions exported to C from io.m; conform to those
changes.
browser/browse.m:
browser/sized_pretty.m:
In each of the mechanisms that the debugger can use to display terms,
pass along the stream name database.
browser/browser_info.m:
When deconstructing terms that are streams, return the stream's
user-friendly id, not a c_pointer.
browser/browse_test.m:
Update this test program to test the new way of printing streams.
runtime/mercury_trace_base.[ch]:
Define the MR_trace_ever_enabled variable to let io.m know whether
it is allowed to ever discard stream info.
runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
Update the types of the functions dealing with streams to use
MercuryFilePtr to refer to streams instead of MR_Word. These functions
are implemented by Mercury predicates exported to C.
runtime/mercury_wrapper.c:
Set MR_trace_ever_enabled to true when execution tracing is enabled.
This is the only assigment to MR_trace_ever_enabled after
initialization to the default (false).
tests/debugger/declarative/io_stream_test.{m,inp,exp,exp}:
A new test case to test the debugger's printing of I/O streams.
tests/debugger/declarative/Mmakefile:
Enable the new test case.
Estimated hours taken: 1
Branches: main
Fix some problems where we were calling the incorrect predicates from
deconstruct.m.
browser/browser_info.m:
Change limited_deconstruct_browser_term_cc to use the
std_util__limited_deconstruct_cc.
Change deconstruct_browser_term_cc to use std_util__deconstruct_cc.
browser/browse.m:
browser/sized_pretty.m:
Handle the changes to limited_deconstruct_browser_term_cc.
Estimated hours taken: 6
Branches: main
Make it easier to print and browse I/O actions in the declarative debugger.
browser/browser_info.m:
Add a new component to the debugger's permanent state to record the
user's preference as to how many I/O actions can be printed with each
atom. If an atom has this many I/O actions or fewer, they are printed.
If it has more, only a notice about too many I/O actions to show is
printed, and the user has to look up the actions manually.
browser/browse.m:
Update the help message and the printing of the current settings
accordingly.
browser/parse.m:
Add a new piece of functionality to the "set" browser command,
"set num_io_actions <n>", that allows the user to set the value
of this new parameter.
browser/declarative_user.m:
Delete the old, undocumented command "io <action_num>". Replace with
two new command forms, "print io <from_action_num>[-<to_action_num>]"
and "browse io <action_num>". "browse io" does what the old "io"
command did, but using this to print many I/O actions is clumsy;
that's what "print io" is for.
For symmetry, also add "print <from_arg_num>[-<to_arg_num>]".
Respect the new, user-configurable limit on the number of I/O actions
printed with each atom.
tests/debugger/declarative/tabled_read_decl.{inp,exp}:
Add some tests of the new functionality.
Estimated hours taken: 3
Branches: main
Make the commands that update the browser parameters within the browser itself
affect the parameter settings only for the current browser caller type (print,
print all, or browse).
browser/browse_info.m:
Add the current call type to the browser state.
Add a more convenient mechanism for setting the parameters only for a
specified caller type.
Make some existing code look nicer.
browser/browse.m:
When setting parameters, set them only for the current caller type.
tests/debugger/browse_pretty.exp:
Update the expected output of this test case.
Estimated hours taken: 50
Branches: main
Allow the debugger to print higher order values and typeinfos, mainly by
making the committed choice modes of the predicates in deconstruct.m to
deconstruct higher order values and typeinfos. (The non committed choice
versions will continue to return only placeholders.)
Having the debugger print typeinfos is occasionally useful but more often
it is just distracting. This change therefore adds a new debugger command,
"print_optionals", that toggles the printing of optional values. For now,
the only optional values are typeinfos.
NEWS:
Mention the new capability and the new predicates in the library.
Mention the predicates added previously that allow the caller to
specify how non-canonical terms should be handled, since the change
in their semantics that we anticipated when they were added has now
happened, and their semantics should now be more stable.
browser/browser_info.m:
Use the predicates in the deconstruct.m instead of std_util,
to make the choice of noncanonical term method handling explicit.
browser/browse.m:
When writing small terms using io__write_univ, explicitly use
the same noncanonical term handling method as browser_info.m
library/io.m:
Add predicates to retrieve the current input and output streams.
Add versions of io__write_univ that specify the stream and maybe
the method of handling noncanonical terms.
Add a mode to io__write_list that allows the closure that prints the
list elements to be cc_multi.
All of these are for the new functionality in the browser.
runtime/mercury_ml_expand_body.h:
In committed choice contexts, deconstruct closures as if they were
ordinary terms, with the function symbol being the name of the
predicate/function and the arguments being the terms stored in
the closure.
In committed choice contexts, deconstruct typeinfos as if they were
ordinary terms, with the function symbol being the name of the type
constructor and the arguments being the type constructor's arguments.
runtime/mercury_type_info.[ch]:
Add a new function, MR_collapse_ctor_equivalences, for use by
mercury_ml_expand_body.h.
Delete a redundant function comment.
library/deconstruct.m:
Document the changes in the behavior of the predicates defined in this
module as a result of the change to mercury_ml_expand_body.h.
runtime/mercury_ho_call.h:
runtime/mercury_stack_layout.h:
Add prefixes on structure field names that did not have them.
browser/dl.m:
Add prefixes where needed by the changes to mercury_ho_call.h.
runtime/mercury_layout_util.[ch]:
Remove the first argument of MR_materialize_closure_typeinfos, since
its correct value is always the same part of the second argument.
runtime/mercury_deep_copy_body.h:
Do not pass the first argument of MR_materialize_closure_typeinfos.
Add field name prefixes where necessary.
compiler/modules.m:
The mercury_builtin module is no longer part of the library.
compiler/pd_debug.m:
compiler/rl_analyze.m:
Minor updates to avoid trying to take the address of io__write_list,
since it now has more than one mode.
runtime/mercury_init.h:
runtime/mercury_wrapper.[ch]:
trace/mercury_trace_vars.[ch]:
Add a parameter to MR_trace_browse_all_on_level that specifies
whether we should print values of type type_info.
trace/mercury_trace_vars.c:
Do not ignore predicates and functions anymore.
runtime/mercury_stack_trace.c:
trace/mercury_trace.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
Pass the new parameter of MR_trace_browse_all_on_level.
trace/mercury_trace_internal.c:
Implement the "print_optionals" command.
doc/user_guide.texi:
Document the "print_optionals" command.
tests/debugger/mdb_command_test.inp:
Test the documentation of "print_optionals".
tests/debugger/higher_order.{m,inp,exp,exp2}:
A new test case to exercise the ability to print higher order values.
Note that the format of the predicate names in the output should be
improved, but that is a separate change since doing it the right way
requires bootstrapping.
tests/debugger/Mmakefile:
Enable the new test case.
tests/debugger/nondet_stack.exp*:
Update the expected output to reflect the fact that nondet stack dumps,
being intended for debugging, include type_infos.
tests/debugger/tabled_read_decl.exp*:
Update the expected output to reflect the fact that for maximum
usefulness, the printing of I/O action atoms prints meaningful
type_infos.
tests/hard_coded/deconstruct_arg.*:
tests/hard_coded/write_reg1.*:
Expand these tests to check that we handle higher order values
correctly not just when canonicalizing but also in committed choice
modes.
Estimated hours taken: 2
Branches: main
browser/*.m:
Make the debugger use the committed choice versions of the
deconstruction predicates, and propagate the committed choice
environment up the call chain as far as necessary.
Estimated hours taken: 20
Branches: main
Give the debugger the ability to print goals.
NEWS:
Mention the new ability.
browser/browser_info.m:
Define a new type, browser_term, which represents either a plain term,
or a "synthetic term", which is a string (predicate or function name),
a list of argument values, and an indication of whether the synthetic
term is a predicate goal (i.e. of the form p(a1, ..., an)) or a
function goal (i.e. of the form f(a1, ..., an-1) = an).
Add utility predicates for processing browser_terms.
browser/browse.m:
Add predicates for printing and browsing synthetic terms, and export
them to C code.
browser/browse.m:
browser/size_pretty.m:
Generalize lots of predicates to handle browser_terms, not just plain
terms.
browser/util.m:
Add a new type, "unbound", for use by mercury_trace_vars.c.
library/pprint.m:
Add functions for converting synthetic terms to docs.
Fix a potential efficiency problem: an unnecessary deconstruct.
runtime/mercury_type_info.h:
Add macros for defining static type_infos in C code.
Add macros for computing the names of type_ctor_infos even in non-hlc
grades.
Give C code access to the representation of bools and of values of
the new type "unbound".
trace/mercury_trace_browse.[ch]:
Add functions for printing goals.
trace/mercury_trace_internal.c:
Add code to recognize and handle the commands "print goal" and
"browse goal".
doc/user_guide.texi:
Document the new commands.
trace/mercury_trace_vars.[ch]:
Add a function to compute the components of synthetic terms.
tests/debugger/browse_pretty.{inp,exp*}:
Add new commands to the input to test the printing and browsing of
predicate goals, and update the expected outputs accordingly.
tests/debugger/polymorphic_output.{inp,exp*}:
Add new commands to the input to test the printing and browsing of
function goals, and update the expected outputs accordingly.
Estimated hours taken: 8
Branches: main
Allow the browser to refer to fields by name.
browser/browser_info.m:
Generalize the data structure for recording paths within terms to allow
navigation by field names.
browser/browse.m:
browser/program_representation.m:
Update the algorithms for navigation in terms accordingly.
browser/parse.m:
Update the algorithm for reading in navigation terms.
Allow digits as well as letters and underscores in "names", since
field names may contain digits as well. This should not impact
other uses of names by the other parts of the debugger.
library/std_util.m:
Add new predicates named_argument and det_named_argument. They are
implemented using ML_named_arg, a new C function which is the same
as ML_arg except that it specifies the selected argument by name.
NEWS:
Mention the new predicates.
runtime/mercury_ml_expand_body.h:
Add a new alternative, EXPAND_NAMED_ARG, for use in implementing
ML_named_arg.
tests/debugger/field_names.{m,inp,exp,exp2}:
Expand this test case to exercise the browser.
Estimated hours taken: 0.5
Branches: main
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_internal.c:
Set the pretty printing flags (which represent Mercury bools) using
functions exported from Mercury code, rather than using TRUE and
FALSE. This removes the assumption that Mercury bools have the
same representation as C bools, which was causing a problem when
--reserve-tag was used.
Change the type of these flags to MR_Word. According to the
reference manual, this is the type Mercury bools have when passed
to C code.
browser/browser_info.m:
Export functions that construct Mercury bools.
Estimated hours taken: 40
Branches: main
This is the second part of a change to support term dependency analysis
in the declarative debugger. A `mark' command is implemented for the
term browser, which allows a particular subterm to be selected and
returned from the browser. The declarative debugger interprets this as
a suspicious subterm, and tries to find a child or sibling node from which
this subterm comes. This is used to determine the next question to be
asked of the oracle.
browser/browse.m:
Update the browser interface to allow for marked subterms being
returned from the browser.
Implement and document the mark command.
Rewrite run_command as a switch instead of a chain of if-then-elses.
This forces all unimplemented commands to be explicitly listed,
and gives better error checking.
browser/browser_info.m:
Add a maybe_mark field to the browser_info. It is initially `no',
but is updated when the mark command is given.
browser/declarative_analyser.m:
Select which child or sibling node to ask about next by searching
for the origin of the suspicious subterm. If the subterm has mode
`out' we act as if the oracle had answered no, and if the subterm
has mode `in' we act as if the oracle had answered yes. In future
we may not wish to presume this -- we do so now mainly to keep the
analysis algorithm simpler.
browser/declarative_debugger.m:
Add a functor for suspicious subterms to the decl_answer type.
browser/declarative_oracle.m:
Accommodate the changed answer type. The oracle does not try to
store information about suspicious subterms in the knowledge base,
because in principle this could lead to infinite loops (although
currently this wouldn't be a problem since we don't ever use the
information to move upward in the tree, so no cycle could be
formed).
browser/declarative_user.m:
Accommodate the changed answer type, and interpret marked terms
from the browser as suspicious subterms.
browser/parse.m:
Add the new command.
browser/program_representation.m:
Add a procedure to convert the browser's list(dir) to a term_path.
Change atomic_goal_rep_is_call/2 so it fails for special predicates,
which was originally intended.
trace/mercury_trace_browse.c:
Ignore the extra argument -- marked terms are not currently used in
the main debugger.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/input_term_dep.*:
tests/debugger/declarative/output_term_dep.*:
tests/debugger/declarative/special_term_dep.*:
New test cases.
Estimated hours taken : 185
Added a new pretty printing format to the term browser. This new format
helps put a limit on the size of the term printed during debugging.
This limit is specified by setting the number of lines you want the term
to be printed on and the width of these lines. Refer to sized_pretty.m for
Examples.
browser/sized_pretty.m:
New file that does what's described above.
browser/browse.m:
browser/browser_info.m:
browser/mdb.m:
browser/parse.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_internal.c:
Modified to accommodate the new format.
tests/debugger/browse_pretty.inp:
tests/debugger/browser_test.inp:
Included test cases for the new pretty printing format.
tests/debugger/browse_pretty.exp:
tests/debugger/browser_test.exp:
Changed the expected output.
Estimated hours taken: 25
Enhance the configuration parameters of the browser. The browser is now
sensitive to the type of caller (print, browse, or print *) and can have
different settings for each type. E.g., the default line limit per variable
can be made shorter for `print *' than for `print'. The browser also allows
different settings for each format.
The browser also accepts an optional format, which overrides the current
setting for the duration of the call.
To make use of these features, mdb has a new `set' command that allows the
settings to be updated in various ways. The browser version of `set'
still works, although it doesn't yet accept the options that the former does.
Also, `print' and `browse' can now take options that override the default
format.
browser/browser_info.m:
New module which defines the key browser data structures. The
`browser_state' previously used by browse.m has been split into
two parts: the transient state (browser_info) and the persistent
state (browser_persistent_state). The persistent state is created
when the browser is first called, and is saved between calls to the
browser, whereas a new transient state is created each time the
browser is called, and lasts for the duration of the call.
The persistent state contains settings for each possible combination
of format and caller type.
This module exports C functions that update the persistent state.
browser/browse.m:
Move the browser_state into the new module.
Change the interface so that it allows optional format and caller
type input arguments. This allows its behaviour to vary depending on
whether the caller is implementing `print', `browse', or `print *'.
It also allows the default format to be overridden by options to
these commands.
General rearrangement of the browser code to avoid code duplication.
This addresses the following comment from the module:
% XXX: could abstract out the code common to the following preds.
along with other similar problems.
The code for testing the size of a term and deciding between
`io__write' and a depth limited printer has been moved from `print'
to `portray_flat'. This allows `print' to be used with formats
other than flat.
TODO: allow browser commands to take format options; currently only
mdb commands can.
browser/declarative_user.m:
Update this for the changed interfaces.
browser/mdb.m:
Add the new module.
browser/parse.m:
Move the definitions of `dir', `setting', and `portray_format'
to the interface of the new module.
The argument to the `<' command, which sets the depth limit, is
no longer optional. The default used to be to use the system
default, but now there are multiple system defaults and no way to
select which one.
browser/*.m:
tests/debugger/browse_pretty.inp:
tests/debugger/browse_pretty.exp:
s/clipx/width/g
s/clipy/lines/g
The reason for this change is that the names are used in the
context of all formats, but only verbose format actually clips
the output, so `clipx' and `clipy' are misleading.
tests/debugger/browser_test.inp:
tests/debugger/browser_test.exp:
Test the new features.
doc/user_guide.texi:
Document the new features.
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
Allow extra arguments for the print and browse functions, to specify
the format and the caller type (in the case of print).
Export the function MR_trace_set_browser_param, which calls the
browser to do the work of mdb's set command.
Export the types MR_Browse_Caller_Type and MR_Browse_Format, which
mirror two of the types in the new browser module.
trace/mercury_trace_external.c:
Update for the change to MR_trace_browse_one: pass `browse' as
the caller type, and always use the default format.
trace/mercury_trace_internal.c:
Add functions to parse the format and caller type options. Update
the print and browse commands to expect format options. Add the
`set' command.
Replace MR_trace_print_var and MR_trace_browse_var with one function,
MR_trace_browse_internal. This function takes the caller type as an
argument, so there is no need for two functions.
Remove occurrences of:
/* XXX should use MR_mdb_in and MR_mdb_out */
since we already do this.
trace/mercury_trace_vars.c:
trace/mercury_trace_vars.h:
Change the function type MR_Browser so that it also expects a caller
type and a format. These arguments are now required by the browser.
This means that some of the functions that take an MR_Browser
argument needed to be updated to also take a caller and/or format,
so they can pass this on to the browser function when it is called.