mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Estimated hours taken: 2
Branches: main
Implement impure functions as attributes of user events.
trace/mercury_event_spec.[ch]:
Allow the representation of such attributes in C code, and add the code
to write out such attributes.
trace/mercury_event_scanner.l:
trace/mercury_event_parser.y:
Implement the scanning and parsing of such attributes.
compiler/prog_event.m:
Modify the type of the terms generated by trace/mercury_event_spec.c
to include a pure/impure indication for function attributes.
Take this into account when generating the types of function
attributes.
Simplify some code by eliminating a redundant lookup in a map.
tests/debugger/synth_attr.{m,exp}:
Convert this line to four-space indentation, and update the expected
output to reflect the vim mode line at the top.
tests/debugger/synth_attr_impure.{m,inp,exp}:
tests/debugger/synth_attr_impure_spec:
New test case (a modified version of the synth_attr test case)
to test the new functionality.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
Enable the new test case.
In the Mmakefile, delete some redundant 2>&1 constructs that were
apparantly created by careless cut-and-paste.
65 lines
2.1 KiB
Plaintext
65 lines
2.1 KiB
Plaintext
E1: C1 CALL pred synth_attr_impure.main/2-0 (cc_multi) synth_attr_impure.m:28
|
|
mdb> echo on
|
|
Command echo enabled.
|
|
mdb> register --quiet
|
|
mdb> user
|
|
E2: C2 USER <safe_test> pred synth_attr_impure.queen/2-0 (nondet) c6; synth_attr_impure.m:44
|
|
mdb> print *
|
|
test_list (attr 0, Out) [1, 2, 3, 4, 5]
|
|
f (attr 1) testlen(10)
|
|
excp (attr 2) univ_cons(software_error("testlen: N < Min"))
|
|
g (attr 3) safe_counter
|
|
seq (attr 4) 0
|
|
Data (arg 1) [1, 2, 3, 4, 5]
|
|
mdb> browse !test_list
|
|
browser> p
|
|
[1, 2, 3, 4, 5]
|
|
browser> ^2^1
|
|
browser> p
|
|
2
|
|
browser> quit
|
|
mdb> user
|
|
E3: C3 USER <nodiag_fail> pred synth_attr_impure.nodiag/3-0 (semidet) s2-2;c4;t;c4; synth_attr_impure.m:105
|
|
mdb> vars
|
|
1 test_failed (attr 0)
|
|
2 arg_b (attr 1, B)
|
|
3 arg_d (attr 2, N)
|
|
4 arg_list_len (attr 3)
|
|
5 sorted_list (attr 4)
|
|
6 list_len_func (attr 5)
|
|
7 list_sort_func (attr 6)
|
|
8 arg_list (attr 7, HeadVar__3)
|
|
9 B (arg 1)
|
|
10 D (arg 2)
|
|
11 HeadVar__3
|
|
12 BmN
|
|
13 L
|
|
14 N
|
|
15 NmB
|
|
mdb> print *
|
|
test_failed (attr 0) "N - B"
|
|
arg_b (attr 1, B) 1
|
|
arg_d (attr 2, N) 2
|
|
arg_list_len (attr 3) 4
|
|
sorted_list (attr 4) [2, 3, 4, 5]
|
|
list_len_func (attr 5) lambda_synth_attr_impure_m_105
|
|
list_sort_func (attr 6) lambda2_synth_attr_impure_m_105
|
|
arg_list (attr 7, HeadVar__3) [2, 3, 4, 5]
|
|
D (arg 2) 1
|
|
BmN -1
|
|
L [3, 4, 5]
|
|
NmB 1
|
|
mdb> print !arg_b
|
|
arg_b (attr 1, B) 1
|
|
mdb> user
|
|
E4: C2 USER <safe_test> pred synth_attr_impure.queen/2-0 (nondet) c6; synth_attr_impure.m:44
|
|
mdb> print *
|
|
test_list (attr 0, Out) [1, 2, 3, 5, 4]
|
|
f (attr 1) testlen(10)
|
|
excp (attr 2) univ_cons(software_error("testlen: N < Min"))
|
|
g (attr 3) safe_counter
|
|
seq (attr 4) 1
|
|
Data (arg 1) [1, 2, 3, 4, 5]
|
|
mdb> continue
|
|
[1, 3, 5, 2, 4]
|