Commit Graph

24 Commits

Author SHA1 Message Date
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
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
Ralph Becket
521af06432 Add a file listing facility to mdb.
Estimated hours taken: 6
Branches: main

Add a file listing facility to mdb.

NEWS:
	Mention the new facility.

browser/listing.m:
	Functionality to search for files and list parts of them.

browser/mdb.m:
	Add listing.m to the browser library.

doc/user_guide.texi:
	Document the `list', `push_list_dir', and `pop_list_dir' commands.

trace/mercury_trace_internal.c:
	Implement the C part of the `list', `push_list_dir', and `pop_list_dir'
	commands
2005-10-24 02:02:17 +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
Zoltan Somogyi
83f8deb354 Add two new command line tools "mslice" and "mdice", which manipulate slices
Estimated hours taken: 24
Branches: main

Add two new command line tools "mslice" and "mdice", which manipulate slices
and dices respectively. The functionality of "mdice" duplicates the
functionality of mdb's current "dice" command, while the functionality of
"mslice" is new.

runtime/mercury_trace_base.[ch]:
	When generating trace count files, include information about the
	context of each execution count. While mdb has access to this
	information in the running program, mslice and mdice do not.
	In any case, the code in mdb for looking up this information was
	terribly inefficient.

	Provide a mechanism for recording all execution counts, even the zero
	ones, for use in coverage testing. This mechanism is not used yet.

	Put a header on trace counts files, to make them recognizable as such.
	Make this header indicate whether we are including zero trace counts.

runtime/mercury_wrapper.c:
	Provide a flag in MERCURY_OPTIONS for turning on recording of
	zero execution counts.

browser/dice.m:
mdbcomp/slice_and_dice.m:
	Move most of the code of browser/dice.m to mdbcomp/slice_and_dice.m,
	much modified; browser/dice.m is now empty. The modifications are
	as follows.

	Factor out the code for reading dices, since dices are useful
	independent of mdb's dice command.

	Generalize the code for computing dices to allow either or both
	of the slices being subtracted to be specified as the union of
	one or more trace counts files.

	Add two more sort conditions for comparing the execution counts
	in two slices: ascending and descending versions of simple execution
	count differences.

	For each operation we have so far performed on dices, add code
	for performing that operation on slices.

browser/mdb.m:
	Delete the include of dice.m, since it is now empty.

	Delete a duplicate include_module of term_rep, and delete the now
	unnecessary include_modules of set_cc and tree234_cc.

mdbcomp/mdbcomp.m:
	Add slice_and_dice.m as a submodule.

mdbcomp/trace_counts.m:
	Provide a mechanism to allow a slice to be specified as coming not
	from a single trace count file but from the union operation on a set
	of trace count files.

	Convert to four-space indentation to eliminate some excessively
	indented lines.

slice/mdice.m:
slice/mslice.m:
	The main modules of two new commands. Their functionality is almost
	entirely in mdbcomp/slice_and_dice.m and mdbcomp/trace_counts.m.

slice/Mmakefile:
	New Mmakefile for building mslice and mdice. It is modelled on
	profiler/Mmakefile.

slice/Mercury.options:
	Empty file, for use in the future.

slice/.nocopyright:
	Don't require copyright notice in Mercury.options.

Mmakefile:
	Process the slice directory at appropriate points when processing
	other directories.

compiler/tupling.m:
	Conform to the updated interface of mdbcomp/trace_counts.

library/list.m:
	Add versions of list__map for some more arities, for use in the code
	above.

trace/mercury_trace_internal.c:
	Generalize the code for specifying dices to allow either or both
	of the slices being subtracted to be specified as the union of
	one or more trace counts files.

	Fix several places where we weren't checking the return value of
	malloc. Fix two places where we could conceivably free strings that
	were still alive. Fix some places where we could pass NULL strings
	to Mercury code, and some places where we could free NULL pointers
	(which, once upon a time, was not guaranteed to work on all platforms).

	Use existing functions such as MR_copy_string where appropriate.

tests/run_one_test:
	Fix two small bugs in this script: make the filenames more user
	friendly, and make sure that gzip isn't asked to overwrite an
	existing file, since that causes it to ask a question on stdout
	and to wait for an answer.

