mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 02:43:40 +00:00
bdabaf5dc94de3b405d11e2db71d34932224b6ff
11 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
33eb3028f5 |
Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
|
||
|
|
dd44e0ef62 |
Replace the "set" command of mdb with a bunch of commands: the `format',
Estimated hours taken: 16
Branches: main, release
Replace the "set" command of mdb with a bunch of commands: the `format',
`format_param', `list_context_lines', `list_path', `xml_browser_cmd',
`xml_tmp_filename', `fail_trace_counts', `pass_trace_counts' and
`max_io_actions' commands. Each of these set just one parameter
or one of set of closely related parameters.
Move all these commands, and some existing commands that set parameters
that were elsewhere, to the "parameter" command category.
Extend some of these commands so that if given no arguments, they report
the current values of the parameters they would otherwise set.
Replace the "set" commands of the mdb browser and of the declarative debugger
with a bunch of commands: "format", "depth", "size", "width", "lines",
"actions" and "params" (the last prints the current value of the parameters).
For each category of mdb commands, create files mercury_trace_cmd_<cat>.[ch],
and move the functions dealing with that category of commands there from
mercury_trace_internal.c. Give each of these new files a logical structure
that was sometimes missing from the relevant parts of mercury_trace_internal.c.
NEWS:
Mention these changes.
doc/mdb_categories:
Document these changes.
doc/user_guide.texi:
Document these changes.
Fix an old documentation bug: you couldn't set listing paramaters
from a declarative debugger command.
Fix an old documentation bug: the description of the goal_path step
for scopes was obsolete.
Fix some obsolete references to : as module qualifier.
browser/parse.m:
Update the browser command set along the lines at the top.
browser/declarative_user.m:
Update the declarative debugger command set along the lines at the top.
Move the declaration for the type representing declarative debugger
commands to near the top of the file.
browser/browser_info.m:
Provide some access predicates.
Update the predicate that generates mdb commands to save the persistent
state of the debugger to generate the new forms of parameter commands.
Move types and predicates for dealing with browser parameters from
browse.m to here, so that declarative_user.m can use them too.
browser/browse.m:
Delete the code moved to browser_info.m, and conform to the other
changes in the other modules.
browser/listing.m:
Provide a predicate to return the type of listing paths.
scripts/mdbrc.in:
Update the commands that set the XML parameters.
scripts/Mmakefile:
Get mmake to rebuild mdbrc from mdbrc.in when mdbrc.in changes.
trace/mercury_trace_internal.c:
trace/mercury_trace_cmds.h:
trace/mercury_trace_cmd_*.[ch]:
Implement the changes described at the top.
Fix an old bug: the commands that update the search path for the "list"
command don't make the search path term permanent, which is needed in
non-conservative-gc grades.
trace/mercury_trace_spy.c:
Fix some obsolete references to : as module qualifier.
trace/mercury_trace_browse.[ch]:
Delete the functionality now moved to mercury_trace_cmd_parameter.c.
tests/debugger/mdb_command_test.inp:
Update the set of commands being tested.
tests/debugger/save.{inp,exp}:
Update the parameter commands in this test case.
|
||
|
|
cab3c62fe7 |
Remove call depth numbers from standardized event printing.
Estimated hours taken: 2 Branches: main Remove call depth numbers from standardized event printing. This will make maintaining the debugger test cases easier since a lot of the expected outputs differ only in the call depth of their events, because of deep tracing of the standard library in the decldebug grade. Not all the debugger tests are run with standardized event printing, so printing of call depths will still be exercised. tests/debugger/breakpoints.exp tests/debugger/breakpoints.exp2 tests/debugger/browser_test.exp tests/debugger/exception_cmd.exp tests/debugger/exception_cmd.exp2 tests/debugger/exception_cmd.exp3 tests/debugger/exception_value.exp tests/debugger/exception_value.exp2 tests/debugger/exception_vars.exp tests/debugger/existential_type_classes.exp tests/debugger/existential_type_classes.exp2 tests/debugger/exported_eqv_type.exp tests/debugger/higher_order.exp tests/debugger/interpreter.exp2 tests/debugger/lambda_expr.exp tests/debugger/loopcheck.exp3 tests/debugger/loopcheck.inp2 tests/debugger/nondet_stack.exp tests/debugger/nondet_stack.exp2 tests/debugger/polymorphic_output.exp tests/debugger/polymorphic_output.exp2 tests/debugger/polymorphic_output.exp3 tests/debugger/print_goal.exp tests/debugger/print_table.exp tests/debugger/queens.exp tests/debugger/queens.exp2 tests/debugger/resume_typeinfos.exp tests/debugger/retry.exp tests/debugger/retry.exp2 tests/debugger/tabled_read.exp tests/debugger/tabled_read_decl.exp tests/debugger/tabled_read_unitize.exp tests/debugger/type_desc_test.exp tests/debugger/declarative/aadebug.exp tests/debugger/declarative/app.exp tests/debugger/declarative/args.exp tests/debugger/declarative/big.exp tests/debugger/declarative/filter.exp tests/debugger/declarative/if_then_else.exp tests/debugger/declarative/input_term_dep.exp tests/debugger/declarative/io_stream_test.exp tests/debugger/declarative/io_stream_test.exp2 tests/debugger/declarative/output_term_dep.exp tests/debugger/declarative/propositional.exp tests/debugger/declarative/remember_modes.exp tests/debugger/declarative/special_term_dep.exp tests/debugger/declarative/tabled_read_decl.exp tests/debugger/declarative/trust.exp Remove call depth numbers from output run with standardized event printing. trace/mercury_trace_internal.c Remove call depth from standardized event printing. |
||
|
|
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. |
||
|
|
a8ffd3680c |
Change the compiler and tools so that .' and not :' is now used as the
Estimated hours taken: 14 Branches: main Change the compiler and tools so that `.' and not `:' is now used as the module separator in all output. Infix `.' now has associativity yfx and priority 10. NEWS: Report the change. configure.in: Amend the test for an up-to-date Mercury compiler to check whether it recognises `.' as a module qualifier. compiler/code_gen.m: compiler/error_util.m: compiler/hlds_out.m: compiler/prog_out.m: compiler/prog_util.m: compiler/rl_exprn.m: compiler/rl_gen.m: compiler/source_file_map.m: compiler/unused_args.m: library/io.m: library/rtti_implementation.m: library/type_desc.m: runtime/mercury_debug.c: runtime/mercury_deconstruct.c: runtime/mercury_stack_trace.c: Change `:' to `.' as module separator for output. compiler/mercury_to_mercury.m: compiler/prog_io_typeclass.m: As above. Fixed a bug where `.' was not being recognised as a module separator. doc/reference_manual.texi: Report the change. library/term_io.m: Ensure that infix `.' is written without surrounding spaces. tests/hard_coded/dot_separator.m: tests/hard_coded/dot_separator.exp: tests/hard_coded/Mmakefile: Test case added. |
||
|
|
5f20c37b7a |
Add a mechanism for standardizing the event and call sequence numbers in
Estimated hours taken: 4 Branches: main Add a mechanism for standardizing the event and call sequence numbers in debugger output. The mechanism is a global flag whose value is set from MERCURY_OPTIONS. It is intended to be used only in our own internal testing. runtime/mercury_trace_base.[ch]: Define the global, MR_standardize_event_details. Move the documentation of several globals from the .c to the .h file, since that is where their users will look. Put those globals in a consistent order. Add functions for standardizing event and call sequence numbers, and use them when printing event details. runtime/mercury_wrapper.c: Set MR_standardize_event_details when given the option -de. runtime/mercury_stack_trace.c: library/exception.m: trace/mercury_trace_internal.m: Respect MR_standardize_event_details. tests/Mmake.common: Define the make variable MDB_STD, which is like MDB except it also puts -de in MERCURY_OPTIONS. tests/debugger/Mmakefile: Use MDB_STD instead of MDB for test cases that can benefit from standardizing event and call sequence numbers. Put the rules for the test cases in alphabetical order. tests/debugger/*.exp*: Update expected outputs after this change. |
||
|
|
5544aed7ff |
Change the list constructor from ./2' to [|]/2'. `./2' will
Estimated hours taken: 3
Branches: main
Change the list constructor from `./2' to `[|]/2'. `./2' will
eventually become the module qualification operator.
library/parser.m:
library/io.m:
library/sparse_bitset.m:
library/std_util.m:
library/term_io.m:
compiler/mercury_to_mercury.m:
compiler/prog_io_dcg.m:
compiler/prog_io_goal.m:
compiler/prog_io_pragma.m:
compiler/prog_io_typeclass.m:
compiler/prog_io_util.m:
browser/interactive_query.m:
extras/moose/grammar.m:
extras/moose/moose.m:
extras/morphine/source/generate_call_site_cov.m:
extras/xml/xml.encoding.m:
samples/muz/higher_order.m:
tests/debugger/declarative/app.m:
tests/dppd/transpose_impl.m:
tests/hard_coded/ground_dd.m:
tests/hard_coded/split_c_files.m:
Change all references to `./2' to use `[|]/2' instead.
compiler/typecheck.m:
Handle `./2' as a special case in `report_error_undef_cons'.
Warn about module list not being imported if `[|]/2' is undefined.
compiler/llds_out.m:
util/mdemangle.c:
profiler/demangle.m:
Add name conversions for `[|]' (f_cons) and `[]' (f_nil).
NEWS:
doc/reference_manual.texi:
w3/tutorial/lists-n-things.m4:
Document the changes.
tests/debugger/{,declarative}/*.exp*:
Update test case results. For some tests the output changed
because they output lists in the non-pretty format. For others,
the output changed because the alphabetical ordering of the
constructors of type `list/1' changed, so the numbering of
the switch branches in the goal paths changed.
|
||
|
|
303c81f3ed |
Fix the test cases involving univ.
Estimated hours taken: 1 Fix the test cases involving univ. |
||
|
|
518e6e46db |
Strip away goal paths from exception events in the test cases that
Estimated hours taken: 0.5
tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
Strip away goal paths from exception events in the test cases that
generate them, because different optimization levels cause different
goals paths to be associated with exceptions.
tests/debugger/*.exp{,2}:
tests/debugger/declarative/*.exp{,2}:
Strip away goal paths from exception events in the expected outputs
of those test cases.
|
||
|
|
fdccd65e30 |
The debugger's retry command at the moment works only from a final port for
Estimated hours taken: 60
The debugger's retry command at the moment works only from a final port for
the call to be retried, the reason being that the RTTI does not have the
information required to make sure that the state of the stacks is reset
correctly. If you invoke retry from a non-final port, the current
implementation skips forward to a final port and then does the retry;
this does not work if you get a core dump or a infinite loop during the forward
skip. This change adds the required info to the RTTI and thus enables
direct retries from the middle of calls.
The information added has two components. First, if a procedure that lives on
the nondet stack allocates any temporary nondet stack frames, then it must
record the old value of maxfr in a stack slot so that retry can restore it.
Second, if a procedure is tabled, then it must record the call table tip node
corresponding to the actual input arguments, so we can reset this node to
uninitialized (if we don't, then the retried call will find the active call
marker and report an infinite loop error).
The support for retries across minimal model calls is not finished yet.
Finding out what the right thing to do in such cases is a research project,
one that cannot even be started until minimal model tabling works reliably
in the *absence* of retries. However, such retries do grossly wrong things
at the moment; this change is a definite improvement. It attempts to perform
the retry from the fail port, since that is the only time when the minimal
model tabling data structures are quiescent. The "fail" command I added to
the debugger command set to let this be done is not complete yet and is
therefore undocumented; the problem is that a call to a model_non predicate
in a committed choice context will not get to the fail port. I added goal paths
to return layouts so that we will eventually be able to tell when execution
leaves a committed choice context surrounding an ancestor of a model_non
predicate call, but this functionality is not yet implemented.
compiler/stack_layout.m:
Generate the three new fields: the evaluation method, (maybe) the id
of the stack slot containing the saved value of maxfr, and (maybe)
the id of the stack slot containing the call table tip.
compiler/continuation_info.m:
Record the information about the new fields for later use by
stack_layout.m.
Add a new field to record the goal path of calls for their return
layouts.
Fix a screwed comment for the continuation_info data structure.
compiler/llds.m:
Add a new field to call() instructions to hold the goal path of the
call.
Add a utility function for use by trace.m.
compiler/call_gen.m:
Fill in this new field.
compiler/trace.m:
compiler/live_vars.m:
Reserve the fixed stack slot for the saved maxfr if necessary,
and if the call table tip node is needed, make sure that the variable
holding its address is allocated a low-numbered stack slot (otherwise,
its number may not fit into the MR_int_least8_t field in the
proc_layout).
compiler/trace.m:
If necessary, fill in the saved maxfr slot.
If necessary, initialize the call table tip slot.
compiler/hlds_goal.m:
Add a goal feature which marks its goal as defining the variable
representing the call table tip node.
Add a field to the goal path step representing quantification;
the field says whether the quantification changes the determinism of
the goal (i.e. whether it cuts away solutions).
compiler/hlds_pred.m:
compiler/hlds_out.m:
Add two fields to proc_infos which (a) record which variable, if any,
holds the call table tip node, and (b) record whether the procedure's
layout structure needs to reserve a slot for the saved value of maxfr.
compiler/table_gen.m:
Put this feature on the appropriate goal.
Also, rename a predicate to make it reflect its purpose better.
compiler/code_gen.m:
Generate code to put the call table tip variable in its stack slot
immediately after it has been generated.
Add a sanity check to ensure that if a procedure that lives on the det
stack can create a temporary nondet frame, and debugging is enabled,
then it did have a stack slot reserved for the saved maxfr.
compiler/code_util.m:
Add a predicate to make a conservative prediction of whether a
procedure may allocate a temporary nondet stack frame. We cannot
just generate the code and see, because the code generator needs to
know which variables live in which stack slots, and we cannot decide
that until we know whether we need a stack slot for the saved value of
maxfr.
Make an unrelated predicate semidet procedure use a det helper, in
order to make it more robust in the face of changes to the HLDS
(e.g. it was missing code for handling bi_implications).
compiler/code_info.m:
Record whether a procedure has in fact created a temporary nondet stack
frame.
compiler/handle_options.m:
Disable hijacks if debugging is enabled. The code we now use to
restore the stacks for direct retries works only if the retry does not
"backtrack" over a hijacked nondet stack frame whose hijack has not
been undone. Note that code compiled without debugging may still hijack
nondet stack frames. Execution may reemerge from the nondebugged region
in one of two ways. If the nondebugged code returns, then it will have
undone hijack, and the retry code will work. If the nondebugged code
calls debugged code, there will be a region on the stacks containing
no debugging information, and the retry command will refuse to perform
retries that go into or beyond this region. Both cases preserve
correctness.
compiler/*.m:
Trivial changes to conform to changes in data structures.
runtime/mercury_stack_layout.h:
Add three new fields to proc layouts: the numbers of the stack slots
(if any) storing the saved maxfr and the call table tip, and a
representation of the procedure's evaluation method.
runtime/mercury_stack_trace.[ch]:
Now that return layouts contain goal paths, print them in stack dumps
only if the include_trace_data flag is set (in mdb, this requires the
-d flag of the "stack" command).
Pass this flag around directly, instead of encoding its value in
the NULL vs non-NULL values of sp and curfr.
runtime/mercury_regorder.h:
Provide a mechanism to access the values of the first few rN registers
from a save area, for use in debugging low-level C code in the runtime
and the trace directories.
trace/mercury_trace.[ch]:
Reimplement MR_trace_retry to allow retries from the middle.
If the stack segment being retried over contains minimal model
procedures, we must still arrange to skip to the end of the retried
call. If this call is a minimal model generator, skipping to just any
final port is not sufficient to guarantee correctness on retry; to
ensure that subgoal is complete, we must skip to a fail port.
trace/mercury_trace.[ch]:
trace/mercury_trace_internal.c:
Implement a debugger command, "fail", which skips to the fail port or
the exception port of the specified ancestor. Since procedures that are
not model_non are not guaranteed to get to such a port, this
command reports an error if the specified call is not model_non.
Actually, even calls to model_non procedures may not get to the fail
port, as explained above; this is why the command is not yet
documented.
trace/mercury_trace.c:
trace/mercury_trace_util.[ch]:
Move some functions to print parts of the Mercury abstract machine
state from mercury_trace to mercury_trace_util, so that they are
available for use in debugging e.g. mercury_trace_declarative.
trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
trace/mercury_trace_declarative.c:
Use the new implementation of retries. At the moment, only the
internal debugger implements the full functionality. The declarative
debugger issues retry commands only from situations where the missing
functionality is not (yet) needed. The external debugger should
continue to work correctly, but Erwan may wish to update it to
exploit the availability of the fail command.
trace/mercury_trace*.[ch]:
Fix MR_prefixes, and a signed/unsigned mismatch.
doc/user_guide.texi:
Document the new "fail" command, but comment it out for now.
tests/debugger/retry.{m,inp,exp,exp2}:
A new test case for exercising retry.
tests/debugger/Mmakefile:
Enable the new test case.
tests/debugger/*.exp:
Update the expected output, given the extra info now output e.g. for
exception events and detailed stack traces.
|
||
|
|
8cfbaedc5a |
Allow the value of an exception to be printed and browsed
Estimated hours taken: 5 Allow the value of an exception to be printed and browsed at EXCP events in the internal debugger. Two new commands are added to the debugger: print exception browse exception trace/mercury_trace_internal.c: Implement the new commands. runtime/mercury_trace_base.c: runtime/mercury_trace_base.h: Export functions to get/set a global which stores the value of an exception for the internal debugger to refer to. library/exception.m: Set the exception value before generating EXCP events. doc/user_guide.texi: Document the new debugger commands. tests/debugger/Mmakefile: tests/debugger/exception_value.m: tests/debugger/exception_value.inp: tests/debugger/exception_value.exp: tests/debugger/exception_value.exp2: Add a test case. |