mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 19:33:46 +00:00
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.
47 lines
1.8 KiB
Plaintext
47 lines
1.8 KiB
Plaintext
1: 1 1 CALL pred implied_instance.main/2-0 (det) implied_instance.m:25
|
|
mdb> echo on
|
|
Command echo enabled.
|
|
mdb> register --quiet
|
|
mdb> context none
|
|
Contexts will not be printed.
|
|
mdb> alias P print *
|
|
P => print *
|
|
mdb> goto 2
|
|
2: 2 2 CALL pred implied_instance.p/2-0 (det)
|
|
mdb> P
|
|
HeadVar__1 2
|
|
mdb>
|
|
3: 3 3 CALL pred implied_instance.ClassMethod_for_implied_instance__sumable____int__arity0______implied_instance__p_2/2-0 (det)
|
|
mdb> P
|
|
HeadVar__1 2
|
|
mdb> break -e p
|
|
0: + stop entry pred implied_instance.p/2-0 (det)
|
|
mdb> continue -a
|
|
4: 4 4 CALL pred implied_instance.copy_int/2-0 (det)
|
|
5: 4 4 EXIT pred implied_instance.copy_int/2-0 (det)
|
|
6: 3 3 EXIT pred implied_instance.ClassMethod_for_implied_instance__sumable____int__arity0______implied_instance__p_2/2-0 (det)
|
|
7: 2 2 EXIT pred implied_instance.p/2-0 (det)
|
|
8: 5 2 CALL pred implied_instance.p/2-0 (det)
|
|
mdb> P
|
|
HeadVar__1 [42, 24, 1, 2, 3]
|
|
mdb>
|
|
9: 6 3 CALL pred implied_instance.ClassMethod_for_implied_instance__sumable____list__list__arity1______implied_instance__p_2/2-0 (det)
|
|
mdb> P
|
|
HeadVar__1 [42, 24, 1, 2, 3]
|
|
mdb>
|
|
10: 7 4 CALL pred implied_instance.sum_int_list/2-0 (det)
|
|
mdb> P
|
|
HeadVar__1 [42, 24, 1, 2, 3]
|
|
mdb> continue -a
|
|
11: 7 4 SWTC pred implied_instance.sum_int_list/2-0 (det) s2-2;
|
|
12: 8 5 CALL pred implied_instance.p/2-0 (det)
|
|
mdb> P
|
|
HeadVar__1 42
|
|
mdb>
|
|
13: 9 6 CALL pred implied_instance.ClassMethod_for_implied_instance__sumable____int__arity0______implied_instance__p_2/2-0 (det)
|
|
mdb> P
|
|
HeadVar__1 42
|
|
mdb> continue -S
|
|
2
|
|
72
|