mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 02:13:54 +00:00
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_oracle.m:
browser/declarative_user.m:
browser/diff.m:
browser/help.m:
browser/interactive_query.m:
browser/parse.m:
browser/util.m:
Replace implicit streams with explicit streams.
Shorten lines longer than 79 chars.
In some places, simplify some code, often using constructs such as
string.format that either did not exist or were too expensive to use
when the original code was written.
In some places, change predicate names that were not meaningful
without module qualification by *including* the module qualification
in the name (e.g. init -> browser_info_init).
In some places, add XXXs.
In browser_info.m, make the output stream *part* of the debugger type,
because without this, having the debugger type belong to the stream
typeclass does NOT make sense. (The typeclass instance for debugger
used to always write to the current output stream, which this diff
is replacing with the use of explicitly specified streams.)
In browse.m, consistently put stream arguments before other arguments.
In browse.m, when exporting Mercury predicates to C, export them
under names with the standard ML_BROWSE_ prefix, NOT under the name
of a *different* predicate with that prefix.
In diff.m, eliminate an unnecessary difference between what we print
when the difference between two terms is at the root, vs what we print
when the difference between two terms is lower down.
In interactive_query.m, when trying to write a program out to a file,
do NOT write the program to the current output stream if we cannot open
the file, since that would accomplish nothing useful.
Also in interactive_query.m, cleanup .dylib instead of .so on MacOS.
In util.m, delete some unused predicates.
In collect_lib.m, document why some code is not worth updating.
In declarative_oracle.m, rename predicates with previously-ambiguous
names.
browser/MDBFLAGS.in:
Specify --warn-implicit-stream-calls for all Mercury modules
in the browser directory from now.
trace/mercury_trace_browse.c:
trace/mercury_trace_cmd_browsing.c:
ssdb/ssdb.m:
Conform to the changes in browser/*.m.
tests/debugger/queens.{exp,exp2}:
Expect the extra output from browser/diff.m.
This directory holds the trace subsystem, i.e. the part of the Mercury debugger that is written in C code. Notes on interfacing with other subsystems ------------------------------------------ If tracing is enabled, the compiler includes calls to MR_trace() in the generated C code. The trace subsystem in this directory is therefore called directly from Mercury code, via MR_trace() in runtime/mercury_trace_base.c. One of the first things it does is to save the original values of the Mercury registers in a variable called `saved_regs'. The reason it needs to do this is that the code here may modify registers, e.g. by allocating memory using incr_hp or by calling Mercury code. Once the original values of the registers have been saved, the trace subsystem is free to modify the Mercury registers. So for all code in this directory, the usual convention is that the original values of the Mercury registers are in `saved_regs', while the current (scratch) values for the normal non-transient Mercury registers etc. are in their normal locations, not in the fake_reg copies, and the transient (register window) registers, if any, are in the fake_reg copies. Any code which uses macros such as incr_hp(), list_cons(), make_aligned_string(), etc. that modify the heap pointer must call restore_transient_regs() beforehand and must call save_transient_regs() afterwards. The simplest way to do this is to use the macro MR_TRACE_USE_HP() in trace/mercury_trace_util.h. The tracer may invoke Mercury code defined in the browser or library directories if that code is exported to C using `pragma export'. But any calls from functions here to code defined in Mercury and exported using `pragma export', i.e. functions starting with `ML_' prefixes, must be preceded by a call to save_registers() and followed by a call to restore_registers(). The simplest way to do this is to use the macro MR_TRACE_CALL_MERCURY() in trace/mercury_trace_util.h.