Estimated hours taken: 26
Implement the following improvements:
- Pass mdb variable bindings to the interactive query processor,
allowing queries to make use of live values.
- Catch exceptions thrown by queries, rather than crashing mdb.
- Write outputs using io.write_cc/3.
- Don't output underscore variables, avoiding spurious warnings.
- More protection of the user's namespace.
- Updated the cleanup code.
browser/interactive_query.m:
The interface now accepts corresponding lists of names and values,
which are matched up with variables occurring in the queries.
Replace the code generator with one that supports passing data
to and from the query, and catching exceptions from the query.
Pass the appropriate data at the time the query predicate is called.
Distinguish between failure of the query and failure of the dynamic
casts used to instantiate the query inputs.
Use module qualifiers to avoid clashing with user imports. (Should the
generated code use use_module, just in case?)
Perform I/O, failure handling and exception handling in the caller
instead of in the generated code. This is faster, more maintainable,
and means that errors are caught earlier.
Place source_file and line directives more carefully so as to ensure
more consistent error messages, and to help distinguish errors in the
template from errors in the query.
Factor out the query command parser to avoid double maintenance.
browser/debugger_interface.m:
Conform to above changes.
trace/mercury_trace_vars.[ch]:
Export MR_trace_return_bindings, which constructs Mercury lists
of the variable names and values in the current environment.
trace/mercury_trace_browse.c:
Pass bindings from trace/mercury_trace_vars through to the interactive
query processor.
tests/debugger/interactive.{m,inp,exp}:
Update for changes to existing functionality. Additionally test the
new functionality.
doc/user_guide.texi:
Document the new behaviour.
NEWS:
Announce the new behaviour.
browser/interactive_query.m:
Use '.dylib' as the extension for the shared library we generate for
interactive queries when on OS X. (While '.so' would work in principle,
its use is unusual on OS X and the Mercury compiler will always use
'.dylib' anyway.)
Replace some sequences of I/O operations with single calls to io.format
so that message components are not spread over multiple lines.
Add an XXX comment about object file extensions.
Update comments that refer to 'libquery' rather than 'libmdb_query'.
README.MacOS:
Delete interactive queries from the list of unsupported features.
tests/debugger/interactive.exp:
Update this expected output. The changes are due to earlier
changes to the formatting and presentation of error messages.
Estimated hours taken: 0
Branches: main
tests/debugger/interactive.exp:
Conform to Zoltan's recent change in the handling of error
messages involving lists.
Estimated hours taken: 0
Branches: main
Fix a failing test case.
tests/debugger/interactive.exp:
Conform to recent changes in the handling of error messages
and warnings.
Estimated hours taken: 0
Branches: main, release
tests/debugger/interactive.exp:
Fix the expected output with respect to the recompile
with `-E' prompt.
Estimated hours taken: 1
Branches: main, release
Fix some failing debugger test cases. These were failing because the
expected outputs did not conform to the changes in r1.155 of
compiler/code_gen.m (which shifted the context of interface events from
the context of the body goal to the context of the first clause).
debugger/interactive.exp:
debugger/declarative/backtrack.exp2:
debugger/declarative/ite_2.exp2:
debugger/declarative/neg_conj.exp2:
debugger/declarative/negation.exp2:
Update expected outputs for these test cases.
debugger/declarative/backtrack.exp:
debugger/declarative/ite_2.exp:
Main branch only: back out the bogus updates to these expected
outputs. They should correspond to the outputs for non-debug grades,
not (decl-)debug grades.
Estimated hours taken: 0.1
Branches: main
tests/debugger/interactive.exp:
Update the expected output for test case. It has changed
because we no longer prompt the user to recompile with
`-E' for further information unless there is further
information.
Estimated hours taken: 0.1
Branches: main
tests/debugger/interactive.exp:
Update the expected output for this test case.
It has changed because of Zoltan's recent change to the
formatting of mode error messages.
Estimated hours taken: 1
Branches: main, release
Fix some problems caught by the nightly tests and reorder part of the
reference manual.
tabling/specified was failing because the compiler was attempting to perform
unused argument optimization on a tabled predicate. The fix is to
disable unused argument optimization for all predicates that do not have an
evaluation method of eval_normal.
debugger/interactive was failing because of the recent change to how the
superhomogenous form of lambda expressions is constructed. The fix is to
update the expected output. This diff also removes an older expected output
for this test case that is no longer applicable.
Reorder the C specific section on the FLI pragmas in the reference
manual so that it matches that of the other languages.
compiler/unused_args.m:
Do not optimize unused arguments for tabled predicates.
doc/reference_manual.texi:
Rearrange the ordering of the foreign pragmas for C so that it matches
that of the other languages.
tests/debugger/interactive.exp:
Update the expected output for this test case. The change in expected
output is due to the recent change in how the compiler processes lambda
expressions.
tests/debugger/interactive.exp2:
Remove the contents of this file and replace them with a message
saying that the file is currently unused. This is expected output is
out-of-date with respect to the .inp file. (This version of the
expected output was originally added because the compiler generated
different output at -O1, however it no longer does that.)
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: 0.5
Branches: main
Fix some test case failures.
browser/interactive_query.m:
Flush the output stream before invoking the compiler, to ensure that
the output appears in the desired order.
tests/debugger/interactive.{inp,exp}:
Test only the interactive commands of mdb. The other commands are well
exercised by the other test cases; duplicating them only leads to
double maintenance of the expected outputs.
Estimated hours taken: 2.5
Branches: main
Recently I changed the interactive query facility in the debugger
to use `mmc --make' to build the shared library containing the query.
There were two problems with this. The entire program was included in
the shared library, not just the query module. Also, invoking
`mmc --make query.realclean' cleaned up the user's files.
compiler/options.m:
compiler/compile_target_code.m:
Add an option `--compile-to-shared-lib', which causes
mmc to package the modules on the command line into
a shared library, not an executable. This option is
intended only for use by browser/interactive_query.m,
so it isn't documented.
browser/interactive_query.m:
Use `mmc --compile-to-shared-lib', not `mmc --make'
to build the query shared library.
Name the query source file mdb_query.m rather than query.m
to reduce the chance of overwriting a user's file.
tests/debugger/Mmakefile:
Use `lmc' to compile the query if `WORKSPACE' is set,
rather than using a Mercury.options file to set up
for the workspace.
tests/debugger/interactive.exp:
Update expected output.
Estimated hours taken: 10
Branches: main
Improve variable naming in the debugger. Where possible, use
the user's argument names rather than `HeadVar__N'.
compiler/clause_to_proc.m:
Use the user's names for the arguments of
`:- pragma foreign_proc' procedures.
compiler/simplify.m:
When performing excess assignment elimination with `--trace deep',
don't replace a variable with a meaningful name with `HeadVar__N'
or an unnamed variable.
compiler/trace_params.m:
Add a predicate `trace_level_needs_meaningful_var_names'
for use by simplify.m.
compiler/typecheck.m:
For predicates with a single clause, attempt to replace the
`HeadVar__N' variables with the user's original head variables.
trace/mercury_trace_declarative.c:
trace/mercury_trace_vars.c:
Don't assume head variables have names of the form `HeadVar__N'.
Print the argument number when printing the names of
head variables.
tests/debugger/browser_test.inp:
tests/debugger/completion.inp:
Change names of variables in `print' commands.
tests/debugger/*.exp:
tests/debugger/*.exp2:
tests/debugger/declarative/dependency.exp:
tests/invalid/aditi_errors.err_exp:
tests/invalid/mode_inf.err_exp:
tests/invalid/record_syntax_errors.err_exp:
Update expected output.
Estimated hours taken: 8
Branches: main
Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.
Mmake.workspace:
Similar to tools/lmc. Sets up Mmake variables to
use the library files in a workspace rather than
an installed library.
configure.in:
Check for the `--no-mercury-stdlib-dir' mmc option.
Bootstrap CVS tag: bootstrap_20020429_stdlib_dir
Mmake.common.in:
*/Mmakefile:
Move common code into Mmake.workspace.
browser/Mmakefile:
library/Mmakefile:
Avoid invoking the linker explicitly when creating
libraries of Mercury code. That won't work well
with `mmc --make'.
tools/bootcheck:
tests/Mmake.common:
Use Mmake.workspace instead of setting up environment
variables in bootcheck.
scripts/Mmake.vars.in:
mmc compiles split C files to object code itself,
so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
compiling with `--split-c-files'.
browser/interactive_query.m:
Use `mmc --make' when compiling the query. This is needed
to make tests/debugger/interactive_query.m work when linking
against a workspace using options rather than environment
variables. This also fixes a bug -- mmc options were being
passed to ml.
Clean up after the query.
tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
Generate the input file to this test so that MCFLAGS
and MC_MAKE_FLAGS (from Mmake.workspace) are used when
compiling queries.
tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
to allow the use of $(...) style command substitution
(`...` style command substitution can't be nested).
tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
Include tests/Mmake.common.
tools/*:
scripts/c2init.in:
scripts/ml.in:
Update the lists of files containing the library names.
Estimated hours taken: 1
Branches: main
browser/interactive_query.m:
Use the correct object file name when --use-subdirs is specified.
tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
Use a different input file for the `interactive' test case
depending on whether `--use-subdirs' is enabled.
The .inp.subdirs file contains the line `mmc_options --use-subdirs'.
We strip this line out of the output before comparing with
the .exp* files.
Estimated hours taken: 6
Branches: main
Fix some problems with mdb and readline 4.2 that arose due to the use
of readline when input is redirected from an input file. Readline 4.2
issues a run-time warning, complaining that it can't get the terminal
characteristics.
One unfortunate consequence of this change is that none of the test
cases in our test suite actually test the use of readline anymore.
However, none of the line-editing features were being tested anyway,
and it's not really possible to test the use of readline properly
with our current test framework.
configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES:
Check for the existence of isatty().
trace/mercury_trace_readline.c:
Only use readline() if the input is a terminal.
trace/mercury_trace_internal.c:
Delete the special handling of the `echo' command when readline
is enabled, because whether or not readline is enabled now has
no effect on echoing when the input is not a terminal.
Double-echoing when the input *is* a terminal and the "echo on"
command was used is probably appropriate anyway.
tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.exp:
Reenable the `interactive' test case, since the spurious
readline-related failures should not occur anymore.
This required updating the input file and expected output
file to reflect various earlier changes:
- readline is used for query input,
so queries have to be all on one line
- queries are now echoed properly when `echo on' is set
- detailed stack traces include goal paths
- we fixed a bug with the display of caller line numbers
- we fixed a bug with the display of switch goal paths
Estimated hours taken: 0.5
Fix some code rot in the (disabled) test case tests/debugger/interactive.
tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.exp:
Fix some places where the renaming of this test from `queens'
to `interactive' had not been fully reflected in all the
relevant places.
Also fix a bug: put the option `--pic-regs' in `GRADEFLAGS-interactive'
rather than `MGNUCFLAGS-interactive'.
tests/debugger/interactive.exp:
Update to reflect recent changes, e.g. addition of line numbers
in the debugger output.
Estimated hours taken: 1
Clean up the debugger tests directory by (a) removing the long obsolete
*_lib files, and (b) separating out the three roles of the queens.m
into mdb_command_test.m and interactive.m as well as queens.m.
tests/debugger/mdb_command_test.m:
Add a trivial source file for this test. The other files of the test
case (.inp, .exp) already existed.
tests/debugger/queens.{m,exp,inp}:
Remove the tests of interactive functionality.
tests/debugger/interactive.{m,exp,inp}:
A renamed copy of the old queens.m, with the interactive functionality
intact. Note: since this test case is currently disabled, I cannot
be sure that the .exp file is quite correct in every detail.
tests/debugger/*_lib.*:
Removed these obsolete test cases, since for a while now we have
avoided depending on whether the library was compiled with tracing
or not by leaving all library code to the end and not printing
or stopping at any event inside library code.
tests/debugger/Mmakefile:
Make the necessary updates to accommodate the above changes.