tools/bootcheck:
	Copy or link the slice directory into stage 2. Rename the
	--copy-profiler option as --copy-profilers, since it now copies three
	directories containing performance engineering tools: profiler,
	deep_profiler and slice.
2005-04-29 01:03:29 +00:00
Ian MacLarty
b5550df746 Add mdb `dice' command which reads in a set of passing trace counts and a
Estimated hours taken: 40
Branches: main

Add mdb `dice' command which reads in a set of passing trace counts and a
failing trace count and prints a comparison table.  The table can be sorted
by various metrics and is useful for finding parts of a program executed in
a failing run, but not in passing runs.

browser/dice.m
	Add a new module for generating and manipulating a dice.

browser/mdb.m
	Add the dice module.

compiler/special_pred.m
mdbcomp/prim_data.m
	Move special_pred_name_arity/3 from compiler/special_pred.m to
	mdbcomp/prim_data.m so it can be used in dice.m.

doc/user_guide.texi
	Document the `dice' mdb command.  Also document the fact that the
	failing and passing slice file names can be set with the `set' mdb
	command.

	Move the `set' command to the misc section from the browser section
	since it now also sets the passing and failing slice file names, which
	have nothing to do with the browser.

library/list.m
	Add map4, map5 and map6 since map6 is needed in dice.m.

mdbcomp/program_representation.m
	Add a predicate to convert a goal path to a string.

mdbcomp/trace_counts.m
	Convert string_to_trace_port into a predicate and add a new mode so
	that a port can be converted back to a string.

runtime/mercury_trace_base.h
trace/mercury_trace_util.h
	Move the MR_TRACE_USE_HP and MR_TRACE_CALL_MERCURY macros to
	runtime/mercury_trace_base.h, so that they can be called from
	browser/dice.m.

tests/Mmake.common
	Clean up trace counts (which are generated to test the `dice' command).

