Files
mercury/tests/debugger/declarative/named_fields.exp
Ian MacLarty 11042e060c Allow field names to be used in the paths used with subterm dependency
Estimated hours taken: 5
Branches: main

Allow field names to be used in the paths used with subterm dependency
tracking.

Allow the user to cd to the return value of a function by giving the
number of arguments plus one as an argument to the `cd' command.

browser/browse.m:
	Export the predicate that removed ".." from paths.
	Make the return value of this predicate a subtype, so we can be
	sure the simplification has been applied to the path.

	Allow the user to do `cd N', where N is the number of arguments of
	a function plus one.  This will cd to the return value of the function.

	Add some more aliases for the directory name of the return value of a
	function.

browser/browser_info.m:
	Use the new simplified_dirs inst.
	When converting a list of directories to a term path, look at the
	value the path applies to to resolve field names in the path.

browser/declarative_user.m:
	Report an error if the user tries to track an I/O action.
	Call the new version of convert_dirs_to_term_path which handles
	field names in the path.

browser/term_rep.m:
	Add predicates to lookup a subterm in a term representation and
	also to look up a named field in a term representation.

tests/debugger/declarative/Mercury.options:
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/named_fields.exp:
tests/debugger/declarative/named_fields.inp:
tests/debugger/declarative/named_fields.m:
	Test tracking of subterms using a path with a field name.

tests/debugger/polymorphic_output.exp*
	The output of this test has changed, because cd's to the return value
	of a function, using a number, are now allowed.
2006-02-08 21:48:36 +00:00

102 lines
3.3 KiB
Plaintext

E1: C1 CALL pred named_fields.main/2-0 (det) named_fields.m:11
mdb> mdb> mdb> I/O tabling started.
mdb> echo on
Command echo enabled.
mdb> break swap
0: + stop interface func named_fields.swap/1-0 (det)
mdb> c
E2: C2 CALL func named_fields.swap/1-0 (det) named_fields.m:27 (named_fields.m:13)
mdb> f
E3: C2 EXIT func named_fields.swap/1-0 (det) named_fields.m:27 (named_fields.m:13)
mdb> dd -a
swap(t(1, 2)) = t(2, 1)
Valid? browse
browser> cd 1/field1
browser> ls
1
browser> track
gen_t(t(1, 2))
Valid? info
Context of current question : named_fields.m:23 (named_fields.m:12)
Search mode : top down
The current question was chosen because the marked subterm was bound by
the unification inside the predicate named_fields.gen_t/1
(named_fields.m:23). The path to the subterm in the atom is 1/1.
dd> undo
swap(t(1, 2)) = t(2, 1)
Valid? browse 1
browser> cd field1
browser> ls
1
browser> track
gen_t(t(1, 2))
Valid? info
Context of current question : named_fields.m:23 (named_fields.m:12)
Search mode : top down
The current question was chosen because the marked subterm was bound by
the unification inside the predicate named_fields.gen_t/1
(named_fields.m:23). The path to the subterm in the atom is 1/1.
dd> undo
swap(t(1, 2)) = t(2, 1)
Valid? browse
browser> cd 2/field2
browser> ls
1
browser> track
gen_t(t(1, 2))
Valid? info
Context of current question : named_fields.m:23 (named_fields.m:12)
Search mode : top down
The current question was chosen because the marked subterm was bound by
the unification inside the predicate named_fields.gen_t/1
(named_fields.m:23). The path to the subterm in the atom is 1/1.
dd> undo
swap(t(1, 2)) = t(2, 1)
Valid? browse
browser> cd result/field2
browser> ls
1
browser> track
gen_t(t(1, 2))
Valid? info
Context of current question : named_fields.m:23 (named_fields.m:12)
Search mode : top down
The current question was chosen because the marked subterm was bound by
the unification inside the predicate named_fields.gen_t/1
(named_fields.m:23). The path to the subterm in the atom is 1/1.
dd> undo
swap(t(1, 2)) = t(2, 1)
Valid? browse 2
browser> cd field2
browser> ls
1
browser> track
gen_t(t(1, 2))
Valid? info
Context of current question : named_fields.m:23 (named_fields.m:12)
Search mode : top down
The current question was chosen because the marked subterm was bound by
the unification inside the predicate named_fields.gen_t/1
(named_fields.m:23). The path to the subterm in the atom is 1/1.
dd> undo
swap(t(1, 2)) = t(2, 1)
Valid? browse 2
browser> track field2
gen_t(t(1, 2))
Valid? info
Context of current question : named_fields.m:23 (named_fields.m:12)
Search mode : top down
The current question was chosen because the marked subterm was bound by
the unification inside the predicate named_fields.gen_t/1
(named_fields.m:23). The path to the subterm in the atom is 1/1.
dd> undo
swap(t(1, 2)) = t(2, 1)
Valid? browse 2
browser> track field3
error: cannot track subterm
browser> quit
dd> quit
Diagnosis aborted.
E3: C2 EXIT func named_fields.swap/1-0 (det) named_fields.m:27 (named_fields.m:13)
mdb> quit -y