Rename mmc and mgnuc options that set this grade component to --c-debug-grade.
Let the options named --c-debug of both mmc and mgnuc enable C level debugging
of only the module being compiled.
runtime/mercury_grade.h:
Rename the .ll_debug grade component to .c_debug. Also rename the C macro
that controls the presence or absence of this grade component
from MR_LL_DEBUG to MR_C_DEBUG_GRADE.
runtime/mercury_conf_param.h:
runtime/mercury_debug.c:
runtime/mercury_debug.h:
runtime/mercury_engine.c:
runtime/mercury_label.c:
runtime/mercury_memory_zones.c:
runtime/mercury_memory_zones.h:
runtime/mercury_overflow.c:
runtime/mercury_std.h:
runtime/mercury_wrapper.c:
Rename the MR_LOWLEVEL_DEBUG macro to MR_DEBUG_THE_RUNTIME.
Previously, the name of this macro wrongly implied that it had
something to do with the old .ll_debug grade component, even though
- the MR_LOWLEVEL_DEBUG macro was designed to debug LLDS grades,
since only these existed when it was created, while
- the .ll_debug grade component (now .c_debug) is useful only for
MLDS grades targeting C.
compiler/options.m:
Rename the old confusingly named low_level_debug option to c_debug_grade.
Move it to the list of grade options, and fix its documentation, which
was completely wrong:
- code in compile_target_code.m treated it as being a synonym of
the .ll_debug (now .c_debug) grade component, while
- its (commented out) documentation here in options.m said it called for
the enabling of what is now MR_DEBUG_THE_RUNTIME.
compiler/compile_target_code.m:
Conform to the rename just above.
Define MR_C_DEBUG_GRADE instead of MR_LL_DEBUG if c_debug_grade is enabled.
Pass -g to the C compiler if either c_debug_grade or target_debug
is enabled.
Add an XXX about a missing safety check for an obsolete experimental
feature.
compiler/compute_grade.m:
When given a grade with a .c_debug grade component, set only the
c_debug_grade option; don't set the target_debug option, which is NOT
a grade option. The change to compile_target_code.m above handles the
only situation in which this implication was formerly required.
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Look for and process the .c_debug grade component instead of .ll_debug.
Use a sh variable named c_debug_grade to record its absence/presence.
Look for and process the --c-debug-grade grade-component option,
setting the same sh variable, c_debug_grade. (All grade components
can be set piecemeal using sh options to the scripts using these
subroutines.) This replaces the old, confusingly named option
--low-level-debug.
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
Consistently use the sh variable c_debug to record the presence of
the (non-grade) --c-debug option to mgnuc, and the sh variable
c_debug_grade to record the presence of the .c_debug grade component.
Stop looking for and handling the --low-level-debug option, which
mgnuc used to document, even though this duplicated the same documentation
in init_grade_options.sh-subr, which mgnuc includes. The difference was
that init_grade_options.sh-subr meant it to represent the old .ll_debug
MLDS grade component, while mgnuc treated it as specifying what is now
MR_DEBUG_THE_RUNTIME for LLDS grades. It didn't help that two sh variables
with quite different semantics had names that differed only in an
underscore: LLDEBUG_OPTS vs LL_DEBUG_OPTS.
scripts/Mmakefile:
Add a missing dependency to force the rebuild of mgnuc after each update
of its sh subroutine mgnuc_file_ops.sh-subr.
doc/user_guide.texi:
Document the --c-debug-grade option of mmc. This option was not publicly
documented under its original misleading name (--low-level-debug), but
its documentation is now possible without contorted dancing around the
name.
Clarify the documentation of mgnuc's --c-debug option.
README.sanitizers:
configure.ac:
Conform to the rename of the grade component.
grade_lib/grade_spec.m:
grade_lib/grade_string.m:
grade_lib/grade_structure.m:
grade_lib/try_all_grade_structs.m:
Conform to the rename of the grade component .ll_debug to .c_debug.
Don't allow the .c_debug grade component in LLDS grades.
In grade_string.m, add some obvious implications of some grade components.
grade_lib/choose_grade.m:
grade_lib/grade_lib.m:
grade_lib/test_grades.m:
grade_lib/var_value_names.m:
Fix white space.
scripts/ml.in:
tools/lmc.in:
tools/test_mercury:
Conform to the change in compile_target_code.m to the naming of
Boehm gc library variants.
Estimated hours taken: 0.5
Branches: main
Fix for bug #53. lmc can now build deep profiling executables that are able
to write out their Deep.data file. Unfortunately this change prevents lmc from
building ssdb executables. This trade off is acceptable at this time.
tools/lmc.in:
lmc no longer passes --init-file $WORKSPACE/ssdb/mer_ssdb.init to mmc.
All executables built with lmc are no-longer required to be linked with
ssdb.
Estimated hours taken: 2
Branches: main
Move the intermodule analysis framework into the `compiler' directory, in
preparation for making it specific to the Mercury compiler, rather than having
it generic in case some fictional being might want to use it with a .NET
compiler one day. This will make it easier to use and modify.
compiler/analysis.file.m:
compiler/analysis.m:
Copy these files from the `analysis' directory.
compiler/top_level.m:
Include analysis.m as a new package.
compiler/Mercury.options:
Add a bug workaround line from analysis/Mercury.options.
analysis/Mercury.options:
analysis/Mmakefile:
analysis/analysis.file.m:
analysis/analysis.m:
analysis/mer_analysis.m:
Replace the contents of these files with comments that the analysis
framework is now in the `compiler' directory. We don't actually
delete them so their histories remain easily accessible.
analysis/README:
Mention that the code has been moved.
compiler/notes/compiler_design.html:
compiler/notes/overall_design.html:
Update documentation.
Mmake.workspace:
Mmakefile:
configure.in:
compiler/.mgnuc_copts:
compiler/COMP_FLAGS.in:
compiler/Mmakefile:
deep_profiler/.mgnuc_copts:
scripts/Mmake.vars.in:
scripts/c2init.in:
scripts/mercury_config.in:
scripts/prepare_tmp_dir_fixed_part.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/lmc.in:
tools/make_arena:
compiler/notes/coding_standards.html:
Remove references to the `analysis' directory and `libmer_analysis'.
Estimated hours taken: 50
Branches: main
Fix some bug of the first review.
boehm_gc/libatomic_ops-1.2/configure:
compiler/ssdebug.m:
ssdb/ssdb.m:
tools/lmc.in:
Estimated hours taken: 8
Branches: main
Update files as required for the addition of the new library `libmer_ssdb',
and make the changes to add a new grade component `ssdebug'.
Mmake.workspace:
Mmakefile:
Add `mer_ssdb.init', `libmer_ssdb' and `ssdb' directory to the
appropriate lists.
Order "ssdb" occurrences according to its position in the list of
which libraries can call functions in which other libraries.
configure.in:
Check the bootstrap compiler supports the `--no-ssdb' option.
browser/MDB_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
Add `--no-ssdb' to break the cyclic dependencies between these
libraries and `libmer_ssdb' that would be introduced if the
source-to-source debugging transformation was applied these libraries.
It also prevents the infinite recursion which would result from ssdb
procedures calling transformed library procedures and vice versa.
analysis/.mgnuc_copts:
analysis/ANALYSIS_FLAGS.in:
analysis/Mmakefile:
profiler/.mgnuc_copts:
profiler/PROF_FLAGS.in:
slice/.mgnuc_copts:
slice/Mmakefile:
slice/SLICE_FLAGS.in:
Search the `ssdb' directory for files.
compiler/Mmakefile:
Remove the explicit `libmer_ssdb.a' from MLOBJS as it is redundant.
Make the compiler binary depend on `libmer_ssdb'.
compiler/compile_target_code.m:
scripts/mgnuc.in:
Pass "-DMR_SS_DEBUG" when compiling a C file if `--ssdb' is enabled.
Implicitly include `mer_ssdb.init' and `libmer_ssdb' in various lists
when `--ssdb' is enabled.
runtime/mercury_conf_param.h:
Document `MR_SS_DEBUG' preprocessor macro.
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Add "ssdebug" grade component.
Add "--ss-debug" option as an alias for "--ssdb" to be consistent with
"--decl-debug". Move the clauses to the right position.
scripts/c2init.in:
scripts/ml.in:
Link in `libmer_ssdb' if `--ssdb' enabled.
tools/lmc.in:
tools/lml:
Link in `libmer_ssdb' and add `mer_ssdb.init'.
tools/bootcheck:
Delete `ssdb' directory if `--disable-debug-libs' option enabled.
tools/binary:
tools/linear:
Link `ssdb' directory.
compiler/notes/overall_design.html:
Mention `ssdb' directory.
doc/user_guide.texi:
Add commented out documentation for the `--ss-debug' option and the
`ssdebug' grade component.
Estimated hours taken: 20
Branches: main
Implement a large chunk of the code that was previously missing for .mmos
grades. The system now correctly computes several answers for the tc_minimal
test case, before going into an infinite loop (since the code for recognizing
the absence of further solutions is not yet there).
Significantly improve the infrastructure for debugging such changes.
compiler/table_gen.m:
Complete the mmos transformation.
compiler/proc_gen.m:
Handle the special return requirements of mmos generators, which must
return not to a caller (since each generator is the root of its own
SLD tree), but to a consumer in another SLD tree that is waiting for an
answer.
compiler/hlds_pred.m:
Provide a mechanism whereby table_gen.m can communicate to proc_gen.m
the requirement for this special return.
compiler/trace_gen.m:
When generating events, include the port and the goal path in a
comment. This makes the generated C code significantly easier to
understand.
compiler/layout_out.m:
Export a function for trace_gen.m to use.
compiler/hlds_goal.m:
Change goal_path_to_string to a function to make it easier to use.
compiler/*.m:
Conform to the change to goal_path_to_string.
runtime/mercury_context.[ch]:
In .mmos grades, include the current debugger call sequence number,
depth, and event number in contexts, to be saved and loaded with
the contexts. This allows each context to have its own separate
sequence of events.
This capability depends not directly on the grade, but on the macro
MR_EXEC_TRACE_INFO_IN_CONTEXT. For now, this is defined only in .mmos
grades, but in future, it may be useful in other grades as well.
runtime/mercury_conf_param.h:
Define and document MR_EXEC_TRACE_INFO_IN_CONTEXT.
runtime/mercury_mm_own_stacks.[ch]:
runtime/mercury_tabling_preds.h:
Implement some predicates needed by the own stack transformation.
Implement the code for generators returning answers to consumers,
and the code for consumers scheduling generators when they need
more answers. At the moment, the code for detecting when generators
depend on each other is not yet written.
Provide better facilities for debugging own stack minimal model grades.
Fix a cut-and-paste bug (wrong macro name guarding the handwritten
C module).
runtime/Mmakefile:
Rebuild only what needs to be rebuilt when mercury_tabling_preds.h
changes.
runtime/mercury_label.[ch]:
Add a utility function for returning the name of an arbitrary label
(internal or entry).
Rename some fields to give them MR_ prefixes.
Always define the functions for recording both entry and internal
labels, even if they are not called from most modules, since they
may be called from a few handwritten modules in the runtime.
Rename a function to avoid a clash with the name of a macro,
and thus allow the change to mercury_goto.h.
runtime/mercury_goto.h:
Fix a bug with MR_init_entry_an. This macro was supposed to always
insert the entry label that is its argument into the entry table,
but instead of calling the function it was meant to call, it called
a macro that could be (and usually way) defined to expand to nothing.
The fix is to call the function a different name than the macro,
and to call the function, not the macro.
runtime/mercury_wrapper.c:
In own stack minimal model grades, create a main context separate
from the current context, since the current context may be needed
to hold a generator's state. Make MR_eng_this_context point to
this context.
Register all labels in the debugging variants of minimal model grades.
runtime/mercury_accurate_gc.c:
runtime/mercury_agc_debug.c:
runtime/mercury_debug.c:
library/exception.m:
Conform to the change to runtime/mercury_label.h.
runtime/mercury_stack_trace.c:
Conform to the change to runtime/mercury_label.h.
Document the link to trace/mercury_trace_internal.c.
trace/mercury_trace.[ch]:
trace/mercury_trace_cmd_forward.c:
Split the GOTO command into two: STEP and GOTO. STEP always stops
at the next event (without any test), even if it is in a different
context (and possibly with a lower event number than the immediately
previous event, since the event numbers in different contexts are
not related). As before, GOTO always goes to the specified event
number, but in .dmmos grades it can now be told that this event number
should be matched only in a specified context. The specification is
done by an extra argument specifying the short name of the context's
generator; the ansence of such an argument means the main context.
trace/mercury_trace_cmd_internal.c:
In own stack grades, when the current context is that of a generator,
print the subgoal the generator is working on before the event number,
call depth, call sequence number and the rest of the event report.
Document the link to runtime/mercury_stack_trace.c, which has similar
code.
trace/mercury_trace_cmd_external.c:
trace/mercury_trace_cmd_declararive.c:
Use the STEP command where GOTO was used for this simpler job,
since this is (very slightly) faster.
trace/mercury_trace_cmd_developer.c:
Fix some bugs with handling own stack tables.
doc/user_guide.texi:
Document the new functionality of the goto mdb command. The
documentation is commented out, since .mmos grades are for developers
only at the moment.
tools/lmc.in:
Turn off C optimizations when C debugging is enabled. For some reason,
the default value of --cflags-for-debug does not include -O0.
Estimated hours taken: 32
Branches: main
The objective of this diff is to switch from a table of solver events built
into the compiler (and eventually the debugger) into a table of events
defined by a file provided by the user to the compiler, which the compiler
then records in the executable for use by the debugger.
The current design, for speed of implementation, uses temporary files parsed
by a bison-generated parser. Since the compiler needs to be able to invoke
the parser even if it is compiled in a non-debug grade, the parser is in
a new library, the eventspec library, that is always linked into the Mercury
compiler and is always linked into any Mercury program with debugging enabled
(but is of course linked only once into a Mercury compiler which has debugging
enabled).
Modify the debugger to give it the ability to print the attributes of
user-defined events (for now, only the non-synthesized attributes).
Implement a new debugger command, "user", which goes to the next user-defined
event.
configure.in:
Require flex and and bison to be available.
doc/user_guide.texi:
Document user defined events and the new debugger capabilities.
doc/mdb_categories:
Include "user" in the list of forward movement commands.
Fix some earlier omissions in that list.
runtime/mercury_stack_layout.h:
Include an event number in the user-defined event structure.
Include a string representing an event set specification in module
layout structures.
runtime/mercury_stack_layout.h:
runtime/mercury_trace_base.[ch]:
runtime/mercury_types.h
Switch from solver events to user events in names.
runtime/mercury_trace_term.[ch]:
Provide a representation of flat terms, for use in representing
the calls that generate synthesized attributes.
Ensure that exported field names have an MR_ prefix.
browser/cterm.m:
Conform to the change to runtime/mercury_trace_term.h.
scripts/c2init.in:
scripts/ml.in:
Include the eventspec library in programs compiled with debugging
enabled.
compiler/Mmakefile:
Include the eventspec library in the compiler.
compiler/options.m:
Add a new option, --event-spec-file-name, that allows the user to
specify the set of user-defined events the program may use.
compiler/handle_options.m:
Set this optimization from an environment variable (which may be
set by the mmc script) if the new option is not explicitly given.
compiler/prog_data.m:
Define the data structures for the compiler's representation of the
event set specification.
Move some definitions around to group them more logically.
compiler/hlds_module.m:
Include the event set specification as a new field in the module_info.
compiler/prog_event.m:
Add the code for invoking the parser in the eventspec library,
and for converting the simple term output by the parser to the
compiler own representation, which contains more information
(to wit, the types of the function attributes) and which has had
a whole bunch of semantic checks done on it (e.g. whether synthesized
attributes depend on themselves or on nonexistent attributes).
Provide a function to generate a canonicalized version of the event
specification file.
compiler/module_qual.m:
compiler/equiv_type.m:
Process event spec specifications as well as items, to module qualify
the names of the types of event arguments, and expanding out
equivalence types.
In equiv_type.m, rename some variables to make clear what kind of info
they represent.
compiler/mercury_compile.m:
Process the event set specification file if one has been selected:
read it in, module qualify it, expand its equivalence types, and add
to the module_info.
compiler/compile_target_code.m:
Include the event_spec library when linking debuggable executables.
compiler/call_gen.m:
compiler/continuation_info.m:
compiler/trace_gen.m:
compiler/trace_params.m:
mdbcomp/prim_data.m:
mdbcomp/trace_counts.m:
runtime/mercury_goto.h:
Generate user-defined events instead of solver events.
compiler/layout.m:
compiler/layout_out.m:
compiler/stack_layout.m:
Include a canonicalized version of the event specification file
in the module layout if the module has any user-defined events.
compiler/code_info.m:
compiler/llds_out.m:
compiler/modes.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/typecheck.m:
Conform to the changes above.
compiler/passes_aux.m:
Rename a predicate to avoid an ambiguity.
trace/Mmakefile:
Add the definition and rules required to build the eventspec library.
trace/mercury_event_scanner.l:
trace/mercury_event_parser.y:
A scanner and a parser for reading in event spec specifications.
trace/mercury_event_spec_missing.h:
Provide the declarations that should be (but aren't) provided by
flex and bison.
trace/mercury_event_spec.[ch]:
The main module of the eventspec library. Provides functions to read
in event set specifications from a file, and to write them out as a
Mercury term in the form needed by the compiler.
trace/mercury_trace_tables.c:
If the module layouts being registered include event set
specifications, then check their consistency. Make the specification
and the consistency indication available to other modules.
trace/mercury_trace_internal.c:
During initialization, if the modules contain a consistent set of event
set specifications, then read that specification into the debugger.
(We don't yet make use of this information.)
Add an extra mdb command, "user", which goes forward to the next
user-defined event.
trace/mercury_trace.[ch]:
trace/mercury_trace_cmd_forward.[ch]:
Implement the new mdb command.
trace/mercury_trace_vars.[ch]:
For user-defined events, include the attributes' values among the
values that can be printed or browsed.
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_declarative.c:
Minor changes.
scripts/scripts/prepare_tmp_dir_grade_part:
Copy the .y and .l files to the tmp dir we use for installs.
tools/bootcheck:
Copy the .y and .l files of the trace directory to stage 2.
tools/lmc.in:
Include the eventspec library when linking debuggable executables.
tests/debugger/user_event.{m,inp,exp}:
tests/debugger/user_event_spec:
New test case to test the new functionality.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
Enable the new test case.
tests/debugger/completion.exp:
Expect the new "user" mdb command in the completion output.
Estimated hours taken: 35
Branches: main and 0.12
Fix another bug when retrying across calls which have an I/O state in one of
their polymorphic arguments.
The problem was that I was assuming MR_trace_find_input_arg would never find
the value of an I/O state argument, however sometimes it does (the value is
junk since io.state values are never used, but MR_trace_find_input_arg reports
that it has found a value anyway).
The fix is to check if each argument is an io.state before looking up the
value of the argument.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/debugger/poly_io_retry2.exp:
tests/debugger/poly_io_retry2.inp:
tests/debugger/poly_io_retry2.m:
Add a regression test. Previously the two printed test1 atoms produced
different output.
tools/lmc.in:
Allow the compiler to be run under valgrind. This didn't prove very
useful in this case, but I decided to leave the change in in case it
might be useful in the future.
trace/mercury_trace.c:
Fix the bug described above.
Estimated hours taken: 12
Branches: main
Move the mdbcomp library to its own directory. To make this change less painful
to test, improve the way we handle installs.
browser/mdbcomp.m:
browser/mer_mdbcomp.m:
browser/prim_data.m:
browser/program_representation.m:
browser/trace_counts.m:
Move these files to the mdbcomp directory.
browser/Mmakefile:
browser/Mercury.options:
mdbcomp/Mmakefile:
mdbcomp/Mercury.options:
Split the contents of the old Mmakefile and Mercury.options file
in the browser directory between these files as appropriate.
Simplify away the stuff not needed now that there is only one library
per directory. Make the browser directory see the relevant files
from the mdbcomp directory.
Mmake.common.in:
Separate out the prefixes allowed in the browser and the mdbcomp
directories.
Mmake.workspace:
Set up a make variable to refer to the mdbcomp directory.
Adjust references to the mdbcomp library to point to its new location.
Mmakefile:
Make invocations visit the mdbcomp library as necessary.
Improve the way we install grades. Making temporary backups of the
directories modified by the install process is unsatisfactory for two
reasons. First, if the install fails, the cleanup script, which is
necessary for user friendliness, destroys any evidence of the cause.
Second, the restore of the backup wasn't perfect, e.g. it left the
.d files modified to depend on .mih files, which don't exist in
LLDS grades, and also left altered timestamps.
This diff changes the install process to make a single tmp_dir
subdirectory of the workspace, with all the work of install_grade
being done inside tmp_dir. The original directories aren't touched
at all.
*/Mmakefile:
Adjust references to the browser directory to refer to the mdbcomp
directory instead or as well.
scripts/Mmake.rules:
*/Mmakefile:
Make it easier to debug Mmakefiles. Previously, creating a
Mmake.makefile with mmake -s and invoking "make -d" ignored the
most fundamental rules of mmake, because Mmake.rules was treating
an unset MMAKE_USE_MMC_MAKE as if it were set to "yes", simply because
it was different from "no". This diff changes it to treat an unset
MMAKE_USE_MMC_MAKE as if it were set to "no", which is a more
sensible default.
scripts/prepare_tmp_dir_fixed_part.in:
scripts/scripts/prepare_tmp_dir_grade_part:
Two new scripts that each do half the work of preparing tmp_dir for
the real work of the install_grade make target. The fixed_part script
prepares the parts of tmp_dir that are grade-independent, while the
grade_part scripts prepares the parts that are grade-dependent.
configure.in:
Test C files in the mdbcomp directory to see whether they need to
be recompiled after reconfiguration.
Create prepare_tmp_dir_fixed_part from prepare_tmp_dir_fixed_part.in.
compiler/*.m:
runtime/mercury_wrapper.c:
Update the references to the moved files.
compiler/notes/overall_design.html:
Mention the new directory.
Estimated hours taken: 5
Branches: main
Fix seg fault bug in declarative debugger.
Allow shared libraries to be linked against using lmc.
browser/declarative_tree.m
The will_not_call_mercury promise was a fib, since
ML_bool_return_yes/no were exported Mercury procs. So just return
constants instead.
library/bool.m
Add comment noting that the representation of bool values should
correspond to definitions given in runtime/mercury_std.h
runtime/mercury_std.h
Add comment noting that MR_TRUE and MR_FALSE should correspond
with the representation of Mercury bools.
tests/debugger/declarative/Mmakefile
Report output if the command to build the .out file fails.
tools/lmc.in
Allow shared versions of the libraries to be linked against using
lmc. I needed this since the seg fault only occured when linking
against the shared versions of the libraries.
Estimated hours taken: 0.1
Branches: main
ttools/lmc.in:
Add a mechanism (the environment variable MMC_GPROF) that allows
the user to request that the executable being built should be
prepared for graph profiling with gprof. This is of course most
useful if the runtime system and standard library being linked in
from the workspace have also been compiled with graph profiling
enabled.
Estimated hours taken: 0.1
Branches: main
tools/lmc.in:
Tell the compiler to link in libmer_mdbcomp.a as well as
libmer_browser.a, since the latter no longer contains the former.
Estimated hours taken: 0.5
Branches: main
Make it easier to boostrap the addition of new configuration
options.
scripts/Mercury.config.bootstrap.in:
A version of Mercury.config.in that does not contain
any options which are not understood by the installed
compilers. This is used when building the stage1 compiler.
Mercury.config is used to build the stage2 and stage3
compilers, and when running the tests. Mercury.config is
installed by `mmake install'.
Mercury.config.bootstrap.in is currently the same
as Mercury.config.in.
Mmake.workspace:
tools/bootcheck:
tools/binary_step:
tools/lmc.in:
Work out which configuration file to use.
configure.in:
scripts/Mmakefile:
scripts/mercury_config.in:
Handle Mercury.config.bootstrap.