Commit Graph

9 Commits

Author SHA1 Message Date
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
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
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
Mark Brown
d30c239986 Set the pretty printing flags (which represent Mercury bools) using
Estimated hours taken: 0.5
Branches: main

trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_internal.c:
	Set the pretty printing flags (which represent Mercury bools) using
	functions exported from Mercury code, rather than using TRUE and
	FALSE.  This removes the assumption that Mercury bools have the
	same representation as C bools, which was causing a problem when
	--reserve-tag was used.

	Change the type of these flags to MR_Word.  According to the
	reference manual, this is the type Mercury bools have when passed
	to C code.

browser/browser_info.m:
	Export functions that construct Mercury bools.
2001-05-29 17:24:03 +00:00
Mark Brown
75a2a90cbb This is the second part of a change to support term dependency analysis
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.
2001-04-23 16:26:38 +00:00
Sarvamanan Thurairatnam
35b80dcc98 Added a new pretty printing format to the term browser.
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.
2001-02-23 04:15:24 +00:00
Mark Brown
6cd413a850 Enhance the configuration parameters of the browser.
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.
2000-10-27 08:38:58 +00:00