Estimated hours taken: 6
If calling from the internal debugger, use readline input for the
interactive term browser and interactive queries.
browser/browse.m:
Change some if-then-elses to switches, which will help
catch errors if a new functor is added to the debugger type.
browser/parse.m:
browser/util.m:
Return a string from util__trace_getline/4 rather than a
list of chars, which saves converting from a string to a list
of chars and then back again.
browser/util.m:
Add a version of util__trace_getline that also takes I/O
stream arguments. Pass these arguments to MR_trace_getline.
browser/declarative_oracle.m:
Call util__trace_getline/4 to do input via readline (if
available). Improve error handling.
browser/interactive_query.m:
Call util__trace_getline to get user input, instead of
standard library predicates.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
Add two I/O stream arguments to MR_trace_getline.
Estimated hours taken: 11
This change allows interactive queries to be typed from the external debugger.
browser/debugger_interface.m:
Define new debugger requests: query/1, cc_query/1, io_query/1 and
mmc_options/1.
Define 2 new procedures that are used in trace/mercury_trace_external.c:
get_list_modules_to_import/3 retrieves from a *query/1 request a list
of modules to be imported; and get_mmc_options/2 retrieves from a
mmc_options/1 request the option to pass to mmc to compile the query.
browser/interactive_query.m:
Define a new procedure query_external/7 that does the same job as
query/7 but for the external debugger.
Unset the environment variable `MERCURY_OPTIONS' before compiling a
query; `MERCURY_OPTIONS' is exported before executing a program under
the control of Opium-M (and mdb) and is not supposed to be set before
compiling a program.
trace/mercury_trace_browse.ch:
Add a new function MR_trace_query_external() to interface the
ML_query_external() function defined by browser/interfactive_query.m.
trace/mercury_trace_external.c:
Add code to implement new commands `query', `cc_query', `io_query',
and `mmc_options', using the MR_trace_query_external() function defined
by trace/mercury_trace_browse.h.
trace/mercury_trace_external.h:
Export MR_debugger_socket_in and MR_debugger_socket_out since there
are needed in interactive_query.m.
doc/user_guide.texi:
Add a comment to tell that there exists duplicated documentation betwenn
Opium-M/source/interactive_queries.op and doc/user_guide.texi and to
tell me to update it if someone update the documentation here.
Estimated hours taken: 3
Add some test cases to test interactive queries.
tests/debugger/queens.inp:
Add tests of interactive queries.
tests/debugger/Mmakefile:
Add dependency of queens.out on queens.ints.
This is needed in order for us to use interactive queries.
tests/debugger/queens.m:
Export qperm/2, for use in interactive queries.
browser/interactive_query.m:
Flush MDB_stdout after printing the prompt, so things work
properly with I/O redirections.
trace/mercury_trace_internal.c:
Fix an off-by-one error detected by the above test cases.
Estimated hours taken: 17
Add support for invoking interactive queries to mdb.
browser/interactive_query.m:
New module, to implement interactive queries.
browser/dl.m:
browser/name_mangle.m:
Copy these files from extras/dynamic_linking, since
they are needed by browser/interactive_query.m.
configure.in:
runtime/mercury_conf.h.in:
Autodetect the presence of support for dlopen() etc.
browser/dl.m:
Add #ifdefs so that the code will compile (but report
an error at runtime) if dlopen() etc. are not supported.
browser/browser_library.m:
Add interface_query, dl, and name_mangle to the list of
modules in this library.
trace/mercury_trace_browse.h:
trace/mercury_trace_browse.c:
Add a new function MR_trace_query() to interface to the ML_query()
function defined by browser/interfactive_query.m.
trace/mercury_trace_internal.c:
Add code to implement new commands `query', `cc_query', `io_query',
and `mmc_options', using the MR_trace_query() function defined by
trace/mercury_trace_browse.h.
runtime/mercury_grade.h:
Add code to define MR_GRADE_OPT, so that browser/interactive_query.m
can use this to invoke mmc with the same grade that the executable
being debugged was built with.
doc/mdb_categories:
doc/user_guide.texi:
Document the new commands `query', `cc_query', `io_query',
and `mmc_options'.