tests/debugger/Mmakefile
tests/debugger/dice.exp
tests/debugger/dice.exp2
tests/debugger/dice.inp
tests/debugger/dice.m
tests/debugger/dice.passes
	Test the `dice' command.

trace/mercury_trace_internal.c
	Add the mdb `dice' command and modify the `set' command so the
	`fail_trace_count' and `pass_trace_counts' parameters can be set.

	Add a function to print a dice.

	Move the `set' command to the misc help section.
2005-02-10 04:10:33 +00:00
Zoltan Somogyi
55909bcbaf Implement a new mdb command, "condition", which associates a condition with
Estimated hours taken: 16
Branches: main, release

Implement a new mdb command, "condition", which associates a condition with
an existing breakpoint. The condition is a match between a variable live at
the breakpoint, or a part thereof, and a term provided as part of the condition
command. If execution arrives at the breakpoint but the match doesn't have the
required outcome, execution will continue without stopping.

NEWS:
	Mention the new capability.

doc/user_guide.texi:
	Document the new capability.

runtime/mercury_trace_term.[ch]:
	This new module has facilities for converting strings to a structured
	representation of terms. The debugger uses this representation for the
	term being matched.

runtime/Mmakefile:
	Add the new module to the list of modules in the runtime library.

browser/cterm.m:
	This new module tests whether a value in the program being debugged
	matches a term represented by the data structure defined in
	mercury_trace_term.

browser/mdb.m:
	Include the new module in the browser library.

trace/mercury_trace_spy.[ch]:
	Change the code that checks for breakpoints to check breakpoints'
	conditions.

	Fix an old bug: set the number of the most recent breakpoint
	even when reusing an existing slot.

trace/mercury_trace_vars.c:
	Change the code that checks for breakpoints to also evaluate the
	condition, if any.

	Provide the facilities required to implement conditions. Besides
	exporting some previously private functions, this involved breaking up
	two existing functions into two pieces each, because condition checking
	wanted to reuse only parts of them.

	Modify the implementation of the functions manipulating breakpoints
	to handle the new parts of spy point structures.

	Modify the way we delete spy point structures to make doubly sure
	that we don't free memory twice; it is now MR_delete_spy_point that
	sets the spy_exists field to FALSE, after checking it.

	Give more meaningful names to some variables.

trace/mercury_trace_internal.[ch]:
	Implement the condition command.

	Conform to the changes in mercury_trace_vars.c

	When the condition of a breakpoint cannot be evaluated, print an error
	message.

	Extend the command parser to support double quotes, since this is now
	needed to allow strings in terms in the condition command.

	Flush any error messages resulting from an mdb command immediately
	after the command. This was useful in debugging the change.

tests/debugger/cond.{m,inp,exp*}:
	Add this new test case to test the new capability.

tests/debugger/Mmakefile:
	Include the new test case in the list of test cases.

tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
	Update to reflect the new command.

tests/debugger/cmd_quote.exp:
	Update the error message.
2005-02-01 03:24:32 +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
Julien Fischer
f58b8a4041 The namespace cleanliness check in the browser directory
Estimated hours taken: 1
Branches: main

The namespace cleanliness check in the browser directory
has been failing in the high-level C grades.  This is
because the symbols exported from term_rep did not have
one of the expected prefixes.  Fix this by making term_rep
part of the mdb package.

browser/mdb.m:
browser/term_rep.m:
	Make the term_rep module part of the mdb package.

browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/declarative_user.m:
	Conform to the above change.
2005-01-21 14:54:47 +00:00
Ian MacLarty
732a892fe6 The main changes to the declarative debugger are:
Estimated hours taken: 200
Branches: main

The main changes to the declarative debugger are:

When you mark a subterm (using the term browser from within the DD), the
next question will be about the node that bound that subterm.  If that node is
correct then a binary search will be done between that node and the last
node you asserted was erroneous.

The declarative debugger is now a 3-valued debugger.  This means you can answer
inadmissible if a call's inputs violate some precondition of the call.  The
debugger will also infer a call is inadmissible if you mark one of its inputs
from the browser.

You don't have to give an argument number when invoking the term browser from
within the DD.  If an argument number is omitted then the whole call is
browsed as if it were a data term.

The subterm dependency tracking code now has the ability to track subterms of
closures, including subterms used when creating the closure by currying.
Subterm dependency tracking is also now more reliable when tracing information
is missing.

Lots of stuff in declarative_analyser.m has been redesigned to facilitate
future improvements, such as probabalistic debugging.

browser/declarative_analyser.m
	Transferred the definition of the mercury_edt type class to
	declarative_edt.m.  Added two new search algorithms: one to use
	suspicious subterm information to direct the bug search and one to do
	a binary search on a path in the EDT.

browser/declarative_debugger.m
	Added inadmissible as a truth value for the declarative debugger.
	Added ignore and skip responses.  Ignore responses are used when a
	call is to a trusted predicate.  Ignore tells the analyser that the
	node is not a bug itself, though it may have buggy children.  Skip
	means the oracle has skipped the question.

browser/declarative_edt.m
	Definition of the EDT type class and search_space type.  Search spaces
	are an extra layer on top of the EDT and provide useful services to
	the analyser such as keeping track of which nodes in the EDT might
	contain a bug.  In the future the search space will also be used to
	hold information like the probability that a node is buggy.
	Extended the mercury_edt type class with some useful methods.

browser/declarative_execution.m
	Added some utility predicates to extract information from a proc_id.

browser/declarative_oracle.m
	The oracle now only answers one question at a time.  This makes the
	implementation simpler.  I plan to get the oracle to tell the
	analyser everything it knows, without having to ask the user, whenever
	children are added to the search space, so that maximum information
	is always available to the search algorithms.
	Added a mechanism so the analyser can explicitly request that a
	question be re-asked of the user.
	Made some changes to handle inadmissible calls.

browser/declarative_tree.m
	Can now produce an i_bug as well as an e_bug.
	Made changes to handle dependency tracking of closure arguments.
	There are now two slightly different modes of subterm dependency
	tracking.  A fall-back mode where not all trace information is
	available and a "full" mode that assumes everything has been traced
	(which will be the case if compilation was with a debug grade).  The
	main difference is with higher order calls.  Because the id of the
	pred being called in a higher order call is not (easily) available,
	we can't safely match the HO call up with events on the contour if
	everything is not traced.  If everything is traced, then we can be sure
	the HO call's events will be where we expect them.
	Handled builtin calls which are treated as primitive ops.

browser/declarative_user.m
	User can now browse an entire call, instead of only one argument at
	a time.
	Allowed user to answer inadmissible.

browser/mdb.m
	Added mdb.declarative_edt.

browser/program_representation.m
	Added builtin_call_rep to represent builtin calls.
	Made plain calls to UCI predicates be treated as primitive ops.
	Added function to say if a goal generates internal events directly.
	Added a function to say whether an atomic goal is identifiable (i.e.
	whether we can get from its goal_rep its name, module and arity).

compiler/prog_rep.m
	Now creates builtin_call_rep atomic goal if the plain call was to
	a builtin.

compiler/trace_params.m
	Made minimum tracing for decldebug grade include program
	representations.  This is so the libraries compile with program
	representations, so we can do subterm dependency tracking through
	library calls.
	Trace level decl now includes the program representation.
	The default trace level for decldebug grade now includes the program
	representation.

doc/user_guide.texi
	Updated with new features.

tests/debugger/declarative/Mercury.options
	Removed superflous `--trace rep' options (since this is now implied by
	--trace decl).

