7 Commits

Author SHA1 Message Date
Mark Brown
8e0eb72c15 Various improvements to mdb's interactive query mechanism.
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.
2016-02-07 04:09:04 +11:00
Zoltan Somogyi
0f2726ee1a Fix some test case failures.
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.
2002-09-27 03:11:10 +00:00
Simon Taylor
5d693f5a1c Factor out the common Mmake code to set up the mmc, mgnuc
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.
2002-04-29 08:22:08 +00:00
Fergus Henderson
f43ee71545 Use the correct object file name when --use-subdirs is specified.
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.
2002-02-27 09:38:36 +00:00
Fergus Henderson
eaa8674407 Fix some problems with mdb and readline 4.2 that arose due to the use
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
2001-12-11 09:01:25 +00:00
Fergus Henderson
9c41d561e9 Fix some code rot in the (disabled) test case tests/debugger/interactive.
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.
1999-11-20 12:50:04 +00:00
Zoltan Somogyi
ed1716bf35 Clean up the debugger tests directory by (a) removing the long obsolete
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.
1999-04-16 01:13:04 +00:00