mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-24 05:43:53 +00:00
Estimated hours taken: 3 Record the trace level that the module was compiled with in the module layout structure. Use this to avoid an abort if the 'dd' command is used on a module that is compiled with trace level 'deep'. compiler/trace_params.m: Encode the trace level as an integer. runtime/mercury_stack_layout.h: Add a field to MR_Module_Layout to store the encoded trace level. compiler/stack_layout.m: Fill in this field. trace/mercury_trace_declarative.c: Ignore events from modules that don't have an appropriate trace level. This effectively assumes that the events are correct, so we warn the user that this has happened. Also, disallow the 'dd' command at these events. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/deep_sub.m: tests/debugger/declarative/deep_warning.exp: tests/debugger/declarative/deep_warning.inp: tests/debugger/declarative/deep_warning.m: A test case for the new feature.
45 lines
574 B
Mathematica
45 lines
574 B
Mathematica
:- module deep_warning.
|
|
:- interface.
|
|
:- import_module io.
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
:- implementation.
|
|
:- import_module int, deep_sub.
|
|
|
|
main -->
|
|
(
|
|
{ p(1, X) },
|
|
{ X > 10 }
|
|
->
|
|
io__write_string("yes\n")
|
|
;
|
|
io__write_string("no\n")
|
|
),
|
|
(
|
|
{ p(2, Y) },
|
|
{ Y > 10 }
|
|
->
|
|
io__write_string("yes\n")
|
|
;
|
|
io__write_string("no\n")
|
|
).
|
|
|
|
:- pred p(int::in, int::out) is nondet.
|
|
|
|
p(1, X) :-
|
|
deep_sub__q(X).
|
|
|
|
p(2, X) :-
|
|
deep_sub__q(X),
|
|
r(X, Y),
|
|
s(Y).
|
|
|
|
:- pred r(int::in, int::out) is det.
|
|
|
|
r(X, X).
|
|
|
|
:- pred s(int::out) is multi.
|
|
|
|
s(2).
|
|
s(3).
|
|
|