tests/debugger/declarative/Mmakefile
	Added new tests.  Also made it possible to specify 3 different inputs:
	one for non-debugging grades, one for debug grades and one for
	decldebug grades.

tests/debugger/declarative/binary_search.exp
tests/debugger/declarative/binary_search.exp2
tests/debugger/declarative/binary_search.inp
tests/debugger/declarative/binary_search.inp2
tests/debugger/declarative/binary_search.m
tests/debugger/declarative/binary_search_1.m
	Test binary search.

tests/debugger/declarative/builtin_call_rep.exp
tests/debugger/declarative/builtin_call_rep.inp
tests/debugger/declarative/builtin_call_rep.m
	Test that builtin_call_rep appears in the program representation
	for builtin calls.

tests/debugger/declarative/catch.exp
tests/debugger/declarative/catch.exp2
tests/debugger/declarative/catch.inp
	Use standardized output.

tests/debugger/declarative/closure_dependency.exp
tests/debugger/declarative/closure_dependency.exp2
tests/debugger/declarative/closure_dependency.inp
tests/debugger/declarative/closure_dependency.inp2
tests/debugger/declarative/closure_dependency.m
	Test dependency tracking through higher order calls.

tests/debugger/declarative/confirm_abort.exp
tests/debugger/declarative/confirm_abort.inp
	If the dd command is typed then the root node is now always asked as
	the first question even if the oracle knows the answer (except where
	the predicate is trusted).  Updated the test to reflect this change.

tests/debugger/declarative/dependency.exp
tests/debugger/declarative/dependency2.exp
	Arguments are now counted from the back (a change to get dependency
	tracking to work with higher order calls), so the debug messages
	printed in this test needed to be changed.

tests/debugger/declarative/explicit_subtree.exp
tests/debugger/declarative/explicit_subtree.exp2
tests/debugger/declarative/explicit_subtree.inp
tests/debugger/declarative/explicit_subtree.inp2
tests/debugger/declarative/explicit_subtree.m
	Test for a bug fixed with this diff.  The bug occured when the subtree
	for an implicit node was generated and then the explicit subtree for
	another implicit node to the left of the generated subtree was
	requested.  When building the new subtree execution proceeded from
	where execution stopped when the previous subtree was generated, so
	execution never passed through nodes to the left of the
	previous subtree and the requested subtree wasn't built.

tests/debugger/declarative/family.exp
tests/debugger/declarative/family.inp
	Some changes to event numbers to do with changes in the way explicit
	subtrees are generated (see comment for
	tests/debugger/declarative/explicit_subtree above).  Also some changes
	to do with the fact that the analyser now only asks the oracle one
	question at a time.

tests/debugger/declarative/find_origin.exp
tests/debugger/declarative/find_origin.exp2
tests/debugger/declarative/find_origin.exp3
tests/debugger/declarative/find_origin.inp
tests/debugger/declarative/find_origin.inp2
tests/debugger/declarative/find_origin.inp3
tests/debugger/declarative/find_origin.m
	Test sub-term dependency tracking.

