Files
mercury/tests/debugger/breakpoints.exp2
Zoltan Somogyi 0d6c3c9fdf Satisfy a request by Peter Ross: give mdb users the ability to specify
Estimated hours taken: 8
Branches: main

Satisfy a request by Peter Ross: give mdb users the ability to specify
exactly which events inside a procedure they want to put breakpoints on.
Amongst other things, this can make checking postconditions easier:
you can now put a conditional breakpoint on only the exit event.

runtime/mercury_stack_layout.h:
	Add to the exec trace part of proc layouts fields describing an array
	of the label layouts describing the events of the procedure. This is
	the most direct way to implement the new functionality. (In theory,
	we could search the data structures that map file names and line
	numbers to label layouts, but that would be complex, inefficient,
	and *error prone*.)

	To make room for the new fields, and to prepare for making the
	procedure body available to the deep profiler as well (which could
	use it to map execution frequencies of calls back to their location
	in the procedure body, and thus to things like the frequencies with
	which various switch arms are selected), move the procedure body
	of the execution-trace-specific part of the proc layout, and to
	where the deep profiler could in the future also get at it.

runtime/mercury_goto.h:
	Add macros for declaring more than one label layout structure at a
	time.

compiler/layout.m:
	Implement the changes in mercury_stack_layout.h in the compiler's
	data structures as well.

compiler/stack_layout.m:
	Conform to the changes in mercury_stack_layout.h.

	Turn some tuples into named types.

compiler/layout_out.m:
	Conform to the changes in mercury_stack_layout.h.

	Add a mechanism to declare the label layouts in the new array before
	referring to them, by generalizing some existing code. Make this code
	require that the label layouts we refer to via the macros in
	mercury_goto.h match the declarations generated by those macros,
	i.e. that they have information about variables (if debugging is
	enabled, they will).

compiler/opt_debug.m:
	Conform to the change to layout.m.

compiler/prog_rep.m:
	Make a predicate name more expressive.

trace/mercury_trace_cmd_breakpoint.c:
	Implement the new way of using the "break" command, which is
	to add a port name after the procedure specification.

	Register procedures at the start of the function implementing
	the "break" command, instead of "on demand", since all alternatives
	eventually do demand it.

	Write ambiguity reports wholly to mdb's stdout, instead of partially to
	stderr and partially to stdout.

trace/mercury_trace_spy.c:
	Print the port and the goal path for breakpoints on specific events.

	Make the invocation conditions left-aligned, not right-aligned.

doc/user_guide.texi:
	Document the new way of using the "break" command.

NEWS:
	Announce the new capability.

tests/queens.{inp,exp,exp2}:
	Add tests of the new capability.

tests/breakpoints.{exp,exp}:
tests/lval_desc_array.{exp,exp2}:
	Expect the new alignment of invocation conditions.
2007-06-12 06:06:35 +00:00

266 lines
11 KiB
Plaintext

