Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
browser/browser_info.m:
browser_params_to_string supported an option to print the browser
persistent state in a friendly format instead of as mdb commands.
The option was never used, so delete it.
(Fixes an unreachable bug where that unused code path did not print
the web_browser_cmd value.)
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_misc.c:
Update the caller.
runtime/*.[ch]:
trace/*.[chyl]:
As above. In some places, improve comments, e.g. by expanding contractions
such as "we've". Add #ifndef guards against double inclusion around
the trace/*.h files that did not already have them.
tools/*:
Make the corresponding changes in shell scripts that generate .[ch] files
in the runtime.
tests/*:
Conform to a slight change in the text of a message.
Add MR_strerror as a thread-safe alternative to strerror.
The current implementation wraps strerror_r(), strerror_s()
or sys_errlist as appropriate for the platform. Bug #340.
configure.ac:
runtime/mercury_conf.h.in:
Check for strerror_r, strerror_s.
Delete irrelevant code in the sockets test for the external debugger.
runtime/mercury_runtime_util.c:
runtime/mercury_runtime_util.h:
Add MR_strerror and use it.
library/io.m:
Use MR_strerror. In particular, mercury_output_error was not
thread-safe.
Pass errno to mercury_output_error explicitly for clarity.
Delete req_lock parameter in ML_maybe_make_err_msg macro which is not
needed any more.
compiler/prog_event.m:
runtime/mercury_deep_profiling.c:
runtime/mercury_misc.c:
runtime/mercury_term_size.c:
runtime/mercury_trace_base.c:
trace/mercury_trace_cmd_developer.c:
trace/mercury_trace_cmd_exp.c:
trace/mercury_trace_cmd_misc.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
Use MR_strerror.
compiler/notes/coding_standards.html:
Update coding standard.
extras/net/sockets.m:
extras/net/tcp.m:
Use MR_strerror.
NEWS:
Announce change.
Estimated hours taken: 4
Branches: main
Fix a problem introduced in my previous change to the trace directory
which introduced a dependency between the runtime and the trace directory
which broke compilation of the former in high-level C grades.
Fix up conversion specifiers in the printf control strings in the
trace directory.
runtime/mercury_stack_trace.h:
Define MR_FrameLimit, MR_SpecLineLimit and MR_AncestorLevel here rather
than in the trace directory because the code in the runtime for
stack tracing refers to them. (Some code that was only enabled
in high-level C grades and referred to the above types was
added as part of my last change; this is what broke compilation
in those grades.)
Rename MR_AncestorLevel to (the more general) MR_Level in the
process.
runtime/mercury_stack_trace.c:
Use MR_FrameLimit and friends in place of ints here.
trace/mercury_trace.h:
Delete the typedefs for MR_FrameLimit and friends.
trace/mercury_trace_cmd_backward.c:
trace/mercury_trace_external.c:
Conform to the above change.
trace/*.c:
Change the signedness of conversion specifiers to conform
to recent type changes.
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: 2
Branches: main
The runtime had two different conventions for naming types. One convention,
used mostly in the debugger-related modules, added underscores between
capitalized words; example: MR_Label_Layout. The other convention, used
in most modules, used capitalized words without underscores (e.g. MR_TypeInfo).
This diff standardizes on the second convention. It has no algorithmic changes,
only renames of types.
runtime/*.[ch]:
trace/*.[ch]:
compiler/*.m:
library/*.m:
mdbcomp/*.m:
Effect the change described above. The only substantive change is that
runtime/mercury_stack_layout.h used to define *two* types for trace
levels: MR_TraceLevel and MR_Trace_Level, and this diff standardizes
on just one (they had equivalent definitions).
runtime/mercury_bootstrap.h:
Add a #define from the old name to the new for all the changed type
names that the installed compiler can put into .c files. We can delete
these #defines some time after this diff has bootstrapped.
slice/.mgnuc_opts:
Restore the --no-mercury-stdlib-dir option, without which the slice
directory won't compile after this change (because it looks for type
names in the installed runtime header files, which define the old
versions of type names).
Estimated hours taken: 5
Branches: main
Add a new mdb command, 'shell', that allows users to execute shell commands
from within the debugger.
Allow the user to give up to nine additional arguments to the 'source' command.
Occurrences of the strings "$1" through "$9" in the sourced file are replaced
by the corresponding additional arguments, allowing for parameterised scripts.
Use the two new features mentioned above to add two more mdb commands: one
to open a term, goal or exception in an external editor another command
to perform a grep on a term, goal or exception (useful for seeing if a value
occurs in a big map, for example).
NEWS
Mention the new commands.
doc/mdb_categories:
doc/user_guide.texi:
Document the new commands.
scripts/Mmakefile:
scripts/mdb_open:
scripts/mdb_vim:
Add scripts for the new commands.
scripts/mdbrc.in:
Add aliases for the new shell, emacs, grep and vim commands.
tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
Adjust for new commands.
tests/debugger/save.exp:
tests/debugger/save.exp2:
Adjust for new commands. Replace system dependent strings
with ZZZ instead of XXX.
tests/debugger/Mmakefile:
tests/debugger/shell.exp:
tests/debugger/shell.inp:
tests/debugger/shell.m:
tests/debugger/shell_test_script:
Test the shell and source commands.
trace/mercury_trace_cmd_misc.c:
Check if there are extra arguments to the source mdb command
and pass them to MR_trace_source if there are.
trace/mercury_trace_cmd_misc.h:
Add shell command handling function prototype.
trace/mercury_trace_declarative.c:
Call MR_trace_call_system_display_error_on_failure instead
of system when displaying benchmarking statistics for the
declarative debugger.
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
Implement the shell command and extend the source command
to handle the optional extra arguments.
trace/mercury_trace_readline.c:
trace/mercury_trace_readline.h:
Add a new function to read a line and replace all the
occurrences of "$[1-9]" with the corresponding value from an array.
Delete comments in the .c file that are duplicated in the .h file.
trace/mercury_trace_util.c:
trace/mercury_trace_util.h:
Implement MR_trace_call_system_display_error_on_failure that
executes a system call and displays an error message if the system
call terminates abnormally.
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.