tests/debugger/declarative/ho5.exp3
	Changes to do with the fact that the standard library is now
	compiled with deep tracing in the decldebug grade.

tests/debugger/declarative/ignore.exp
tests/debugger/declarative/ignore.exp2
tests/debugger/declarative/ignore.inp
tests/debugger/declarative/ignore.inp2
tests/debugger/declarative/ignore.m
tests/debugger/declarative/ignore_1.m
	Test `ignore' oracle response.

tests/debugger/declarative/inadmissible.exp
tests/debugger/declarative/inadmissible.inp
tests/debugger/declarative/inadmissible.m
	Test inadmissibility.

tests/debugger/declarative/input_term_dep.exp
tests/debugger/declarative/input_term_dep.inp
	Some of the bugs found are now inadmissible call bugs, since inputs
	were marked as incorrect.  Also made changes to do with the fact that
	incorrect sub-terms are now followed to where they're bound.

tests/debugger/declarative/lpe_example.exp3
	Added new expected output when in decldebug grade.  Event numbers and
	call depths are different now because of deep tracing in the standard
	library.

tests/debugger/declarative/mismatch_on_call.exp
tests/debugger/declarative/mismatch_on_call.exp2
tests/debugger/declarative/mismatch_on_call.inp
tests/debugger/declarative/mismatch_on_call.m
	This test used to cause an "mismatch on call" exception to be thrown
	by the dependency tracking routine.

tests/debugger/declarative/skip.exp
tests/debugger/declarative/skip.inp
tests/debugger/declarative/skip.m
	Test `skip' oracle response.

tests/debugger/declarative/solutions.exp3
tests/debugger/declarative/solutions.inp3
	Added new input and expected output for decldebug grade.
	Some standard modules need to be trusted since they are now deep traced
	in this grade.

tests/debugger/declarative/special_term_dep.exp
	A bug is now reported as an inadmissible call.

tests/debugger/declarative/throw.exp3
	Because the standard library in decldebug grade is now deep traced
	by default event numbers are different, parent contexts are printed
	and "reached label with no stack layout info" warnings are not
	encountered.

trace/mercury_trace_declarative.c
	Made the depth step size used when deciding which events to put in
	the annotated trace a variable so that it can be dynamically adjusted
	in the future.
	The EDT depth is now calculated independently instead of using
	event_info->MR_call_depth (which is not always consistent with
	the EDT depth).
	When generating an annotated trace for an explicit subtree the
	first event's preceeding event now points to the correct event in the
	existing annotated trace (instead of NULL).  This allows the parent of
	the root of the new explicit subtree to be calculated.
	Made changes so that all the interface events of child calls of a call
	are included in the annotated trace, so that contours are built
	correctly.
2004-11-19 11:54:46 +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
ecdc285bc7 Split the existing browser library into two libraries, by making the
Estimated hours taken: 10
Branches: main

Split the existing browser library into two libraries, by making the
program_representation module into its own library. This is useful because
the compiler refers to program_representation.m, whose code thus needs to be
linked into compiler executables even if the compiler isn't compiled with
debugging enabled. By creating a new library for this module, we avoid any
chance of the linker dragging in the rest of the modules in the browser
library. (This is a problem with an upcoming diff.).

The name of the new library is "mdbcomp", because the intention is that it
contain code that is shared between the debugger and the compiler. This means
mostly the definitions of data structures that the compiler generates for the
debugger, and the predicates that operate on them.

Mmake.common.in:
	Allow MDB_COMP_ as a prefix for symbol names in the browser directory.

Mmake.workspace:
	Add a make variable holding for the name of the new library, and
	add the name to the relevant lists of libraries.

	Avoid duplicating the lists of filenames that need to be updated
	when adding new libraries or changing their names.

Mmakefile:
	Use make variables to refer to library names.

browser/mdbcomp.m:
browser/mer_mdbcomp.m:
	Add these files as the top modules of the new library.

browser/program_representation.m:
	Make program_representation.m a submodule of mdbcomp, not mdb.

