Commit Graph

71 Commits

Author SHA1 Message Date
Ralph Becket
e01f551473 Try to handle pretty-printing of functor names containing '.'s
Estimated hours taken: 5 (mostly testing)
Branches: main

browser/browse.m:
	Try to handle pretty-printing of functor names containing '.'s
	correctly (the default pretty-printer formatting escapes names
	containing '.'s).

library/list.m:
	Improve the pretty-printer formatting of lists by preventing
	the output of ellipsis when all items in the list have been
	printed.

library/pretty_printer.m:
	Special-case printing of "." as an infix operator by not
	surrounding it by spaces.

tests/debugger/browse_pretty.exp:
tests/debugger/browser_test.exp:
tests/debugger/declarative/change_search.exp:
	Updated to reflect output of new pretty printer.

tests/debugger/browser_test.exp3:
	Added a new possible output (for new pretty printer).
2007-08-22 22:36:18 +00:00
Peter Ross
2dd493be45 Use the pretty_print module to pretty print terms in
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.
2007-08-14 05:25:24 +00:00
Peter Ross
d94ba52167 Use the pretty_print module to pretty print terms in
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.
2007-08-14 05:24:47 +00:00
Simon Taylor
f1275fa6e8 Implement io.write for arbitrary streams. With type specialization
Estimated hours taken: 25
Branches: main

Implement io.write for arbitrary streams.  With type specialization
this is only slightly slower than the original.

library/stream.string_writer.m:
library/library.m:
	A module containing predicates for writing to streams
	which accept strings.

library/stream.m:
	Move stream.format to stream.string_writer.m.

	Add stream.put_list, which is like io.write_list.

library/io.m:
	Move io.write and io.print to stream.string_writer.m.

library/term_io.m:
	Add stream versions of predicates used by io.write.

library/ops.m:
	Move io.adjust_priority_for_assoc to here (private
	predicate used only by library modules).

	Export ops.mercury_max_priority for use by
	stream.string_writer.write.

Mmake.common.in:
compiler/modules.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/prog_util.m:
compiler/format_call.m:
mdbcomp/prim_data.m:
	Allow sub-modules in the standard library.

compiler/polymorphism.m:
	Fix a bug which caused tests/hard_coded/print_stream.m to
	fail with this change.  The wrong argument type_info would
	be extracted from a typeclass_info if the constraints of the
	typeclass-info were not all variables.

browser/browse.m:
tests/hard_coded/stream_format.m:
tests/hard_coded/test_injection.m:
tests/invalid/string_format_bad.m:
tests/invalid/string_format_unknown.m:
	Updated for predicates moved between library modules.

util/mdemangle.c:
	The demangler doesn't properly handle the arguments MR_DECL_LL*
	and various other recently added macros for type specialized
	procedures.  It's still broken (it doesn't handle mode and label
	suffixes properly), but the output is at least more readable.
2006-12-21 11:11:37 +00:00
Julien Fischer
5f1ecdb283 Fix a typo in the browser help message.
Estimated hours taken: 0
Branches: main

Fix a typo in the browser help message.

browser/browse.m:
	s/flat-prety/flat-pretty/
2006-12-05 03:20:07 +00:00
Julien Fischer
b4c3bb1387 Clean up in unused module imports in the Mercury system detected
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.
2006-12-01 15:04:40 +00:00
Ian MacLarty
3cba42d5cc Use the new stream typeclass in the term_to_xml standard library module.
Estimated hours taken: 5
Branches: main

Use the new stream typeclass in the term_to_xml standard library module.
In the process remove some clutter from the interface by marking as obsolete
the predicates that do not take a stream argument and remove the
"_to_stream" suffix from those predicates that do take a stream
argument.

library/term_to_xml.m:
	Use the stream.writer/3 typeclass where appropriate.

	Make all XML writer predicates require a stream argument
	and remove the "_to_stream" suffix from these predicates.

	Move all deprecated predicates to the end of the interface and
	pragma obsolete them.

	Reword some comments.

	Remove the behaviour of replacing "]]>" with "]]>" in CDATA
	elements, since that behaviour is a bit misleading, because ">"
	has no special meaning in CDATA.  Instead just document that "]]>"
	is not allowed in CDATA elements.

