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.
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.