browser/program_representation.m:
browser/browser_info.m:
	Move a predicate from program_representation.m to browser_info.m
	to avoid the mdbcomp library depend on the browser library, since
	this would negate the point of the exercise.

browser/mdb.m:
	Delete program_representation.m from the list of submodules.

browser/Mmakefile:
	Update this file to handle the new module.

browser/Mercury.options:
	Mention the new module.

browser/*.m:
	Update the lists of imported modules. Import only one browser module
	per line.

compiler/notes/overall_design.html:
	Document the new library.

compiler/compile_target_code.m:
	Add the mdbcomp library to the list of libraries we need to link with.

compiler/prog_rep.m:
trace/mercury_trace_internal.c:
	Import program_representation.m by its new name.

scripts/c2init.in:
	Centralize knowledge about which files need to be updated when the list
	of libraries changes here.

scripts/c2init.in:
scripts/ml.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/linear:
tools/lml:
	Update the list of libraries programs are linked with.
2003-10-27 06:00:50 +00:00
Zoltan Somogyi
98534c477a Import only one module per line. Fix the format of foreign_procs.
Estimated hours taken: 0.1
Branches: main

browser/mdb.m:
library/library.m:
	Import only one module per line. Fix the format of foreign_procs.
2003-06-10 10:03:31 +00:00
Peter Ross
6f1f7f0083 Add Mercury versions of code which has been defined only as
Estimated hours taken: 1
Branches: main

browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/dl.m:
browser/interactive_query.m:
browser/io_action.m:
browser/mdb.m:
browser/name_mangle.m:
browser/util.m:
	Add Mercury versions of code which has been defined only as
	foreign procs so as to allow this directory to compile for
	the non-C backends.
	The Mercury versions just call private_builtin__sorry.
2003-02-06 13:37:08 +00:00
Mark Brown
fb27d22a8f Implement a committed choice version of the 'set' module, and use this in
Estimated hours taken: 1.5
Branches: main

Implement a committed choice version of the 'set' module, and use this in
the declarative debugging oracle.  This implementation of sets avoids the
use of builtin comparison, which would otherwise cause problems for the
oracle.

This fixes a bug that was causing test case 'ho5' to fail.

browser/set_cc.m:
	The new module.  This is mostly a wrapper around tree234_cc.

browser/mdb.m:
	Make the new module a sub-module of mdb.

browser/declarative_oracle.m:
	Use the new module instead of sets from the standard library.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/ho5.exp:
tests/debugger/declarative/ho5.exp2:
tests/debugger/declarative/ho5.inp:
	Enable this test case, and provide input and expected output.
2002-10-15 07:40:48 +00:00
Mark Brown
f302f534fd Move the code that defines an instance of mercury_edt/2 from
Estimated hours taken: 1
Branches: main

Move the code that defines an instance of mercury_edt/2 from
browser/declarative_debugger.m into a module of its own.  This section
of code is large and reasonably self-contained, so it makes sense for it
to have its own module.  Moreover, declarative_debugger.m contains the
main declarative debugging definitions and the upper levels of code for
the front end, and the mercury_edt/2 instance doesn't fit into either of
these categories.

Add an exception handler to the front end, so that if declarative debugging
fails for whatever reason, the debugging session can at least continue using
the procedural debugger.  Rather than calling error in the front end, throw
exceptions that are of a type specific to the front end (so we know which
errors are ours and which aren't).

browser/declarative_debugger.m:
	Add a new type, diagnoser_exception/0.  Handle these exceptions
	but rethrow any other kind.

browser/declarative_debugger.m:
browser/declarative_tree.m:
	Move the mercury_edt/2 instance to the new module.

browser/mdb.m:
	Add the new module to the mdb library.

browser/declarative_*.m:
	Call throw/1 instead of error/1.

tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/catch.exp:
tests/debugger/declarative/catch.inp:
tests/debugger/declarative/catch.m:
	A test case for debugging code that catches exceptions.  This sort
	of code is still not supported by the front end, but at least we
	now give a decent error message and allow debugging to resume.
2002-09-13 04:17:47 +00:00
Zoltan Somogyi
048f8357cf Until now, programmers could add `tabled_for_io' annotations to foreign_procs
Estimated hours taken: 12
Branches: main

Until now, programmers could add `tabled_for_io' annotations to foreign_procs
that do I/O, which asks the compiler to make those foreign_procs idempotent,
i.e. ensures that they are performed at most once even in the presence of a
retry operation in the debugger. This change adds a compiler option,
--trace-table-io-require, which generates an error if a foreign_proc that does
I/O does not have this annotation. Specifying this option thus ensures
that all I/O done by the program is idempotent.

In the future, we may want to have this option turned on in all debugging
grades. Until we decide about, the new option is not yet documented.

compiler/options.m:
	Add the new option --trace-table-io-require.

compiler/handle_options.m:
	Make --trace-table-io-require imply --trace-table-io.

compiler/table_gen.m:
	If --trace-table-io-require is enabled, require all I/O primitives
	to have the tabled_for_io annotation.

compiler/mercury_compile.m:
	Pass I/O states to table_gen.m, since it can now generate error
	messages.

trace/mercury_trace_util.h:
trace/mercury_trace_vars.c:
	When calling Mercury code from the trace directory, disable I/O
	tabling, since any I/O actions executed by Mercury code in the browser
	directory (or by library code called from there) should not be tabled,
	not being part of the user program.

	Due to the depth of nesting, make mercury_trace_vars.c use four-space
	indentation.

browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
browser/mdb.m:
browser/name_mangle.m:
browser/util.m:
compiler/gcc.m:
compiler/mercury_compile.m:
compiler/passes_aux.m:
compiler/process_util.m:
compiler/stack_layout.m:
library/io.m:
library/time.m:
tests/debugger/declarative/tabled_read_decl.m:
	Add a whole lot of tabled_for_io annotations, to enable the compiler to
	bootstrap with --trace-table-io-require enabled.

	In many cases, this required turning old-style pragma c_code into
	pragma foreign_proc. While doing that, I standardized the layouts
	of pragma foreign_procs.

browser/util.m:
	Turn an impure semidet predicate into a pure det predicate with I/O
	states, to allow it to be tabled. Make it return a Mercury bool
	to indicate success or failure.

library/bool.m:
	Add functions that allow C code to get their hands on the constants
	`yes' and `no', for communication with Mercury code.

library/table_builtin.m:
	Add debugging code to the main primitive of I/O tabling. This is
	controlled both by the macro for retry debugging and a boolean global.

library/mercury_trace_base.[ch]:
	Add the boolean global variable to switch the new debugging code in
	table_builtin.m on and off.

library/mercury_trace_internal.c:
	When starting I/O tabling with retry debug enabled, turn on the switch.

tests/debugger/queens.exp3:
	New expected output file that applies when the library is compiled with
	--trace-table-io-require.
2002-07-22 07:13:14 +00:00
Zoltan Somogyi
985b13ed3f Make I/O actions known to the declarative debugger.
Estimated hours taken: 48
Branches: main

Make I/O actions known to the declarative debugger. The debugger doesn't do
anything with them yet beyond asking about their correctness.

browser/io_action.m:
	New module for representing I/O actions, and for constructing the map
	from I/O action numbers to the actions themselves.

browser/mdb.m:
	Include the new module.

browser/declarative_analysis.m:
	Make the map from I/O action numbers to the actions themselves part
	of the analyzer state, since conversions from annotated trace nodes
	to EDT nodes may now require this information. This information is
	stored in the analyzer state because only the analyser needs this
	information (when converting annotated trace nodes to EDT tree nodes).
	It is not stored in the trace node store because its lifetime is
	different: its contents does not change during a tree deepening
	operation.

browser/declarative_execution.m:
	Store the current value of the I/O action counter with each call and
	exit node. The list of I/O actions associated with the atom of the exit
	node is given by the I/O actions whose counters lie between these two
	values (initial inclusive, final exclusive).

browser/declarative_debugger.m:
browser/declarative_oracle.m:
	Distinguish atoms associated with exit nodes from atoms associated with
	call nodes, since the former, but not the latter, now have a list of
	I/O actions associated with them.

browser/declarative_user.m:
	Add mechanisms for printing and browsing the I/O actions associated
	with EDT nodes and bugs.

runtime/mercury_trace_base.[ch]:
	Move the code for finding an I/O action here from the file
	mercury_trace_declarative.c, for use by browser/io_action.m.

runtime/mercury_layout_util.[ch]:
	Move a utility function here from mercury_trace_declarative.c,
	for use by the code moved to mercury_trace_base.c.

trace/mercury_trace_declarative.c:
	When invoking the front end, pass to it the boundaries of the required
	I/O action map. Cache these boundaries, so we can tell the front end
	when reinvocation of the back end by the front end (to materialize
	previously virtual parts of the annotated trace) does not require
	the reconstruction of the I/O action map.

trace/mercury_trace_vars.[ch]:
	Separate out the code for finding an I/O action from the code for
	browsing it, for use in mercury_trace_declarative.c.

	Note places where the implementation does not live up to the
	documentation.

trace/mercury_trace.[ch]:
	Add a parameter to MR_trace_retry that allows retries to cross I/O
	actions without asking the user if this is OK.

trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
	Pass MR_FALSE as this new parameter to MR_trace_retry.

tests/debugger/declarative/tabled_read_decl.{m,inp,exp}:
	A slightly modified copy of the tests/debugger/tabled_read_decl test
	case, to check the declarative debugger's handling of goals with I/O
	actions.

tests/debugger/declarative/Mmakefile:
	Enable the new test case.
2002-05-15 11:24:21 +00:00
Mark Brown
68ebc7b53a Implement a committed choice version of 234-trees which uses
Estimated hours taken: 10
Branches: main

Implement a committed choice version of 234-trees which uses
compare_representation instead of builtin compare.  Use this to implement
the declarative debugger's oracle knowledge base, instead of the standard
library map.  We do this because the keys used by the oracle may contain
non-canonical terms, which would cause a runtime abort if used as map
keys.

This completes the changes to the declarative debugger to support the
debugging of higher order code.  (There is still a problem in that the
declarative debugger back end does not filter out external events for
higher order calls.  This means that the declarative debugger asks
questions about what are effectively calls to call/N, which is not
necessary since we assume that call/N is correct.  This is a problem
unrelated to this change, so I will deal with it separately.)

browser/tree234_cc.m:
	The new sub-module of mdb, which implements the 234-trees.

browser/declarative_oracle.m:
	Use the new module instead of library/map.m.  Propagate the
	effect of the calls to committed choice code.

browser/mdb.m:
	Include the new module.

tests/debugger/declarative/Mmakefile:
	Enable two old test cases, higher_order and ite_2, that now work
	after this change.  Add a new test case that tests closures
	with some arguments applied.

tests/debugger/declarative/higher_order.exp:
tests/debugger/declarative/higher_order.inp:
tests/debugger/declarative/ite_2.exp:
tests/debugger/declarative/ite_2.inp:
	Provide input and expected output for these tests.

tests/debugger/declarative/ho2.exp:
tests/debugger/declarative/ho2.inp:
tests/debugger/declarative/ho2.m:
	New test case.
2002-05-02 07:44:02 +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
Zoltan Somogyi
1c8cb6faf2 Get the compiler to bootstrap with -DMR_NO_BACKWARDS_COMPAT.
Estimated hours taken: 2

Get the compiler to bootstrap with -DMR_NO_BACKWARDS_COMPAT.

compiler/c_util.m:
compiler/rtti_out.m:
	Add MR_ prefixes to various type names in generated code.

compiler/*.m:
browser/*.m:
library/*.m:
	Add MR_prefixes to various type and function names in pragma C code.

runtime/*.[ch]:
trace/*.[ch]:
	Add MR_prefixes to various type and function names in
	hand-written code.
2000-10-16 01:34:14 +00:00
Zoltan Somogyi
2d6e54ec44 New file to hold the definition of the representation of procedure
Estimated hours taken: 2

browser/program_representation.m:
	New file to hold the definition of the representation of procedure
	bodies to be used by the declarative debugger. This is committed now
	so that Mark can write code to use this data structure while I write
	code to generate it.

browser/mdb.m:
	Mention the new module.
2000-09-01 09:13:46 +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