mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
master
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f0964815a3 |
Support line numbers in the debugger. You now get contexts (filename:lineno
Estimated hours taken: 40
Support line numbers in the debugger. You now get contexts (filename:lineno
pairs) printed in several circumstances, and you can put breakpoints on
contexts, when they correspond to trace events or to calls. The latter are
implemented as breakpoints on the label layouts of the return sites.
This required extending the debugging RTTI, so that associated with each
module there is now a new data structure listing the source file names that
contribute labels with layout structures to the code of the module. For each
such source file, this table gives a list of all such labels arising from
that file. The table entry for a label gives the line number within the file,
and the pointer to the label layout structure.
compiler/llds.m:
Add a context field to the call instruction.
compiler/continuation_info.m:
Instead of the old division of continuation info about labels into
trace ports and everything else, divide them into trace ports, resume
points and return sites. Record contexts with trace ports, and record
contexts and called procedure information with return sites.
compiler/code_info.m:
Conform to the changes in continuation_info.m.
compiler/options.m:
Add a new option that allows us to disable the generation of line
number information for size benchmarking (it has no other use).
compiler/stack_layout.m:
Generate the new components of the RTTI, unless the option says not to.
compiler/code_gen.m:
compiler/pragma_c_gen.m:
compiler/trace.m:
Include contexts in the information we gather for the layouts
associated with the events we generate.
compiler/call_gen.m:
Include contexts in the call LLDS instructions, for association
with the return site's label layout structure (which is done after
code generation is finished).
compiler/handle_options.m:
Delete the code that tests or sets the deleted options.
compiler/mercury_compile.m:
Delete the code that tests the deleted options.
compiler/basic_block.m:
compiler/dupelim.m:
compiler/frameopt.m:
compiler/livemap.m:
compiler/llds_common.m:
compiler/llds_out.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/value_number.m:
compiler/vn_*.m:
Trivial changes to conform to the changes to llds.m.
compiler/jumpopt.m:
Do not optimize away jumps to labels with layout structures.
The jumps we are particularly concerned about now are the jumps
that return from procedure calls. Previously, it was okay to redirect
returns from several calls so that all go to the same label, since
the live variable information associated with the labels could be
merged. However, we now also associate line numbers with calls, and
these cannot be usefully merged.
compiler/optimize.m:
Pass the information required by jumpopt to it.
doc/user_guide.texi:
Document that you can now break at line numbers.
Document the new "context" command, and the -d or --detailed option
of the stack command and the commands that set ancestor levels.
runtime/mercury_stack_layout.h:
Extend the module layout structure definition with the new tables.
Remove the conditional facility for including label numbers in label
layout structures. It hasn't been used in a long time, and neither
Tyson or me expect to use it to debug either gc or the debugger itself,
so it has no uses left; the line numbers have superseded it.
runtime/mercury_stack_trace.[ch]:
Extend the code to print stack traces to also optionally print
contexts.
Add some utility predicates currently used by the debugger that could
also be use for debugging gc or for more detailed stack traces.
trace/mercury_trace_internal.c:
Implement the "break <context>" command, the "context" command, and
the -d or --detailed option of the stack command and the commands
that set ancestor levels.
Conditionally define a conditionally used variable.
trace/mercury_trace_external.c:
Minor changes to keep up with the changes to stack traces.
Delete an unused variable.
trace/mercury_trace_spy.[ch]:
Check for breakpoints on contexts.
trace/mercury_trace_tables.[ch]:
Add functions to search the RTTI data structures for labels
corresponding to a given context.
trace/mercury_trace_vars.[ch]:
Remember the context of the current environment.
tests/debugger/queen.{inp,exp}:
Test the new capabilities of the debugger.
tests/debugger/*.{inp,exp}:
Update the expected output of the debugger to account for contexts.
In some cases, modify the input script to put contexts where they don't
overflow lines.
|
||
|
|
6b9583eb74 |
Extend the layout scheme to handle typeinfos inside typeclass infos,
Estimated hours taken: 16
Extend the layout scheme to handle typeinfos inside typeclass infos,
and thus enable the debugger (and later native gc) to work with programs
that use type classes and existential types.
compiler/llds.m:
Change the data structure that holds information about the locations
of the typeinfo variables of the tvars active at call return sites
from set(pair(tvar, lval)) to map(tvar, set(layout_locn)).
The change from set to map avoids the possibility of inadvertently
duplicating the info for a give type variable.
The change to explicitly keep a set of locations in which the typeinfo
var may be found allows us to use set intersection on those sets if
(a) the program point may be reached via more than one path, and
(b) not all paths have the same sets. Both of these can happen in
programs that use type classes.
The change from lval to layout_locn (which encodes either an lval,
or an lval representing a typeclass info and an (indirect) offset
inside that typeclass info) is necessary support programs with
type classes.
compiler/continuation_info.m:
Change the data structure that holds information about the locations
of the typeinfo variables of the tvars active at a particular program
point the same way and for the same reasons as in llds.m.
Take set intersections of typeinfo var locations whenever we find
multiple live variable info records for the same label.
compiler/call_gen.m:
Delay the construction of the return live variable information
until the code generator state has been updated to reflect where
things will be on return, instead of trying to cobble up this
info into the code generator state that reflects the point just
before the call. Apart from being cleaner, this is necessary
to avoid compiler aborts for programs that use existential types.
The old compiler could not find the typeinfos of any existentially
quantified type vars, since they do not exist before the call.
compiler/code_info.m:
Rewrite and generalize the code for generating live value information.
compiler/trace.m:
Remove the specialized code for generating live value information;
call code_info instead.
compiler/stack_layout.m:
Pick one of several possible locations for a typeinfo var.
Generate the new indirect layout location descriptions.
Reduce the number of tag bits used to describe different kinds of
lvals, to leave more room for the indirect information.
compiler/*.m:
Conform to the above data structure changes.
compiler/hlds_pred.m:
Clarify the documentation of type_info_locn.
runtime/mercury_stack_layout.h:
Update the section that deals with MR_Live_Lval to take
indirect typeinfo locations into account.
runtime/mercury_layout_util.c:
Handle indirect typeinfo locations when interpreting layout structures.
runtime/mercury_layout_util.c:
trace/mercury_trace_internal.c:
Ignore variables whose names start with TypeClassInfo.
runtime/mercury_accurate_gc.c:
runtime/mercury_agc_debug.c:
Add markers to remind Tyson to handle indirect typeinfo locations.
tests/debugger/implied_instance.{m,inp,exp}:
tests/debugger/multi_paramster.{m,inp,exp}:
tests/debugger/existential_type_classes.{m,inp,exp}:
Copies of the tests in tests/hard_coded/typeclasses, modified to
avoid or delay I/O, so that the calls to I/O preds that may or may
not be traced to do not affect the output.
tests/debugger/Mmakefile:
Add the new test cases.
Remove references to the *_lib variants of the old test cases.
They are not necessary if I/O is delayed until after the last
reported trace event.
tests/hard_coded/typeclasses/Mmakefile:
Remove --trace deep from existential_type_classes, since that
aspect of the test case is now covered in the debugger directory.
|