mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Estimated hours taken: 20
Branches: main
Implement breakpoints on user events. Users may specify an event set,
an event name, both, or neither. Four forms of the mdb "break" command
create such breakpoints:
break [the usual options] user_event <event_name>
break [the usual options] user_event <event_set_name> <event_name>
break [the usual options] user_event_set
break [the usual options] user_event_set <event_set_name>
In addition, the command
break [the usual options] user_event
is also accepted, as a synonym for
break [the usual options] user_event_set
Since user events are not interface events or entry events, add a new, simple
ignore specification, which decrements the ignore count on every match of the
event.
Make the "break_print" mdb command consistent with the other command that
operates on existing breakpoints ("condition") by making it apply by default
to the most recently created breakpoint.
Make "condition" and "break_print" use the same option letter (-b) to introduce
the breakpoint number.
Fix a bug in the implementation of "break_print" that led to printing out
the selected variable, but not the selected *path* within the selected
variable. The reason was that we recorded what to print (variable spec plus
path) in a string, but that the process of using that record to print out
what was wanted destroyed the string (by putting a NULL between the variable
specification and the path), so that *later* uses of that string would find
an empty path. The fix is to record a var_spec/path pair in the print list.
Fix some slightly misleading output: when printing part of a variable, we
printed the name of the variable without any indication that the value printed
wasn't the whole value of the variable. We now print the path as well.
doc/user_guide.texi:
Document the changes above.
Document the usage "break_print [options] none", which we have always
supported, but which was not documented.
runtime/mercury_stack_layout.h:
Add a utility macro.
trace/mercury_trace.c:
Fix a bug which left a variable uninitialized.
trace/mercury_trace_cmd_breakpoint.c:
Implement the new command forms and options described above.
trace/mercury_trace_spy.[ch]:
Implement data structures for keeping track of the new forms of
breakpoints, and add the necessary functions for manipulating them.
Update the function that checks whether the current event matches.
Factor some common code out of that function, as well as out of the
functions for adding new breakpoints.
Change the print list data structure as described above.
Add some utility functions.
Add MR_ prefixes to the names of structure fields that previously
lacked them.
trace/mercury_trace_cmd_misc.c:
Handle the new breakpoint types.
trace/mercury_trace_tables.c:
trace/mercury_trace_internal.c:
We used to parse the event set descriptions in module layout structures
when the debugger was initialized (in mercury_trace_internal.c).
However, we delay registering all the modules until this is needed,
so at that time we don't yet *have* the list of module layout
structures, so we used to parse nothing. This diff moves the code
for doing the parsing to the time when the module layout structures
are registered (in mercury_trace_tables.c).
Don't test whether the module layout structure contains the fields
for user event descriptions, since that diff has been installed on
all our systems weeks ago.
trace/mercury_trace_internal.c:
Conform to the new print list structure.
trace/mercury_trace_vars.[ch]:
Print any selected path together with a variable name when printing a
value. (This is the last bug fix mentioned at the top.)
Export a function for use in mercury_trace_internal.c.
Add some utility functions.
Improve some error messages.
trace/mercury_trace_tables.h:
Add a const qualifier.
tests/debugger/user_event.{inp,exp}:
Extend this test case to test the new functionality.
tests/debugger/breakpoints.{inp,exp,exp2}:
Conform to the change to the break_print command.
tests/queens.{inp,exp}:
Change the input to test the bug fix to the break_print command,
and the expected output.
tests/browser_test.exp:
tests/field_names.exp:
Conform to the fact that we now print paths after variables names.
266 lines
11 KiB
Plaintext
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"
|