mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-11 11:53:51 +00:00
Estimated hours taken: 12
Branches: main
Fix a bug in the handling of I/O actions by the debugger: the procedural
debugger didn't implement the documented commands for printing I/O actions.
Also implement some new variants of the print commands to make it easier
to print I/O actions.
Also track down and pinpoint a bug that caused the declarative debugger
to ask questions from *outside* the tree it was asked to debug, as shown
by this example from a new test case compiled in a decldebug grade (so that
the library, and thus io.read, gets compiled with deep, not shallow tracing):
-----------------------------------------------------------------------------
mdb ./io_read_bug
1: 1 1 CALL pred io_read_bug.main/2-0 (cc_multi) io_read_bug.m:22
I/O tabling started.
mdb> g 4
Please input the number of queens and a period:
4: 3 2 CALL pred io.read/3-0 (det) io.m:4240 (io_read_bug.m:24)
mdb> f
5.
513: 3 2 EXIT pred io.read/3-0 (det) io.m:4240 (io_read_bug.m:24)
mdb> dd
[1, 3, 5, 2, 4]
main(_, _)
31 tabled IO actions: too many to show
Valid?
-----------------------------------------------------------------------------
browser/declarative_tree.m:
Put an XXX at the spot of the second bug.
browser/declarative_analyser.m:
browser/declarative_debugger.m:
Change the formatting of some code to give consistent and more
meaningful names to some arguments, and to make switches easier
to read. There are no algorithmic changes.
runtime/mercury_trace_base.[ch]:
Move the code for disabling/enabling deep profiling to the code that
does disabling/enabling of I/O actions, to put all relevant actions
for entering and leaving Mercury code together.
Note the similarity of MR_turn_debug_off/MR_turn_debug_back_on
with MR_TRACE_CALL_MERCURY, and make the similarity even greater
by adding the code for disabling/enabling deep profiling to
MR_TRACE_CALL_MERCURY (without which the deep profiler data structures
would have been screwed up by the declarative debugger).
Add a const qualifier to an argument.
trace/mercury_trace_cmd_browsing.c:
Fix the first bug: update the code of the "print" and "browse" mdb
commands to implement their documented capabilities with respect to
printing I/O actions.
Add a new capability: "print io" (or "print action") will now print
a bunch of I/O actions, starting with the first available one, and on
successive invocations will print successive bunches. This is an easy
way to print all I/O actions (without being overwhelmed by a huge
printout if there are too many).
Add a new capability: "print io limits" will now print the numbers of
the first and last I/O actions.
doc/user_guide.texi:
Document the new capabilities.
trace/mercury_trace_declarative.c:
Fix the second bug: disable debugging and then restore the old state
around calls to Mercury code from the declarative debugger.
My guess is that the bug was introduced when we gave declarative
debugging its own trace function; the one it used to share with
the procedural debugger still does the same disable/restore pair.
trace/mercury_trace_internal.c:
Delete the code now moved to mercury_trace_base.c.
trace/mercury_trace_util.[ch]:
Add a utility function for use by the new code in
mercury_trace_cmd_browsing.c, and increase robustness by more
precise representation of unsigned values.
trace/mercury_trace_cmd_dd.c:
Cosmetic fixes.
tests/debugger/declarative/tabled_read_decl.m:
Update this test case to our current coding standards. There are no
changes in the code.
tests/debugger/declarative/tabled_read_decl.{inp,out}:
Test the bug fixes by printing out a bunch of I/O actions.
tests/debugger/declarative/builtin_call_rep.exp:
Update this expected output file to conform for my recent change to
procedure representations.
tests/debugger/declarative/io_read_bug.{m,inp,exp}:
A new test case that exposes the second bug above. The .inp file
exposes the bug; the .exp file is a dummy.
tests/debugger/declarative/Mmakefile:
Add the new test case, but don't enable it yet.
tests/debugger/print_io_actions.{m,inp,exp,data}:
A new test case to test the new "print io" variant of the print
command.
tests/debugger/Mmakefile:
tests/debugger/Mercury.options:
Enable the new test case.
tests/EXPECT_FAIL_TESTS.asm_fast.gc.decldebug:
Expect the big_array_from_list test to fail in decldebug grades,
since we in that grade we can never get tail recursion, even in the
standard library.
2 lines
31 B
Plaintext
2 lines
31 B
Plaintext
hard_coded/big_array_from_list
|