Commit Graph

8 Commits

Author SHA1 Message Date
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
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
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
Mark Brown
383dab9228 Avoid the term "Flag" as a variable name, since in this context
Estimated hours taken: 0.5
Branches: main

browser/sized_pretty.m:
	Avoid the term "Flag" as a variable name, since in this context
	it is inaccurate and uninformative.

	Clarify the comment for the measured_split typeclass method.
2001-06-26 06:16:22 +00:00
Mark Brown
e3b8c0be98 Shorten dividing lines of the form '%---- ... ----%' so they
Estimated hours taken: 0.1
Branches: main

browser/sized_pretty.m:
	Shorten dividing lines of the form '%---- ... ----%' so they
	don't wrap around in diffs (or replies to diffs).
2001-06-26 05:31:06 +00:00
Mark Brown
c1379421ba Make mdb's term browser use limited_deconstruct/5 instead of deconstruct/4,
Estimated hours taken: 4
Branches: main

Make mdb's term browser use limited_deconstruct/5 instead of deconstruct/4,
to avoid performance problems with large arrays.

browser/sized_pretty.m:
	Add a new function, maximum_functors, to the measure_with_params
	typeclass.  This calculates an upper bound for the number of
	functors that could be displayed within the given measurement.
	Implement this function for each of the typeclass instances.

	In the first pass, use this new function to calculate the limit for
	limited_deconstruct.  If this predicate fails, then the term is
	flagged as 'not_deconstructed'.  This means we won't attempt to
	deconstruct the term in the second pass, either.

	Replace deconstruct/4 with functor/3 in cases where the
	arguments are not required.

	Remove flag_with, which adds the same flag to each of a list of
	arguments.  Instead, pass the flag itself to
	annotate_args_with_size, which was the only predicate to use the
	arguments flagged in this way.

	Remove annotate_args_with_zero_size, since it is not used.
2001-06-26 05:22:50 +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