E1: C1 CALL pred breakpoints.main/2-0 (cc_multi) breakpoints.m:24
mdb> echo on
Command echo enabled.
mdb> register --quiet
mdb> break data
Ambiguous procedure specification. The matches are:
0: pred breakpoints.data/1-0 (det)
1: func breakpoints.data/0-0 (det)
Which do you want to put a breakpoint on (0-1 or *)? *
0: + stop interface pred breakpoints.data/1-0 (det)
1: + stop interface func breakpoints.data/0-0 (det)
mdb> delete 0
0: E stop interface pred breakpoints.data/1-0 (det)
mdb> delete 1
1: E stop interface func breakpoints.data/0-0 (det)
mdb> break data
Ambiguous procedure specification. The matches are:
0: pred breakpoints.data/1-0 (det)
1: func breakpoints.data/0-0 (det)
Which do you want to put a breakpoint on (0-1 or *)? 0
0: + stop interface pred breakpoints.data/1-0 (det)
mdb> continue
E2: C2 CALL pred breakpoints.data/1-0 (det) breakpoints.m:58 (breakpoints.m:56)
mdb> disable 0
0: - stop interface pred breakpoints.data/1-0 (det)
mdb> break info
0: - stop interface pred breakpoints.data/1-0 (det)
mdb> break qperm
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
mdb> break safe
2: + stop interface pred breakpoints.safe/1-0 (semidet)
mdb> break -e qperm
3: + stop entry pred breakpoints.qperm/2-0 (nondet)
mdb> break -a qperm
4: + stop all pred breakpoints.qperm/2-0 (nondet)
mdb> break /
Ambiguous procedure specification. The matches are:
0: func breakpoints.//2-0 (det)
1: func breakpoints.print_list.//2-0 (det)
2: func dir.//2-0 (det)
3: func float.//2-0 (det)
4: func int.//2-0 (det)
5: func rational.//2-0 (det)
Which do you want to put a breakpoint on (0-5 or *)? 0
5: + stop interface func breakpoints.//2-0 (det)
mdb> break //2
Ambiguous procedure specification. The matches are:
0: func breakpoints.//2-0 (det)
1: func breakpoints.print_list.//2-0 (det)
2: func dir.//2-0 (det)
3: func float.//2-0 (det)
4: func int.//2-0 (det)
5: func rational.//2-0 (det)
Which do you want to put a breakpoint on (0-5 or *)? 0
6: + stop interface func breakpoints.//2-0 (det)
mdb> break breakpoints.print_list.-/2
7: + stop interface func breakpoints.print_list.-/2-0 (det)
mdb> break breakpoints.print_list.--0
8: + stop interface func breakpoints.print_list.-/2-0 (det)
mdb> break breakpoints__print_list__/-0
9: + stop interface func breakpoints.print_list.//2-0 (det)
mdb> break breakpoints__print_list__print_list
10: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> break breakpoints.print_list.print_list/3
11: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> break info
0: - stop interface pred breakpoints.data/1-0 (det)
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
2: + stop interface pred breakpoints.safe/1-0 (semidet)
3: + stop entry pred breakpoints.qperm/2-0 (nondet)
4: + stop all pred breakpoints.qperm/2-0 (nondet)
5: + stop interface func breakpoints.//2-0 (det)
6: + stop interface func breakpoints.//2-0 (det)
7: + stop interface func breakpoints.print_list.-/2-0 (det)
8: + stop interface func breakpoints.print_list.-/2-0 (det)
9: + stop interface func breakpoints.print_list.//2-0 (det)
10: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
11: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> delete 0
0: D stop interface pred breakpoints.data/1-0 (det)
mdb> break info
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
2: + stop interface pred breakpoints.safe/1-0 (semidet)
3: + stop entry pred breakpoints.qperm/2-0 (nondet)
4: + stop all pred breakpoints.qperm/2-0 (nondet)
5: + stop interface func breakpoints.//2-0 (det)
6: + stop interface func breakpoints.//2-0 (det)
7: + stop interface func breakpoints.print_list.-/2-0 (det)
8: + stop interface func breakpoints.print_list.-/2-0 (det)
9: + stop interface func breakpoints.print_list.//2-0 (det)
10: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
11: + stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> disable 3
3: - stop entry pred breakpoints.qperm/2-0 (nondet)
mdb> break nodiag
0: + stop interface pred breakpoints.nodiag/3-0 (semidet)
mdb> break_print -v -n -b1 HeadVar__1 HeadVar__2
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
HeadVar__1 (verbose, nowarn), HeadVar__2 (verbose, nowarn)
mdb> continue
E3: C3 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:61)
HeadVar__1
[|]
1-1
2-[|]
1-2
2-[|]
1-3
2-[|]/2
mdb> break_print -b1 none
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
mdb> format_param -p depth 10
mdb> format_param -p size 20
mdb> break_print -p -n -b1 HeadVar__1 HeadVar__2
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
HeadVar__1 (pretty, nowarn), HeadVar__2 (pretty, nowarn)
mdb> continue
E4: C3 SWTC pred breakpoints.qperm/2-0 (nondet) s2-2; breakpoints.m:65
mdb> finish -N
E5: C4 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
HeadVar__1
[2, 3, 4, 5]
mdb> finish -n
E6: C4 EXIT pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
HeadVar__1
[2, 3, 4, 5]
HeadVar__2
[2, 3, 4, 5]
mdb> break_print -b1 none
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
mdb> break_print -f -n -b1 HeadVar__1
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
HeadVar__1 (flat, nowarn)
mdb> break_print -f -e -n -b1 HeadVar__2
1: + stop interface pred breakpoints.qperm/2-0 (nondet)
HeadVar__1 (flat, nowarn), HeadVar__2 (flat, nowarn)
mdb> continue
E7: C3 EXIT pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:61)
HeadVar__1 [1, 2, 3, 4, 5]
HeadVar__2 [1, 2, 3, 4, 5]
mdb> continue
E8: C5 CALL pred breakpoints.safe/1-0 (semidet) breakpoints.m:74 (breakpoints.m:62)
mdb> finish
E9: C6 CALL pred breakpoints.nodiag/3-0 (semidet) breakpoints.m:79 (breakpoints.m:76)
E10: C6 FAIL pred breakpoints.nodiag/3-0 (semidet) breakpoints.m:79 (breakpoints.m:76)
E11: C5 FAIL pred breakpoints.safe/1-0 (semidet) breakpoints.m:74 (breakpoints.m:62)
mdb> delete *
0: E stop interface pred breakpoints.nodiag/3-0 (semidet)
1: E stop interface pred breakpoints.qperm/2-0 (nondet)
2: E stop interface pred breakpoints.safe/1-0 (semidet)
3: D stop entry pred breakpoints.qperm/2-0 (nondet)
4: E stop all pred breakpoints.qperm/2-0 (nondet)
5: E stop interface func breakpoints.//2-0 (det)
6: E stop interface func breakpoints.//2-0 (det)
7: E stop interface func breakpoints.print_list.-/2-0 (det)
8: E stop interface func breakpoints.print_list.-/2-0 (det)
9: E stop interface func breakpoints.print_list.//2-0 (det)
10: E stop interface pred breakpoints.print_list.print_list/3-0 (det)
11: E stop interface pred breakpoints.print_list.print_list/3-0 (det)
mdb> break info
There are no break points.
mdb> delete *
There are no break points.
mdb> break -i -I3 qperm
0: + stop interface pred breakpoints.qperm/2-0 (nondet)
(ignore next 3 interface events)
mdb> continue
E12: C7 REDO pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
mdb> print *
HeadVar__1 [4, 5]
mdb> ignore -E4 0
0: + stop interface pred breakpoints.qperm/2-0 (nondet)
(ignore next 4 call events)
mdb> continue
E13: C8 CALL pred breakpoints.qperm/2-0 (nondet) breakpoints.m:64 (breakpoints.m:68)
mdb> print *
HeadVar__1 []
mdb> delete *
0: E stop interface pred breakpoints.qperm/2-0 (nondet)
mdb> break -O test_in_both
Ambiguous procedure specification. The matches are:
0: pred breakpoints.test_in_both/2-0 (det)
1: pred breakpoints.print_list.test_in_both/2-0 (det)
mdb> break breakpoints.test_in_both
0: + stop interface pred breakpoints.test_in_both/2-0 (det)
mdb> break breakpoints.print_list.test_in_both
1: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
mdb> delete *
0: E stop interface pred breakpoints.test_in_both/2-0 (det)
1: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
mdb> break print_list.test_in_both
0: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
mdb> break print_list.test_only_in_printlist
1: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> delete *
0: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
1: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> break test_only_in_printlist
0: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> delete *
0: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> procedures testmod
Module name `testmod' is ambiguous.
The matches are:
breakpoints.a.testmod
breakpoints.b.testmod
mdb> procedures a
List of procedures in module `a'
func breakpoints.a.afunc/0-0 (det)
mdb> procedures a.testmod
List of procedures in module `a.testmod'
func breakpoints.a.testmod.test_in_ab/0-0 (det)
func breakpoints.a.testmod.test_in_a/0-0 (det)
mdb> break -O test_in_ab
Ambiguous procedure specification. The matches are:
0: func breakpoints.a.testmod.test_in_ab/0-0 (det)
1: func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> break -O testmod.test_in_ab
Ambiguous procedure specification. The matches are:
0: func breakpoints.a.testmod.test_in_ab/0-0 (det)
1: func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> break -O a.testmod.test_in_ab
0: + stop interface func breakpoints.a.testmod.test_in_ab/0-0 (det)
mdb> break -O b.testmod.test_in_ab
1: + stop interface func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> delete *
0: E stop interface func breakpoints.a.testmod.test_in_ab/0-0 (det)
1: E stop interface func breakpoints.b.testmod.test_in_ab/0-0 (det)
mdb> break -O -p goal test_in_a
0: + stop interface func breakpoints.a.testmod.test_in_a/0-0 (det)
goal (flat)
mdb> break -O -P -p HeadVar__1 test_in_b
1: + print interface func breakpoints.b.testmod.test_in_b/0-0 (det)
HeadVar__1 (flat)
mdb> break info
0: + stop interface func breakpoints.a.testmod.test_in_a/0-0 (det)
goal (flat)
1: + print interface func breakpoints.b.testmod.test_in_b/0-0 (det)
HeadVar__1 (flat)
mdb> continue
[1, 3, 5, 2, 4]
E14: C9 CALL func breakpoints.a.testmod.test_in_a/0-0 (det) breakpoints.a.testmod.m:10 (breakpoints.m:27)
test_in_a = '_'
mdb> break_print -b0 none
0: + stop interface func breakpoints.a.testmod.test_in_a/0-0 (det)
mdb> break_print -b0 *
0: + stop interface func breakpoints.a.testmod.test_in_a/0-0 (det)
all (flat)
mdb> continue
E15: C9 EXIT func breakpoints.a.testmod.test_in_a/0-0 (det) breakpoints.a.testmod.m:10 (breakpoints.m:27)
HeadVar__1 "a"
mdb> continue
"a"
E16: C10 CALL func breakpoints.b.testmod.test_in_b/0-0 (det) breakpoints.b.testmod.m:10 (breakpoints.m:29)
mdb: there is no variable named HeadVar__1.
E17: C10 EXIT func breakpoints.b.testmod.test_in_b/0-0 (det) breakpoints.b.testmod.m:10 (breakpoints.m:29)
HeadVar__1 "b"
"b"