trace/mercury_trace_spy.c:
When the user wants to put a breakpoint on a line in a file,
but there is no event exactly on the given line number,
mdb used to tell the user just that fact. This diff makes
mdb more helpful, by printing the nearest line numbers before
and after the given line number that *do* have events on which
breakpoints can be put.
The mismatch can come for several reasons, with the most common
probably being that textually, a switch arm for e.g X being f
starts with the X = f unification goal, but switch detection
*deletes* that unification from the switch arm, so the event
for entry into that arm is actually on the line for the *next* goal.
trace/mercury_trace_tables.[ch]:
Provide the info needed by mercury_trace_spy.c.
Change the interface of MR_process_file_line_layouts to make it
self-contained, i.e. returning counts of matches, instead of
merely *adding* to preexisting counts. This is simpler, since
the only caller of that function needs no running tally.
tests/debugger/breakpoints.inp:
Extend this test to test the possible error messages we now generate.
tests/debugger/breakpoints.exp:
tests/debugger/breakpoints.exp2:
Update the expected outputs in both debug and non-debug grades.
trace/mercury_trace_spy.c:
When giving a command such as
mdb> break badfilename.m:42
and the debugger has no information about any file named "badfilename.m",
print an error message that says just that. If the file exists but the
line number doesn't, say that. Previously, the error message didn't tell
the user whether it was the filename or the line number that was in error.
trace/mercury_trace_tables.[ch]:
Collect the information that mercury_trace_spy.c needs for its new task.
tests/debugger/breakpoints.{inp,exp,exp2}:
Add a test of both kinds of bad breakpoint specification to this test case.
Estimated hours taken: 20
Branches: main
Try to work around the Snow Leopard linker's performance problem with
debug grade object files by greatly reducing the number of symbols needed
to represent the debugger's data structures.
Specifically, this diff groups all label layouts in a module, each of which
previously had its own named global variable, into only a few (one to four)
global variables, each of which is an array. References to the old global
variables are replaced by references to slots in these arrays.
This same treatment could also be applied to other layout structures. However,
most layouts are label layouts, so doing just label layouts gets most of the
available benefit.
When the library and compiler are compiled in grade asm_fast.gc.debug,
this diff leads to about a 1.5% increase in the size of their generated C
source files (from 338 to 343 Mb), but a more significant reduction (about 17%)
in the size of the corresponding object files (from 155 to 128 Mb). This leads
to an overall reduction in disk requirements from 493 to 471 Mb (about 4.5%).
Since we generate the same code and data as before, with the data just being
arranged differently, the decrease in object file sizes is coming from the
reduction in relocation information, the information processed by the linker.
This should speed up the linker.
compiler/layout.m:
Make the change described above. We now define up to four arrays:
one each for label layouts with and without information about
variables, one for the layout structures of user events,
and one for the variable number lists of user events.
compiler/layout_out.m:
Generate the new arrays that the module being compiled needs.
Use purpose-specific types instead of booleans.
compiler/trace_gen.m:
Use a new field in foreign_proc_code instructions to record the
identity of any labels whose layout structures we want to refer to,
even though layout structures have not been generated yet. The labels
will be looked up in a map (generated together with the layout
structures) by llds_out.m.
compiler/llds.m:
Add this extra field to foreign_proc_code instructions.
Add the map (which is actually in two parts) to the c_file type,
which is the data structure representing the entire LLDS.
Also add to the c_file type some other data structures that previously
we used to hand around alongside it. Some of these data structures
used to conmingle layout structures that we now separate.
compiler/stack_layout.m:
Generate array slots instead of separate structures for label layouts.
Return the different arrays separately.
compiler/llds_out.m:
Order the output of layout structures to require fewer forward
declarations. The forward declarations of the few arrays holding the
label layout structures replace a lot of the declarations previously
needed.
Include the information needed by layout_out.m in the llds_out_info,
and conform to the changes above.
As a side-effect of all these changes, we now generate proc layout
structures in the same order as the procedures' appearence in the HLDS,
which is the same as their order in the source code, modulo any
procedures added by the compiler itself (for lambdas, unification
predicates, etc).
compiler/code_info.m:
compiler/dupelim.m:
compiler/dup_proc.m:
compiler/exprn_aux.m:
compiler/frameopt.m:
compiler/global_data.m:
compiler/ite_gen.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/llds_to_x86_64.m:
compiler/mercury_compile_llds_back_end.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/pragma_c_gen.m:
compiler/proc_gen.m:
compiler/reassign.m:
compiler/use_local_vars.m:
Conform to the changes above.
runtime/mercury_goto.h:
Add the macros used by the new code in layout_out.m and llds_out.m.
We need new macros because the old ones assumed that the
C preprocessor can construct the address of a label's layout structure
from the name of the label, which is obviously no longer possible.
Make even existing families of macros handle in bulk up to 10 labels,
up from the previous 8.
runtime/mercury_stack_layout.h:
Add macros for use by the new code in layout.m.
tests/debugger/*.{inp,exp}:
tests/debugger/declarative/*.{inp,exp}:
Update these test cases to account for the new (and better) order
of proc layout structures. Where inputs changed, this was to ensure
that we still select the same procedures from lists of procedures,
e.g. to put a breakpoint on.
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.
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.
Estimated hours taken: 0.1
Branches: main
tests/debugger/*.exp2:
Update the expected outputs of debug grade bootchecks for the recent
update that changed to format of goal paths for switch arms.
Estimated hours taken: 16
Branches: main, release
Replace the "set" command of mdb with a bunch of commands: the `format',
`format_param', `list_context_lines', `list_path', `xml_browser_cmd',
`xml_tmp_filename', `fail_trace_counts', `pass_trace_counts' and
`max_io_actions' commands. Each of these set just one parameter
or one of set of closely related parameters.
Move all these commands, and some existing commands that set parameters
that were elsewhere, to the "parameter" command category.
Extend some of these commands so that if given no arguments, they report
the current values of the parameters they would otherwise set.
Replace the "set" commands of the mdb browser and of the declarative debugger
with a bunch of commands: "format", "depth", "size", "width", "lines",
"actions" and "params" (the last prints the current value of the parameters).
For each category of mdb commands, create files mercury_trace_cmd_<cat>.[ch],
and move the functions dealing with that category of commands there from
mercury_trace_internal.c. Give each of these new files a logical structure
that was sometimes missing from the relevant parts of mercury_trace_internal.c.
NEWS:
Mention these changes.
doc/mdb_categories:
Document these changes.
doc/user_guide.texi:
Document these changes.
Fix an old documentation bug: you couldn't set listing paramaters
from a declarative debugger command.
Fix an old documentation bug: the description of the goal_path step
for scopes was obsolete.
Fix some obsolete references to : as module qualifier.
browser/parse.m:
Update the browser command set along the lines at the top.
browser/declarative_user.m:
Update the declarative debugger command set along the lines at the top.
Move the declaration for the type representing declarative debugger
commands to near the top of the file.
browser/browser_info.m:
Provide some access predicates.
Update the predicate that generates mdb commands to save the persistent
state of the debugger to generate the new forms of parameter commands.
Move types and predicates for dealing with browser parameters from
browse.m to here, so that declarative_user.m can use them too.
browser/browse.m:
Delete the code moved to browser_info.m, and conform to the other
changes in the other modules.
browser/listing.m:
Provide a predicate to return the type of listing paths.
scripts/mdbrc.in:
Update the commands that set the XML parameters.
scripts/Mmakefile:
Get mmake to rebuild mdbrc from mdbrc.in when mdbrc.in changes.
trace/mercury_trace_internal.c:
trace/mercury_trace_cmds.h:
trace/mercury_trace_cmd_*.[ch]:
Implement the changes described at the top.
Fix an old bug: the commands that update the search path for the "list"
command don't make the search path term permanent, which is needed in
non-conservative-gc grades.
trace/mercury_trace_spy.c:
Fix some obsolete references to : as module qualifier.
trace/mercury_trace_browse.[ch]:
Delete the functionality now moved to mercury_trace_cmd_parameter.c.
tests/debugger/mdb_command_test.inp:
Update the set of commands being tested.
tests/debugger/save.{inp,exp}:
Update the parameter commands in this test case.
Estimated hours taken: 0.5
Branches: main
Fix a bunch of test cases that are failing in the debug or minimal model
grades either because of my recent change to the standard library or Zoltan's
recent change to the code generator.
tests/debugger/breakpoints.exp2:
tests/debugger/loopcheck2.exp2:
tests/debugger/queens.exp2:
Update the expected outputs for these test cases. (These are the
versions for the debug grades - the non-debug grade versions have
already been updated.)
tests/general/string_format/string_format_lib.m:
tests/hard_coded/one_member.m:
tests/tabling/consumer_in_solutions.m:
tests/tabling/rotate2.m:
tests/tabling/sg.m:
Conform to the recent break up of std_util.
Estimated hours taken: 8
Branches: main
Allow uses to associate with each breakpoint in mdb a list of print actions
that should be executed automatically when execution arrives at the breakpoint.
A new print list (a list of things to be printed) can be attached to an
existing breakpoint via the new "break_print" command, or it can be attached
to a breakpoint being created via the existing "break" command.
NEWS:
Mention the new capability.
doc/user_guide.texi:
Document the new capability.
trace/mercury_trace_spy.[ch]:
Keep a print list with every breakpoint, and add functions to
manipulate print lists.
Convert this module to four space indentation to keep indent levels
manageable.
trace/mercury_trace.c:
Conform to the updated interface of the mercury_trace_spy module.
trace/mercury_trace_internal.[ch]:
When the internal debugger is invoked at an event, whether
interactively or not, take an extra parameter specifying the
print list, if any, to be executed.
Implement the new "break_print" command and the new options of
the "break" command.
Conform to the updated interface of the mercury_trace_spy module.
trace/mercury_trace_declarative.c:
Conform to the updated interface of the mercury_trace_internal module.
tests/debugger/breakpoints.{inp,exp*}:
Test the new capability.
tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
Update to reflect the new command.
Estimated hours taken: 1
Branches: main
trace/mercury_trace_tables.c:
When printing the list of procedures in a module, allow the module name
to be specified by a nickname (a less than fully qualified name).
tests/debugger/breakpoints.{a.m,inp,exp*}:
Test the new capability.
Estimated hours taken: 2
Branches: main
Remove call depth numbers from standardized event printing. This will make
maintaining the debugger test cases easier since a lot of the expected outputs
differ only in the call depth of their events, because of deep tracing of the
standard library in the decldebug grade.
Not all the debugger tests are run with standardized event printing, so
printing of call depths will still be exercised.
tests/debugger/breakpoints.exp
tests/debugger/breakpoints.exp2
tests/debugger/browser_test.exp
tests/debugger/exception_cmd.exp
tests/debugger/exception_cmd.exp2
tests/debugger/exception_cmd.exp3
tests/debugger/exception_value.exp
tests/debugger/exception_value.exp2
tests/debugger/exception_vars.exp
tests/debugger/existential_type_classes.exp
tests/debugger/existential_type_classes.exp2
tests/debugger/exported_eqv_type.exp
tests/debugger/higher_order.exp
tests/debugger/interpreter.exp2
tests/debugger/lambda_expr.exp
tests/debugger/loopcheck.exp3
tests/debugger/loopcheck.inp2
tests/debugger/nondet_stack.exp
tests/debugger/nondet_stack.exp2
tests/debugger/polymorphic_output.exp
tests/debugger/polymorphic_output.exp2
tests/debugger/polymorphic_output.exp3
tests/debugger/print_goal.exp
tests/debugger/print_table.exp
tests/debugger/queens.exp
tests/debugger/queens.exp2
tests/debugger/resume_typeinfos.exp
tests/debugger/retry.exp
tests/debugger/retry.exp2
tests/debugger/tabled_read.exp
tests/debugger/tabled_read_decl.exp
tests/debugger/tabled_read_unitize.exp
tests/debugger/type_desc_test.exp
tests/debugger/declarative/aadebug.exp
tests/debugger/declarative/app.exp
tests/debugger/declarative/args.exp
tests/debugger/declarative/big.exp
tests/debugger/declarative/filter.exp
tests/debugger/declarative/if_then_else.exp
tests/debugger/declarative/input_term_dep.exp
tests/debugger/declarative/io_stream_test.exp
tests/debugger/declarative/io_stream_test.exp2
tests/debugger/declarative/output_term_dep.exp
tests/debugger/declarative/propositional.exp
tests/debugger/declarative/remember_modes.exp
tests/debugger/declarative/special_term_dep.exp
tests/debugger/declarative/tabled_read_decl.exp
tests/debugger/declarative/trust.exp
Remove call depth numbers from output run with standardized event
printing.
trace/mercury_trace_internal.c
Remove call depth from standardized event printing.
Estimated hours taken: 3
Branches: main
trace/mercury_trace_tables.m:
Add a table for the less-than-fully-qualified names of modules,
allowing any prefix of the module name to be omitted.
Use it to allow procedure specifications (e.g. in breakpoint commands)
to use such module names, with fully qualified module names taking
precedence over less-than-fully-qualified module names.
tests/debugger/breakpoints.{m,inp,exp*}:
tests/debugger/breakpoints.print_list.m:
tests/debugger/breakpoints.{a,b}.m:
tests/debugger/breakpoints.{a,b}.testmod.m:
Update this test case to test the new functionality.
Estimated hours taken: 14
Branches: main
Change the compiler and tools so that `.' and not `:' is now used as the
module separator in all output.
Infix `.' now has associativity yfx and priority 10.
NEWS:
Report the change.
configure.in:
Amend the test for an up-to-date Mercury compiler to check whether
it recognises `.' as a module qualifier.
compiler/code_gen.m:
compiler/error_util.m:
compiler/hlds_out.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rl_exprn.m:
compiler/rl_gen.m:
compiler/source_file_map.m:
compiler/unused_args.m:
library/io.m:
library/rtti_implementation.m:
library/type_desc.m:
runtime/mercury_debug.c:
runtime/mercury_deconstruct.c:
runtime/mercury_stack_trace.c:
Change `:' to `.' as module separator for output.
compiler/mercury_to_mercury.m:
compiler/prog_io_typeclass.m:
As above.
Fixed a bug where `.' was not being recognised as a module separator.
doc/reference_manual.texi:
Report the change.
library/term_io.m:
Ensure that infix `.' is written without surrounding spaces.
tests/hard_coded/dot_separator.m:
tests/hard_coded/dot_separator.exp:
tests/hard_coded/Mmakefile:
Test case added.
Estimated hours taken: 4
Branches: main
Add a mechanism for standardizing the event and call sequence numbers in
debugger output. The mechanism is a global flag whose value is set from
MERCURY_OPTIONS. It is intended to be used only in our own internal testing.
runtime/mercury_trace_base.[ch]:
Define the global, MR_standardize_event_details.
Move the documentation of several globals from the .c to the .h file,
since that is where their users will look. Put those globals in a
consistent order.
Add functions for standardizing event and call sequence numbers,
and use them when printing event details.
runtime/mercury_wrapper.c:
Set MR_standardize_event_details when given the option -de.
runtime/mercury_stack_trace.c:
library/exception.m:
trace/mercury_trace_internal.m:
Respect MR_standardize_event_details.
tests/Mmake.common:
Define the make variable MDB_STD, which is like MDB except it also
puts -de in MERCURY_OPTIONS.
tests/debugger/Mmakefile:
Use MDB_STD instead of MDB for test cases that can benefit from
standardizing event and call sequence numbers.
Put the rules for the test cases in alphabetical order.
tests/debugger/*.exp*:
Update expected outputs after this change.
Estimated hours taken: 0.25
Branches: main
tests/debugger/breakpoints.exp2:
tests/debugger/existential_type_classes.exp2:
tests/debugger/polymorphic_output.exp:
tests/debugger/polymorphic_output.exp2:
Update expected output after my change to fix the handling of
breakpoints and the printing of events involving functions.