[m-dev.] for review: add mdb support for interactive queries
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Mar 13 21:37:45 AEDT 1999
On 11-Mar-1999, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
>
> Hmmmmm. What I proposed was basically the Quintus Prolog debugger
> model. As I think about it, due to Mercury's overloading facilities
> another model seems better to me. How about a model in which when
> you're debugging, it's as if you've implicitly imported every module in
> the application? Whenever there's a conflict, you can explicitly
> module-qualify the goal.
That seems like a good UI to me. And not to hard to implement.
The only difficulty as far as implementation goes is that you have
to read in a lot of interface files, so it might not be very efficient.
> When you're debugging a particular module, however, you are probably
> not interested in any modules other than the one you're debugging, the
> ones it imports, the ones they import, and so on. For such cases, it
> would be useful to focus on a particular module, and thereby limit
> visibility to modules recursively imported by the focus module.
>
> How does that model sound?
Imports in Mercury are never transitive (well, modulo compiler bugs).
So I prefer to just include the directly-imported modules.
The user should be allowed to name additional modules to import
as well, though.
> So really all you have to do is add a debugger command to set the
> focus module, and always nest queries within that. Maybe also a
> command to reset it to the default: the root module of the
> application.
Yep, sounds good.
So, I suggest the following commands at the `mdb>' prompt:
mmc <command name>
mmc_options <options list>
These just let you override which version of mmc gets run and with which
options.
module [<main-module> [<imported-modules list>]]
import_module <imported-modules list>
use_module <used-modules list>
The `module' command sets the focus module and resets the imported-modules
list. The `import_module' and `use_module' commands add modules to the
lists of imported and used modules.
query [<main-module> [<imported-modules list>]]
cc_query [<main-module> [<imported-modules list>]]
io_query [<main-module> [<imported-modules list>]]
Alternatively, as an abbreviation, you can specify the focus module and
imports as arguments to the `query', `cc_query' or `io_query' command.
(But you can't specify modules imported with `:- use_module' this way,
you need to use the `use_module' command for that.)
By default, there is no focus module, but all the modules in the
application are imported.
In debug grade, there ought to be a default main/2 which just invokes
the debugger. Then it would be nice to have
load <shared-lib>
unload <shared-lib>
These would dynamically (re)load or unload a shared library.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list