Commit Graph

18 Commits

Author SHA1 Message Date
Zoltan Somogyi
e7c86a2342 Conform to the convention of importing only one browser module per
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.
2003-10-27 06:24:43 +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
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
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
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
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
Zoltan Somogyi
56f280dc85 s/SICstus/SICStus/
Estimated hours taken: 0.1
Branches: main

browser/parse.m:
	s/SICstus/SICStus/
2001-12-17 06:14:46 +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
Mark Brown
7d66a930c7 Allow multiple browser commands on one line, separated by semicolons.
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.
2000-08-26 04:34:36 +00:00
Mark Brown
ff589ad0f6 Fix a bug in the term browser: the term size limit was by default
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.
2000-05-11 07:44:34 +00:00
Simon Taylor
9ba3b14098 Make all the modules in the browser library sub-modules of
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.
2000-02-04 03:45:53 +00:00
Mark Brown
07cad7c169 If calling from the internal debugger, use readline input for the
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.
1999-05-30 03:55:13 +00:00
Erwan Jahier
045aa58368 Incorporate the term brower stuff in the external debugger.
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.
1999-05-21 14:38:21 +00:00
Mark Brown
2bbf02daaf Use the same method of input for the browser as for the internal
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.
1999-05-14 02:25:53 +00:00
Fergus Henderson
f0d99a5afd Add a couple of comments.
Estimated hours taken: 0.25

browser/parse.m:
browser/frame.m:
	Add a couple of comments.
1999-03-10 20:20:09 +00:00
Bert Thompson
eee1996975 Add a simple term browser for use by the trace-based debugger.
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)
1998-10-25 07:16:41 +00:00