browser/browse.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/xmlable_test.m:
	Conform to the above changes.
2006-10-30 07:20:57 +00:00
Zoltan Somogyi
e21193c283 Rename a bunch of predicates and function symbols to eliminate
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.
2006-10-15 23:26:56 +00:00
Zoltan Somogyi
2ca194ab17 Rename some function symbols and predicates to eliminate a bunch
Estimated hours taken: 3
Branches: main

library/term_to_xml.m:
library/rtti_implementation.m:
	Rename some function symbols and predicates to eliminate a bunch
	of ambiguities.

browser/browse.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/xmlable_test.m:
	Conform to the change above.
2006-09-25 01:56:17 +00:00
Julien Fischer
553fb3f7d9 Use pragma foreign_export' in preference to pragma export' throughout
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.
2006-08-31 11:09:54 +00:00
Julien Fischer
49faf8152a Fix a bunch of typos and some formatting.
Estimated hours taken: 0.5
Branches: main

browser/*.m:
	Fix a bunch of typos and some formatting.
2006-06-06 02:27:16 +00:00
Zoltan Somogyi
dd44e0ef62 Replace the "set" command of mdb with a bunch of commands: the `format',
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.
2006-04-04 07:37:31 +00:00
Zoltan Somogyi
892bf00ce2 XXX: the change to the mdb "set" command is not yet documented; that will be
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.
2006-03-31 05:12:19 +00:00
Julien Fischer
459847a064 Move the univ, maybe, pair and unit types from std_util into their own
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.
2006-03-29 08:09:58 +00:00
Zoltan Somogyi
ef55b420fd Remove from std_util.m the predicates that merely call predicates in
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.
2006-03-22 02:56:44 +00:00
Zoltan Somogyi
7822554732 Replace __ with . as the module qualifier everywhere in all the modules
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.
2006-03-10 06:31:06 +00:00
Ian MacLarty
11042e060c Allow field names to be used in the paths used with subterm dependency
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.
2006-02-08 21:48:36 +00:00
Ian MacLarty
521967f39f Implement a second version of the subterm dependency tracking algorithm
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.
2005-11-02 14:02:16 +00:00
Zoltan Somogyi
d7554de953 Convert a bunch more modules to four-space indentation.
Estimated hours taken: 5
Branches: main

browser/*.m:
compiler/*.m:
mdbcomp/*.m:
	Convert a bunch more modules to four-space indentation.
2005-10-19 05:39:08 +00:00
Zoltan Somogyi
a77588f6d2 Add two new capabilities to the debugger.
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".
2005-07-11 07:30:31 +00:00
Ian MacLarty
b4b2807529 Allow an XML term browser to be called from the declarative debugger.
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.
2005-02-22 22:27:50 +00:00
Zoltan Somogyi
67895b0b65 Fix the current mixture of __ and . to module qualify module names
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.
2005-01-24 07:41:05 +00:00
Ian MacLarty
ba2c9002e4 Add `mode' command to interactive term browser to display the mode of a
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.
2005-01-18 03:56:53 +00:00
Ian MacLarty
c5c53432fb Allow terms to be saved as XML in mdb and allow an XML browser to be invoked on
Estimated hours taken: 5
Branches: main

Allow terms to be saved as XML in mdb and allow an XML browser to be invoked on
browsable objects in mdb.  The user can set two options which control where the
XML is dumped and the command used to browse the XML.  The defaults assume
xsltproc and mozilla are installed.

configure.in
	Check for mozilla/firefox and xsltproc so default the mdb XML browser
	command can be set if they are found.

browser/browse.m
	Add a predicate to save a browser term as XML to a file.

doc/user_guide.texi
	Document new --xml option for the mdb `browse' command.
	Document new --xml option for the mdb `save_to_file' command.
	Document the `set xml_tmp_filename' and `set xml_browser_cmd' commands.

scripts/Mmakefile
	Copy extras/xml_stylesheets/xul_tree.xsl to the mdb install
	directory so it can be used by the default XML browser command.

scripts/mdbrc.in
	Set default values for xml_browser_cmd and xml_tmp_filename.

scripts/xul_tree.xsl
	Copy this stylesheet here so there isn't a dependency on the extras
	directory.

tests/debugger/browser_test.inp
tests/debugger/browser_test.exp
	Test --xml option for `browse' command.

trace/mercury_trace_browse.c
trace/mercury_trace_browse.h
	Add functions to save a term as XML to a file and then
	invoke the user's XML browser.

trace/mercury_trace_internal.c
	Add --xml option to `browse' and `save_to_file' mdb commands and
	handle this option.
2004-12-11 01:59:52 +00:00
Ian MacLarty
d80b69485c Rename "pretty" browser format to "raw_pretty" and "raw_pretty" to "pretty".
Estimated hours taken: 1.5
Branches: main

Rename "pretty" browser format to "raw_pretty" and "raw_pretty" to "pretty".
Make old "pretty" format print function return values.  Remove univ_cons
constructor around old "raw_pretty" function return values.

Add extra note in NEWS about declarative debugger `trust' command.

browser/browse.m
	Rename "raw_pretty" to "pretty" and vica versa.  Use univ value when
	creating doc for return value.

browser/sized_pretty.m
	If a synthetic term has a return value then include it in the doc.

NEWS
	Add note about print format name change.
	Also add note about declarative debugger `trust' command.

tests/debugger/browse_pretty.exp
tests/debugger/browse_pretty.inp
tests/debugger/declarative/browse_arg.exp
tests/debugger/declarative/browse_arg.inp
tests/debugger/declarative/dependency.exp
tests/debugger/declarative/dependency.inp
	Change input and expected output where pretty or raw_pretty formats
	used.

tests/debugger/browser_test.m
tests/debugger/browser_test.exp
tests/debugger/browser_test.inp
	Test printing of function applications.
2004-11-05 06:30:21 +00:00
Ian MacLarty
1974e66710 Make `set' mdb command work from within the declarative debugger.
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.
2004-10-27 02:23:27 +00:00
Ian MacLarty
667d2ba70f Added a `cdr' command to the interactive term browser.
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.
2004-10-25 05:32:23 +00:00
Zoltan Somogyi
d48544ed7f Factor out common code in the handling of plain terms and synthetic terms.
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.
2004-08-09 03:05:23 +00:00
Zoltan Somogyi
ea2c2ebeee Add an mdb command to save a term from the program being debugged to a file.
Estimated hours taken: 3
Branches: main

Add an mdb command to save a term from the program being debugged to a file.

browser/browse.m:
	Provide mechanisms to create browser terms from their components,
	and to save browser terms to a named file.

trace/mercury_trace_browse.[ch]:
	Provide access to these predicates from C code.

trace/mercury_trace_internal.c:
	Implement a new mdb command, save_to_file, which saves a goal,
	exception, procedure body or specified variable to a file.

doc/user_guide.texi:
doc/mdb_categories:
	Document the new mdb command.

trace/mercury_trace_vars.[ch]:
	Factor out the code for constructing the (components of) browser terms
	from goals and variables from the code for browsing the resulting
	terms, to allow them to be used also for saving those terms to a file.

tests/debugger/mdb_command_test.inp:
	Test the documentation of the new command.

tests/debugger/completion.exp:
	Update this test case both for the new command and for the previous one
	I added (var_name_stats).

tests/debugger/browser_test.{m,inp,exp}:
	Extend this test case to also test the behavior of the new command.
2004-05-13 08:50:34 +00:00
Zoltan Somogyi
0942716fe7 Fix a bug that caused a runtime abort if you called the library
Estimated hours taken: 3
Branches: main

runtime/mercury_ml_expand_body.h:
	Fix a bug that caused a runtime abort if you called the library
	function named_argument (which is implemented in this file) on
	a value of a type which has no field name information at all.

browser/browse.m:
	Generate better error messages when an attempt to change to a subterm
	fails: say which step failed, and which ones succeeded.

tests/debugger/field_names.{m,inp,exp}:
	Strengthen the test case to cover types with no field names at all:
	a regression test to check for the bug in mercury_ml_expand_body.h.

	Strengthen the test case using several unsuccessful commands, to test
	the improved error messsages.

tests/debugger/polymorphic_output.exp*:
	Update the expected outputs of this test case to account for the new
	error messages.
2004-04-05 07:18:58 +00:00
Zoltan Somogyi
ff60134ee9 Bring these modules up to our current coding standards.
Estimated hours taken: 8
Branches: main

analysis/analysis.m:
browser/browse.m:
compiler/accumulator.m:
compiler/assertion.m:
compiler/atsort.m:
compiler/c_util.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/code_gen.m:
compiler/code_model.m:
compiler/const_prop.m:
compiler/constraint.m:
compiler/dead_proc_elim.m:
compiler/delay_construct.m:
compiler/dependency_graph.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/export.m:
compiler/fact_table.m:
compiler/follow_code.m:
compiler/graph_colour.m:
compiler/hlds_module.m:
compiler/inlining.m:
compiler/llds.m:
compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
compiler/ml_tailcall.m:
compiler/ml_unify_gen.m:
compiler/mmc_analysis.m:
compiler/mode_errors.m:
compiler/passes_aux.m:
compiler/post_typecheck.m:
compiler/size_prof.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_errors.m:
compiler/transform_llds.m:
compiler/type_util.m:
compiler/unify_gen.m:
compiler/unneeded_code.m:
compiler/unused_args.m:
	Bring these modules up to our current coding standards. Use predmode
	declarations and state variable syntax where relevant. Reorder
	arguments where this is needed for the use state variables. Make the
	orders of predicate definitions correspond to the order of their
	declarations. Replace some overly large lambda expressions with named
	predicates. Convert some predicates to functions where this makes
	their use more convenient. Use field access notation where convenient.
	Fix any inconsistent indentation. Remove module prefixes on predicate
	names where this is necessary to allow sane indentation.

	In several places, use predicates from error_util.m to print error
	messages. Apart from this, there are no changes in algorithms.

	In some places, conform to the changes below.

compiler/error_util.m:
compiler/hlds_error_util.m:
	Add new variants of existing predicates for use in some of the
	changed modules above.

compiler/hlds_out.m:
	Add some functions to convert values of some HLDS types as strings,
	for use in preparing the arguments of the new calls to predicates in
	error_util.m. Change the implementations of the predicates that print
	values of those types to call those functions instead of allowing
	code duplication.

compiler/llds.m:
	Add some field names to allow use of field updates where relevant.

tests/invalid/assert_in_interface.err_exp:
tests/invalid/multisoln_func.err_exp:
tests/invalid/tricky_assert1.err_exp:
	Update the expected outputs of these test cases to allow for them being
	generated by error_util.m, and hence being better formatted than
	before.
2004-04-05 05:07:49 +00:00
Zoltan Somogyi
9045968ade Conform to the convention of importing only one browser module
Estimated hours taken: 0.2
Branches: main

browser/browse.m:
browser/declarative_test.m:
browser/set_cc.m:
	Conform to the convention of importing only one browser module
	per line.
2003-10-27 06:19:09 +00:00
Zoltan Somogyi
bed904e722 Make browsing in the debugger more flexible by adding options to the "ls",
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.
2003-10-13 08:02:18 +00:00
Zoltan Somogyi
3e766fcd11 Print streams sensibly in the debugger.
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.
2003-09-14 22:24:41 +00:00
Zoltan Somogyi
6554ef7daa Replace "is" with "=".
Estimated hours taken: 2
Branches: main

Replace "is" with "=".
Add field names where relevant.
Replace integers with counters where relevant.
2003-05-26 09:01:46 +00:00
Fergus Henderson
1ba1647088 Deprecate io__current_(binary_)?(input|output)_stream,
Estimated hours taken: 1
Branches: main

library/io.m:
	Deprecate io__current_(binary_)?(input|output)_stream,
	because these procedures were identical with the
	procedures named io__(binary_)?(input|output)_stream.

browser/browse.m:
	Use io__output_stream instead of io__current_output_stream.

deep_profiler/mdprof_cgi.m:
	Use io__binary_(in|out)put_stream instead of
	io__current_binary_(in|out)put_stream.

NEWS:
	Mention the changes to library/io.m.
2003-02-24 05:49:31 +00:00
Peter Ross
b177463322 Fix some problems where we were calling the incorrect predicates from
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.
2002-12-03 10:21:17 +00:00
Peter Ross
138f778aca Update to use the new type signature and determinism of
Estimated hours taken: 0.5
Branches: main

browser/browse.m:
	Update to use the new type signature and determinism of
	limited_deconstruct_cc.
2002-12-02 16:27:50 +00:00
Zoltan Somogyi
2040556da6 Make it easier to print and browse I/O actions in the declarative debugger.
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.
2002-11-01 07:45:04 +00:00
Mark Brown
ff53936dbc Print list terms using list syntax when printing in "flat" format.
Estimated hours taken: 3
Branches: main

Print list terms using list syntax when printing in "flat" format.  As
well as the usual functor/arity style abbreviation, list elements can be
replaced by an ellipsis, "...", if beyond the depth or size limit.

browser/browse.m:
	Handle the functors [|]/2 and []/0 specially.

doc/user_guide.texi:
	Be more explicit with the meaning of "depth" and "size".  In
	particular, define what they mean for lists.

tests/debugger/*.exp:
tests/debugger/*.exp2:
tests/debugger/declarative/*.exp:
tests/debugger/declarative/*.exp2:
	Update test outputs to reflect the change.
2002-10-31 08:21:20 +00:00
Mark Brown
2faeb0cf70 Address an XXX question by answering it in the affirmative.
Estimated hours taken: 0.1
Branches: main

browser/browse.m:
	Address an XXX question by answering it in the affirmative.
2002-10-22 16:06:35 +00:00
Mark Brown
2fe0dfa705 Change the declarative debugger so it always prints syntactically
Estimated hours taken: 1.5
Branches: main

Change the declarative debugger so it always prints syntactically
correct goals.

browser/declarative_user.m:
	Print atoms using browse__print_synthetic. This means that goals
	will always be syntactically correct, even if they are printed
	in the multi-line form.

	Make the predicates write_decl{_init,_final,}_atom take an argument
	of type browse_caller_type.  When printing a single goal use the
	caller type "print", and when printing a sequence of goals use
	"print_all".

browser/browse.m:
	When writing out a synthetic term using io__write_univ, check for
	arguments with type util__unbound.  Print such values as a single
	unquoted underscore (io__write_univ would print an underscore in
	single quotes, which means something different).

browser/util.m:
	Export functions is_predicate and is_function to convert values of
	type pred_or_func to values of type bool.

tests/debugger/print_goal.exp:
tests/debugger/queens_rep.exp:
	Update the output of these tests after the change to browse.m.

tests/debugger/declarative/app.exp:
tests/debugger/declarative/app.exp2:
tests/debugger/declarative/filter.exp:
tests/debugger/declarative/filter.exp2:
tests/debugger/declarative/input_term_dep.exp:
tests/debugger/declarative/input_term_dep.exp2:
tests/debugger/declarative/output_term_dep.exp:
tests/debugger/declarative/output_term_dep.exp2:
tests/debugger/declarative/queens.exp:
tests/debugger/declarative/tabled_read_decl.exp:
tests/debugger/declarative/tabled_read_decl.exp2:
	Update the output of these test cases.
2002-10-16 03:15:33 +00:00
Zoltan Somogyi
4951ae07e0 Add a new browser "command", empty, to represent command lines without
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.
2002-07-03 08:25:03 +00:00
Zoltan Somogyi
70b07845f0 Make the commands that update the browser parameters within the browser itself
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.
2002-04-16 13:54:32 +00:00
Zoltan Somogyi
b51c742885 Allow the debugger to print higher order values and typeinfos, mainly by
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.
2002-02-24 11:53:46 +00:00
Zoltan Somogyi
ed83014595 Make the debugger use the committed choice versions of the
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.
2002-01-28 07:20:10 +00:00
Zoltan Somogyi
6b88144d9a Fix a comment.
Estimated hours taken: 0.1
Branches: main

browser/browse.m:
	Fix a comment.
2002-01-17 11:28:54 +00:00
Zoltan Somogyi
e1778fbc75 Give the debugger the ability to print goals.
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.
2002-01-12 09:08:15 +00:00
Zoltan Somogyi
91effad5e7 Fix indentation.
Estimated hours taken: 0.1
Branches: main

browser/browse.m:
	Fix indentation.
2001-12-19 06:50:18 +00:00
Zoltan Somogyi
86744fd357 Allow the browser to refer to fields by 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.
2001-12-19 06:44:51 +00:00