Estimated hours taken: 0.3
Branches: main
browser/browse.m:
Document recently added commands.
browser/parse.m:
Document the location of the documentation.
Put the code in more logical order.
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: 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: 8
Branches: main
Get rid of a bunch more ambiguities by renaming predicates, mostly
in polymorphism.m, {abstract,build,ordering}_mode_constraints.m, prog_type.m,
and opt_debug.m in the compiler directory and term_io.m, term.m, parser.m,
and string.m in the library.
In some cases, when the library and the compiler defined the same predicate
with the same code, delete the compiler's copy and give it access to the
library's definition by exporting the relevant predicate (in the undocumented
part of the library module's interface).
NEWS:
Mention that the names of some library functions have changed.
library/*.m:
compiler/*.m:
mdbcomp/*.m:
browser/*.m:
Make the changes mentioned above, and conform to them.
test/general/string_test.m:
test/hard_coded/string_strip.m:
test/hard_coded/string_strip.exp:
Conform to the above changes.
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: 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: 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: 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: 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: 4
Branches: main
A bunch of small improvements to the library.
library/getopt.m:
Allow the determinism of the the option_defaults predicate
passed by users to getopt__process_options to be multi as well as
nondet. The natural determinism of such predicates is multi;
the nondet determinism dates from before the time the compiler
supported multi.
Add a version of process_options that allows it to be run more
than once (by allowing it to start with an option table returned
by a previous invocation) and returns the set of options set by
each invocation, so that the caller can tell which invocation
(if any) has set any given option.
Switch to 4-space indentation to reduce the number of bad line breaks.
library/svset.m:
This new module svset makes it easier to work with sets in
code that uses state variables. For every predicate in set.m that
updates sets, svset.m contains a predicate doing the same thing
with an argument order conducive to the use of state variables.
This module is now used in getopt.m.
library/library.m:
Mention the new module.
library/map.m:
library/tree234.m:
Add new mode to map__map_foldl that I found I needed in elk.
library/map.m:
library/svmap.m:
Apply type specialization to all the most frequently used predicates
for updating maps.
NEWS:
Mention the functionality in getopt.m, and the new module.
Group all the items related to getopt.m.
browser/parse.m:
compiler/options.m:
profiler/mercury_profile.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
Conform to the new determinism in getopt.m.
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: 1
Branches: main
Added a `cdr' command to the interactive term browser. This repeatedly cds
into a path and is useful for accessing deep structures (like long lists).
browser/browse.m
Rewrote simplify_dirs predicate which removes redundant `..'
directories. The previous method was too inefficient and caused
commands like `cdr 10000 ..' to take a long time.
Added help text.
browser/parse.m
Added handler for `cdr' command which is just translated into a `cd'
command with the path repeated the appropriate number of times.
tests/debugger/browser_test.inp
tests/debugger/browser_test.exp
Added test for cdr command.
Estimated hours taken: 0.2
Branches: main
browser/dl.m:
browser/help.m:
browser/parse.m:
browser/util.m:
Bring these modules up to date with our current coding guidelines:
using predmode declarations and state variable syntax where relevant.
Estimated hours taken: 0.2
Branches: main
browser/debugger_interface.m:
browser/declarative_oracle.m:
browser/interactive_query.m:
browser/parse.m:
Conform to the convention of importing only one browser module per
line, and of importing browser modules before standard library modules.
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
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: 0.2
Branches: main
browser/browse.m:
browser/parse.m:
Add a new browser "command", empty, to represent command lines without
tokens. This allows us to avoid giving an error message if the user
just hits return at a browser prompt.
Use a better variable name.
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: 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.
Estimated hours taken: 3
Allow multiple browser commands on one line, separated by semicolons.
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
Separate the code for splitting lines and checking for EOF into
a new function, MR_trace_get_command.
browser/parse.m:
Call util__trace_get_command to read each command.
browser/util.m:
Implement util__trace_get_command, which calls the function
in the trace directory via an indirect pointer.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
Set up the indirect pointer to the new function.
tests/debugger/browser_test.inp:
tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp2:
Test the new feature.
Estimated hours taken: 0.2
Fix a bug in the term browser: the term size limit was by default
being set to the default depth value, 10. The depth value was
hard-coded to 3. Since 3 is a more sensible depth limit (atleast
for the one-line printing that the internal debugger does), the default
has been changed to that.
browser/parse.m:
Set the intended default depth to 3.
browser/browse.m:
Set the browser defaults in a more readable fashion.
Don't hard-code the default depth limit in the help message.
Estimated hours taken: 1
Make all the modules in the browser library sub-modules of
module `mdb', to avoid link errors when users use module names
such as `parse'.
browser/Mmakefile:
browser/browser_library.m:
browser/mdb.m:
Rename browser_library.m to mdb.m.
Change `:- import_module' declarations to
`:- include_module' declarations.
browser/Mmakefile:
Remove the special case rule for `mer_browser.init' --
it doesn't work when the file names are not the same
as the module name. Instead, the default rule for `mdb.init'
is used and the output is copied to `mer_browser.init'.
browser/.cvsignore:
Rename header files, etc.
browser/*.m:
Add a `mdb__' prefix to the names of modules in the browser library
in `:- module' and `:- import_module' declarations.
trace/*.c:
Rename the header files for the browser library in
`#include' statements.
tests/hard_coded/Mmakefile:
tests/hard_coded/parse.m:
tests/hard_coded/parse.exp:
Test case.
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: 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: 40
Add a simple term browser for use by the trace-based debugger.
This is minimal but useful browser. Not included in this version
are a scripting language, Windows Explorer-style tree expansion,
and other features not yet thought of.
N.B. This still needs to be hooked into the debugger.
browser/Mmakefile:
Added target browse_test.
browser/browser_library.m:
Added modules required for the browser.
browser/browse_test.m:
A simple driver for the browser with an example
data structure to browse. (new file)
browser/browse.m:
The browser proper. (new file)
browser/parse.m:
Parser for browser's command language. (new file)
browser/util.m:
Miscellaneous utilities used in the browser code. (new file)
browser/frame.m:
Bare minimal ASCII graphics frames. (new file)