mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-14 13:23:53 +00:00
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.
This commit is contained in:
@@ -49,34 +49,42 @@
|
||||
% The string representation of the functor that these predicates
|
||||
% return is:
|
||||
%
|
||||
% - for user defined types, the functor that is given
|
||||
% in the type definition. For lists, this
|
||||
% means the functors [|]/2 and []/0 are used, even if
|
||||
% the list uses the [....] shorthand.
|
||||
% For types with user-defined equality, the functor will be
|
||||
% a constant of the form <<module:type/arity>>/0 except
|
||||
% with include_details_cc.
|
||||
% - for integers, the string is a base 10 number,
|
||||
% - for user defined types with standard equality, the functor
|
||||
% that is given in the type definition. For lists, this means
|
||||
% the functors [|]/2 and []/0 are used, even if the list uses
|
||||
% the [....] shorthand.
|
||||
% - for user-defined types with user-defined equality, the
|
||||
% functor will be of the form <<module:type/arity>>/0, except
|
||||
% with include_details_cc, in which case the type will be
|
||||
% handled as if it had standard equality.
|
||||
% - for integers, the string is a base 10 number;
|
||||
% positive integers have no sign.
|
||||
% - for floats, the string is a floating point,
|
||||
% base 10 number, positive floating point numbers have
|
||||
% no sign.
|
||||
% - for floats, the string is a floating point, base 10 number;
|
||||
% positive floating point numbers have no sign.
|
||||
% - for strings, the string, inside double quotation marks
|
||||
% - for characters, the character inside single quotation marks
|
||||
% - for predicates, the string <<predicate>>
|
||||
% - for functions, the string <<function>>
|
||||
% - for tuples, the string {}
|
||||
% - for arrays, the string <<array>>
|
||||
% - for predicates, the string <<predicate>>, and for functions,
|
||||
% the string <<function>>, except with include_details_cc,
|
||||
% in which case it will be the predicate or function name.
|
||||
% (The predicate or function name will be artificial for
|
||||
% predicate and function values created by lambda expressions.)
|
||||
% - for tuples, the string {}.
|
||||
% - for arrays, the string <<array>>.
|
||||
%
|
||||
% The arity that these predicates return is:
|
||||
%
|
||||
% - for user defined types, the arity of the functor.
|
||||
% - for user defined types with standard equality, the arity
|
||||
% of the functor.
|
||||
% - for user defined types with user-defined equality, zero,
|
||||
% except with include_details_cc, in which case the type
|
||||
% will be handled as if it had standard equality.
|
||||
% - for integers, zero.
|
||||
% - for floats, zero.
|
||||
% - for strings, zero.
|
||||
% - for characters, zero.
|
||||
% - for predicates and functions, zero; we do not return the
|
||||
% number of arguments expected by the predicate or function.
|
||||
% - for predicates and functions, zero, except with
|
||||
% include_details_cc, in which case it will be the number of
|
||||
% arguments hidden in the closure.
|
||||
% - for tuples, the number of elements in the tuple.
|
||||
% - for arrays, the number of elements in the array.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user