Estimated hours taken: 10
Branches: main
Split the existing browser library into two libraries, by making the
program_representation module into its own library. This is useful because
the compiler refers to program_representation.m, whose code thus needs to be
linked into compiler executables even if the compiler isn't compiled with
debugging enabled. By creating a new library for this module, we avoid any
chance of the linker dragging in the rest of the modules in the browser
library. (This is a problem with an upcoming diff.).
The name of the new library is "mdbcomp", because the intention is that it
contain code that is shared between the debugger and the compiler. This means
mostly the definitions of data structures that the compiler generates for the
debugger, and the predicates that operate on them.
Mmake.common.in:
Allow MDB_COMP_ as a prefix for symbol names in the browser directory.
Mmake.workspace:
Add a make variable holding for the name of the new library, and
add the name to the relevant lists of libraries.
Avoid duplicating the lists of filenames that need to be updated
when adding new libraries or changing their names.
Mmakefile:
Use make variables to refer to library names.
browser/mdbcomp.m:
browser/mer_mdbcomp.m:
Add these files as the top modules of the new library.
browser/program_representation.m:
Make program_representation.m a submodule of mdbcomp, not mdb.
browser/program_representation.m:
browser/browser_info.m:
Move a predicate from program_representation.m to browser_info.m
to avoid the mdbcomp library depend on the browser library, since
this would negate the point of the exercise.
browser/mdb.m:
Delete program_representation.m from the list of submodules.
browser/Mmakefile:
Update this file to handle the new module.
browser/Mercury.options:
Mention the new module.
browser/*.m:
Update the lists of imported modules. Import only one browser module
per line.
compiler/notes/overall_design.html:
Document the new library.
compiler/compile_target_code.m:
Add the mdbcomp library to the list of libraries we need to link with.
compiler/prog_rep.m:
trace/mercury_trace_internal.c:
Import program_representation.m by its new name.
scripts/c2init.in:
Centralize knowledge about which files need to be updated when the list
of libraries changes here.
scripts/c2init.in:
scripts/ml.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/linear:
tools/lml:
Update the list of libraries programs are linked with.
Estimated hours taken: 1
Branches: main
browser/declarative_tree.m:
browser/program_representation.m:
compiler/prog_rep.m:
Fix a bug: treat unsafe casts as we treat assignment unifications.
We used to treat them as calls, which was wrong, because unlike calls,
unsafe_casts do not generate trace events.
tests/debugging/declarative/unsafe_cast.{m,inp,exp}:
A new regression test.
tests/debugging/declarative/Mercury_options.m:
Set the parameters required for the new test.
tests/debugging/declarative/Mmakefile:
Enable the new test.
Estimated hours taken: 1
Branches: main
Move the code that defines an instance of mercury_edt/2 from
browser/declarative_debugger.m into a module of its own. This section
of code is large and reasonably self-contained, so it makes sense for it
to have its own module. Moreover, declarative_debugger.m contains the
main declarative debugging definitions and the upper levels of code for
the front end, and the mercury_edt/2 instance doesn't fit into either of
these categories.
Add an exception handler to the front end, so that if declarative debugging
fails for whatever reason, the debugging session can at least continue using
the procedural debugger. Rather than calling error in the front end, throw
exceptions that are of a type specific to the front end (so we know which
errors are ours and which aren't).
browser/declarative_debugger.m:
Add a new type, diagnoser_exception/0. Handle these exceptions
but rethrow any other kind.
browser/declarative_debugger.m:
browser/declarative_tree.m:
Move the mercury_edt/2 instance to the new module.
browser/mdb.m:
Add the new module to the mdb library.
browser/declarative_*.m:
Call throw/1 instead of error/1.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/catch.exp:
tests/debugger/declarative/catch.inp:
tests/debugger/declarative/catch.m:
A test case for debugging code that catches exceptions. This sort
of code is still not supported by the front end, but at least we
now give a decent error message and allow debugging to resume.