Commit Graph

382 Commits

Author SHA1 Message Date
Fergus Henderson
e06fa4993d For --use-subdirs, add `-I.' to ALL_MGNUCFLAGS rather than to
Estimated hours taken: 0.25

scripts/Mmake.rules:
	For --use-subdirs, add `-I.' to ALL_MGNUCFLAGS rather than to
	MGNUCFLAGS.  This avoids problems where EXTRA_MGNUCFLAGS and
	MGNUCFLAGS_FOR_TARGET were being interpreted as gcc options
	rather than as mgnuc options, because `-I.' is a gcc option
	rather than an mgnuc option and so all options which follow
	it are assumed to be gcc options.
1999-03-29 10:33:20 +00:00
Fergus Henderson
11d5604fec Fix a bug: it was using the wrong variable name for the variable
Estimated hours taken: 0.25

scripts/ml.in:
	Fix a bug: it was using the wrong variable name for the variable
	which holds the name of the library for dlopen() etc.
	(s/DL_LIB/DL_LIBRARY).
1999-03-25 14:45:39 +00:00
Fergus Henderson
c675130989 Fix a bug: it was not installing the emacs script (gud.el).
Estimated hours taken: 0.5

scripts/Mmakefile:
	Fix a bug: it was not installing the emacs script (gud.el).
1999-03-24 12:57:29 +00:00
Fergus Henderson
77b319d2a5 Fix a bug where it was generating code that referred to
Estimated hours taken: 0.5

scripts/c2init.in:
	Fix a bug where it was generating code that referred to
	the initialization functions for the browser library
	even when `--trace' was not specified on the command line
	and the grade was not a debugging grade.
1999-03-21 04:40:31 +00:00
Fergus Henderson
21bb73950c Fix a typo in the documentation.
Estimated hours taken: 0.01

scripts/ml.in:
	Fix a typo in the documentation.
1999-03-18 10:55:52 +00:00
Fergus Henderson
c35bcebf9c Alias EMPTY and NUMBER to "step", to simplify the code in
Estimated hours taken: 0.75

scripts/mdbrc.in:
	Alias EMPTY and NUMBER to "step", to simplify the code in
	mercury_trace_internal.c for handling those.

trace/mercury_trace_internal.c:
	Split the very long and complicated function MR_trace_debug_cmd()
	into two, one of which contains all the before-and-after processing,
	and the other being the main command dispatch switch.
	Delete the special-case handling of EMPTY and NUMBER since it's
	now done by scripts/mdbrc.in.

	Add some recently-added command names to the list of valid commands.
1999-03-18 08:19:17 +00:00
Fergus Henderson
cdf63a9b38 Improve the autoconfiguration for sockets and the dlopen() stuff,
Estimated hours taken: 3

Improve the autoconfiguration for sockets and the dlopen() stuff,
and ensure that the libraries needed for these are only linked in
when debugging.

This change also fixes a bug: Erwan's recent change to add -lsocket
broke static linking on Solaris 2.6 machines.  This change means that
static linking works again, so long as you don't enable debugging.
1999-03-18 00:15:14 +00:00
Fergus Henderson
965f113b60 Remove support for NU-Prolog and SICStus Prolog.
Estimated hours taken: 0.25

Remove support for NU-Prolog and SICStus Prolog.

scripts/Mmakefile:
	Delete the rules for installing the NU-Prolog and SICStus Prolog
	scripts.
1999-03-15 16:28:06 +00:00
Fergus Henderson
14728289fa Remove support for NU-Prolog and SICStus Prolog.
Estimated hours taken: 5

Remove support for NU-Prolog and SICStus Prolog.

The reasons for this are:
(a) We now have a proper working debugger, so we don't need to use
    NU-Prolog or SICStus Prolog for debugging.
(b) The Prolog support was only ever a hack, not a proper solution;
    Mercury language features like functions or mode reordering
    were never supported.
(c) It was a maintenance problem.

compiler/make_hlds.m:
	Warn that NU-Prolog `when' declarations are deprecated.

compiler/prog_io.m:
	Update a comment to say that NU-Prolog `when' declarations
	are now deprecated.

library/*.m:
	Delete `when' declarations.

configure.in:
bindist/bindist.configure.in:
	Delete the autoconf tests for NU-Prolog and SICStus Prolog.
	Delete the stuff for generating the NU-Prolog and SICStus Prolog
	scripts.

tools/bootcheck:
	Delete the options for testing using SICStus Prolog.

library/Mmakefile:
	Delete the rules for building NU-Prolog and SICStus Prolog stuff.

library/library.nu.nl.in:
	library/swi_*.m:
	library/*.nu.nl:
library/array.nu.nl:
library/assoc_list.nu.nl:
library/char.nu.nl:
library/float.nu.nl:
library/int.nu.nl:
library/io.nu.nl:
library/library.nu.nl.in:
library/map.nu.nl:
library/mercury_builtin.nu.nl:
library/nc_builtin.nl:
library/require.nu.nl:
library/sp_builtin.nl:
library/sp_lib.nl:
library/std_util.nu.nl:
library/store.nu.nl:
library/string.nu.nl:
library/swi_builtin.m:
library/swi_lib.m:
library/term_io.nu.nl:
	Delete these files.

scripts/mnc.in:
scripts/mnp.in:
scripts/mnl.in:
scripts/msc.in:
scripts/msl.in:
scripts/msp.in:
	Delete these files.

doc/user_guide.texi:
	Delete the documentation about the Prolog support.

NEWS:
w3/news/newsdb.inc:
        Mention that we've removed the Prolog support.
1999-03-15 08:48:36 +00:00
Warwick Harvey
4a52a9b94c Separated out all the commands to create installation directories
Estimated hours taken: 0.5

boehm_gc/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
	Separated out all the commands to create installation directories
	into a single target in each Mmakefile, upon which all targets which
	used to create directories depend.  This avoids a race condition
	with parallel installs into a new directory tree, whereby two or
	more `mkdir -p' commands simultaneously try to create the same
	missing path component, resulting in all but one failing.
1999-03-15 00:39:30 +00:00
Fergus Henderson
f6e2258668 Re-enable the passing of -ansi' to gcc, unless --no-ansi' is
Estimated hours taken: 0.5

scripts/mgnuc.in:
	Re-enable the passing of `-ansi' to gcc, unless `--no-ansi' is
	specified.  I think Tom Conway's change to disable it in all cases
	was committed accidentally.

	Change the code which disables `-ansi' if `--thread-safe' is
	specified and it's a sparc (since the Solaris "pthread.h"
	doesn't work with -ansi) to check the OS (Solaris or SunOS)
	rather than the architecture (sparc).
1999-03-12 23:39:43 +00:00
Erwan Jahier
033ba2bb2e Enable by default the use of the external debugger on architectures that
Estimated hours taken: 9

Enable by default the use of the external debugger on architectures that
support sockets.

configure.in:
bindist/bindist.configure.in:
	Define MR_USE_EXTERNAL_DEBUGGER for systems that support sockets.

	Pass down a variable SOCKET_LIBRARY that contains the name of the
	socket library (may varies from one system to another).

scripts/ml.in:
	Add the name of the socket library to the libraries passed in
	argument of ml.

runtime/mercury_conf.h.in:
	Add "#undef  MR_USE_EXTERNAL_DEBUGGER".

runtime/mercury_conf_param.h:
	Remove a useless comment.

trace/mercury_trace_external.c:
	Update a comment.
1999-03-11 19:18:09 +00:00
Fergus Henderson
3f81c08fad Check for cygwin' as well as cygwin32', since
Estimated hours taken: 0.1

scripts/ml.in:
	Check for `cygwin' as well as `cygwin32', since
	Cygwin32 has been renamed as Cygwin now.
1999-02-20 15:30:42 +00:00
Tyson Dowd
5202901fff Move the patch for making the GNU assembler into the configuration script.
Estimated hours taken: 1

Move the patch for making the GNU assembler into the configuration script.

README.Linux-Alpha:
configure.in:
bindist/bindist.configure.in:
scripts/mgnuc.in:
	Autodetect whether "as" does full pre-processing or not.
	Set AS accordingly in mgnuc.
1998-12-22 07:54:16 +00:00
Fergus Henderson
b44b4f7115 Use the `--tty' option of mdb to put the output of the program
Estimated hours taken: 4

scripts/gud.el:
	Use the `--tty' option of mdb to put the output of the program
	in a different window than the output of mdb.
1998-12-21 17:45:10 +00:00
Fergus Henderson
c5a69daae3 Add support for debugging Mercury code using mdb to "Gud",
Estimated hours taken: 16

Add support for debugging Mercury code using mdb to "Gud",
the Emacs "Grand Unified Debugger".  This lets you run mdb
under emacs, using the tags file provided by `mtags --emacs'
for source code linking.

scripts/gud.el:
	Add support for Mercury.

Mmake.common.in:
scripts/Mmakefile:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
	Modify the installation scripts to install gud.el in
	.../lib/mercury/elisp.

.INSTALL.in:
bindist/bindist.INSTALL:
	Document what you need to add to your ~/.emacs file to
	use the Emacs mdb interface.
1998-12-21 11:34:00 +00:00
Fergus Henderson
0eb7007bb1 Import the file gud.el (a debugger interface) from Emacs 19.34.
Estimated hours taken: 0.25

Import the file gud.el (a debugger interface) from Emacs 19.34.
1998-12-21 09:22:32 +00:00
Fergus Henderson
8efc1a22cb Add new options --tty', --window', and `--window-cmd',
Estimated hours taken: 4

scripts/mdb.in:
	Add new options `--tty', `--window', and `--window-cmd',
	for redirecting I/O to a different tty or to a new window.
1998-12-21 04:39:44 +00:00
Fergus Henderson
5cf1315c2b Delete bogus `# @configure_input@' comment.
Estimated hours taken: 0.1

scripts/mprof_merge_runs:
	Delete bogus `# @configure_input@' comment.
1998-12-16 18:22:22 +00:00
Simon Taylor
18430aaef1 Aditi compilation.
Estimated hours taken: 1200

Aditi compilation.

compiler/options.m:
	The documentation for these is commented out because the Aditi
	system is not currently useful to the general public.
	--aditi: enable Aditi compilation.
	--dump-rl: write the intermediate RL to `<module>.rl_dump'.
	--dump-rl-bytecode: write a text version of the bytecodes
		to `<module>.rla'
	--aditi-only: don't produce a `.c' file.
	--filenames-from-stdin: accept a list of filenames to compile
		from stdin. This is used by the query shell.
	--optimize-rl, --optimize-rl-cse, --optimize-rl-invariants,
	--optimize-rl-index, --detect-rl-streams:
		Options to control RL optimization passes.
	--aditi-user:
		Default owner of any Aditi procedures,
		defaults to $USER or "guest".
	--generate-schemas:
		write schemas for base relations to `<module>'.base_schema
		and schemas for derived relations to `<module>'.derived_schema.
		This is used by the query shell.

compiler/handle_options.m:
	Handle the default for --aditi-user.

compiler/hlds_pred.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/make_hlds.m:
	Add some Aditi pragma declarations - `aditi', `supp_magic', `context',
	`naive', `psn' (predicate semi-naive), `aditi_memo', `aditi_no_memo',
	`base_relation', `owner' and `index'.
	Separate out code to parse a predicate name and arity.

compiler/hlds_pred.m:
	Add predicates to identify Aditi procedures.
	Added markers `generate_inline' and `aditi_interface', which
	are used internally for Aditi code generation.
	Add an `owner' field to pred_infos, which is used for database
	security checks.
	Add a field to pred_infos to hold the list of indexes for a base
	relation.

compiler/make_hlds.m:
	Some pragmas must be exported if the corresponding predicates
	are exported, check this.
	Make sure stratification of Aditi procedures is checked.
	Predicates with a mode declaration but no type declaration
	are no longer assumed to be local.
	Set the `do_aditi_compilation' field of the module_info if there
	are any local Aditi procedures or base relations.
	Check that `--aditi' is set if Aditi compilation is required.

compiler/post_typecheck.m:
	Check that every Aditi predicate has an `aditi__state' argument,
	which is used to ensure sequencing of updates and that Aditi
	procedures are only called within transactions.

compiler/dnf.m:
	Changed the definition of disjunctive normal form slightly
	so that a call followed by some atomic goals not including
	any database calls is considered atomic. magic.m can handle
	this kind of goal, and it results in more efficient RL code.

compiler/hlds_module.m:
compiler/dependency_graph.m:
	Added dependency_graph__get_scc_entry_points which finds
	the procedures in an SCC which could be called from outside.
	Added a new field to the dependency_info, the
	aditi_dependency_ordering. This contains all Aditi SCCs of
	the original program, with multiple SCCs merged where
	possible to improve the effectiveness of differential evaluation
	and the low level RL optimizations.

compiler/hlds_module.m:
	Add a field to record whether there are any local Aditi procedures
	in the current module.
	Added versions of module_info_pred_proc_info and
	module_info_set_pred_proc_info which take a pred_proc_id,
	not a separate pred_id and proc_id.

compiler/polymorphism.m:
compiler/lambda.m:
	Make sure that predicates created for closures in Aditi procedures
	have the correct markers.

compiler/goal_util.m:
	Added goal_util__switch_to_disjunction,
	goal_util__case_to_disjunct (factored out from simplify.m)
	and goal_util__if_then_else_to_disjunction. These are
	require because supplementary magic sets can't handle
	if-then-elses or switches.

compiler/type_util.m:
	Added type_is_aditi_state/1.

compiler/mode_util.m:
	Added partition_args/5 which partitions a list of arguments
	into inputs and others.

compiler/inlining.m:
	Don't inline memoed procedures.
	Don't inline Aditi procedures into non-Aditi procedures.

compiler/intermod.m:
	Handle Aditi markers.
	Clean up handling of markers which should not appear in `.opt' files.

compiler/simplify.m:
	Export a slightly different interface for use by magic.m.
	Remove explicit quantifications where possible.
	Merge multiple nested quantifications.
	Don't report infinite recursion warnings for Aditi procedures.

compiler/prog_out.m:
	Generalised the code to output a module list to write any list.

compiler/code_gen.m:
compiler/arg_info.m:
	Don't process Aditi procedures.

compiler/mercury_compile.m:
	Call magic.m and rl_gen.m.
	Don't perform the low-level annotation passes on Aditi procedures.
	Remove calls to constraint.m - sometime soon a rewritten version
	will be called directly from deforestation.

compiler/passes_aux.m:
	Add predicates to process only non-Aditi procedures.

compiler/llds.m:
compiler/llds_out.m:
	Added new `code_addr' enum members, do_{det,semidet,nondet}_aditi_call,
	which are defined in extras/aditi/aditi.m.

compiler/call_gen.m:
	Handle generation of do_*_aditi_call.

compiler/llds_out.m:
	Write the RL code for the module as a constant char array
	in the `.c' file.

compiler/term_errors.m:
compiler/error_util.m:
	Move code to describe predicates into error_util.m
	Allow the caller to explicitly add line breaks.
	Added error_util:list_to_pieces to format a list of
	strings.
	Reordered some arguments for currying.

compiler/hlds_out.m:
	Don't try to print clauses if there are none.

runtime/mercury_init.h:
util/mkinit.c:
scripts/c2init.in:
	Added a function `mercury__load_aditi_rl_code()' to the generated
	`<module>_init.c' file which throws all the RL code for the program
	at the database. This should be called at connection time by
	`aditi__connect'.
	Added an option `--aditi' which controls the output
	`mercury__load_aditi_rl_code()'.

compiler/notes/compiler_design.html:
	Document the new files.

Mmakefile:
bindist/Mmakefile:
	Don't distribute extras/aditi yet.

New files:

compiler/magic.m:
compiler/magic_util.m:
	Supplementary magic sets transformation. Report errors
	for constructs that Aditi can't handle.

compiler/context.m:
	Supplementary context transformation.

compiler/rl_gen.m:
compiler/rl_relops.m:
	Aditi code generation.

compiler/rl_info.m:
	Code generator state.

compiler/rl.m:
	Intermediate RL representation.

compiler/rl_util:
	Predicates to collect information about RL instructions.

compiler/rl_dump.m:
	Print out the representation in rl.m.

compiler/rl_opt.m:
	Control low-level RL optimizations.

compiler/rl_block.m:
	Break a procedure into basic blocks.

compiler/rl_analyse.m:
	Generic dataflow analysis for RL procedures.

compiler/rl_liveness.m:
	Make sure all relations are initialised before used, clear
	references to relations that are no longer required.

compiler/rl_loop.m:
	Loop invariant removal.

compiler/rl_block_opt.m:
	CSE and instruction merging on basic blocks.

compiler/rl_key.m:
	Detect upper/lower bounds for which a goal could succeed.

compiler/rl_sort.m:
	Use indexing for joins and projections.
	Optimize away unnecessary sorting and indexing.

compiler/rl_stream.m:
	Detect relations which don't need to be materialised.

compiler/rl_code.m:
	RL bytecode definitions. Automatically generated from the Aditi
	header files.

compiler/rl_out.m:
compiler/rl_file.m:
	Output the RL bytecodes in binary to <module>.rlo (for use by Aditi)
	and in text to <module>.rla (for use by the RL interpreter).
	Also output the schema information if --generate-schemas is set.

compiler/rl_exprn.m:
	Generate bytecodes for join conditions.

extras/aditi/Mmakefile:
extras/aditi/aditi.m:
	Definitions of some Aditi library predicates and the
	interfacing and transaction processing code.
1998-12-06 23:49:14 +00:00
Zoltan Somogyi
cdc56d5fa4 Change the initialization sequence of the debugger to match more people's
Estimated hours taken: 2

Change the initialization sequence of the debugger to match more people's
expectations: it now reads, in order:

	the file named by the MERCURY_DEBUGGER_INIT environment variable
	~/.mdbrc
	.mdbrc

The first should exist; the others need not.

Note that since ~/.mdbrc is always sourced if it exists, you cannot put
anything in your ~/.mdbrc that interferes with the test cases in the
tests/debugger directory if you want your bootchecks to work.

doc/user_guide.texi:
	Document the initialization sequence. This completes the debugger
	invocation section.

scripts/mdb.in:
	Set up MERCURY_DEBUGGER_INIT before invoking the executable
	being debugged.

trace/mercury_trace_internal.c:
	Change to the above initialization sequence.
1998-11-13 09:31:11 +00:00
Zoltan Somogyi
795d5a7509 Make "p" alias to "print", and "P" alias to "print *".
Estimated hours taken: 0.02

scripts/mdbrc.in:
	Make "p" alias to "print", and "P" alias to "print *".
1998-11-13 04:41:06 +00:00
Fergus Henderson
322fc3065f Delete the definition of MERCURY_LPSOLVE, since it's long
Estimated hours taken: 0.25

scripts/mmc.in:
	Delete the definition of MERCURY_LPSOLVE, since it's long
	obsolete.
1998-11-05 10:51:32 +00:00
Peter Ross
2fd0c764d2 Changes to compile the compiler using compilers other then gcc.
Estimated hours taken: 30

Changes to compile the compiler using compilers other then gcc.  Tested
on 'cc -std1', 'cc -std1 -migrate' on the alphas, 'cc' and 'lcc' on the
sparcs.

boehm_gc/linux_threads.c:
    Ensure that the compilation unit isn't empty by always #including at
    least on file.

compiler/llds_out.m:
    Remove all remaining occurences of (const Word *).

compiler/mercury_compile.m:
    Call transform_llds.

compiler/options.m:
    Add the option max_jump_table_size.  This option is needed because
    lcc barfs when the jump_table for computed gotos size is over 128.

compiler/transform_llds.m:
    Transform computed_gotos whose table size is over
    max_jump_table_size to binary search down to computed gotos whose
    table size is less then or equal to max_jump_table_size.

doc/user_guide.texi:
    Document --max-jump-table-size.

library/benchmarking.m:
library/math.m:
library/private_builtin.m:
library/std_util.m:
    s/\\n/\\\\n/g so that we don't get line breaks in string constants.

library/io.m:
    Change an LVALUE_CAST to type Word as RHS of the expression gets
    cast to type Word.

scripts/mgnuc.in:
    lcc gets called with "-w" flag to avoid spurious warnings.  Also if
    --no-ansi is defined pass "-D__EXTENSIONS__" to the compiler to
    ensure that all of the header files are read.

trace/mercury_trace_internal.c:
    Add a cast to (Word *) because LHS of the expression has type (Word *)
1998-10-30 05:12:17 +00:00
Fergus Henderson
99b39fd3fc Fix a bug reported by Renaud Paquay <rpa@miscrit.be>.
Estimated hours taken: 0.5

Fix a bug reported by Renaud Paquay <rpa@miscrit.be>.

compiler/modules.m:
scripts/Mmake.rules:
	When invoking Mmake recursively, pass down the values of
	MC and ALL_MCFLAGS, in case their values were overridden
	on the command line.
1998-10-29 16:25:55 +00:00
Fergus Henderson
adec3fb048 Change the default setting of RM_C so that by default Mmake
Estimated hours taken: 0.75

Change the default setting of RM_C so that by default Mmake
no longer removes intermediate C files.  The reason for this
fix is two-fold: to fix performance problems on Windows
and elsewhere, and to avoid some race conditions that
occur with parallel makes caused by invoking make recursively,
as is necessary if the intermediate files are removed.
(The race condition occurs where you attempt to make foo.c
and bar.c in parallel, invoking two recursive makes;
if foo.c and bar.c both depend on baz.int, then you may
attempt to make baz.int twice simultaneously, which can
have unfortunate consequences.)

configure.in:
	Set DEFAULT_RM_C to `:', and put some comments there explaining why.

scripts/Mmake.vars.in:
	Initialize RM_C to the autoconf variable DEFAULT_RM_C.

doc/reference_manual.texi:
	Update the list of bugs and limitations in the nested modules chapter:
	using parallel makes is no longer a problem.  I also added some
	other entries to the list, corresponding to outstanding bug reports.
1998-10-29 16:07:26 +00:00
Fergus Henderson
4240cbc000 Port Mercury to egcs-1.1 on sparc-sun-solaris2.6.
Estimated hours taken: 3

Port Mercury to egcs-1.1 on sparc-sun-solaris2.6.

configure.in:
	When using non-local gotos and egcs on sparc,
	include `-fno-function-cse -fno-gcse' in cflags.

scripts/mgnuc.in:
	Work-around some gcc internal errors for egcs-1.1 on sparc.
1998-10-29 14:10:35 +00:00
Fergus Henderson
61c37766b1 Fix a bug reported by Warwick Harvey <wharvey@cs.monash.edu.au>.
Estimated hours taken: 0.25

Fix a bug reported by Warwick Harvey <wharvey@cs.monash.edu.au>.

scripts/Mmakefile:
	Make sure we delete the installed `mmake' file, if any,
	before (re)installing it, to avoid problems that can occur
	if we overwrite the script while it is still running.
1998-10-29 12:17:41 +00:00
Peter Ross
5e0a5c067e Update the file.
Estimated hours taken: 0.1

.cvsignore:
    Update the file.
1998-10-26 04:11:33 +00:00
Peter Ross
12c8ec2693 Changes required to get the samples directory to compile using lcc in
Estimated hours taken: 60

Changes required to get the samples directory to compile using lcc in
the grade `none.gc'.

compiler/llds_out.m:
    Add a pass to make sure that the constants are all declared (with
    a complete type) before they are initialised.  We can't just
    forward declare each constant immediately before it is used in an
    initializer, as was done previously, because at that point we don't
    know the type of the constant, and ANSI C doesn't allow forward
    declarations of static variables with incomplete types.

    Also change data_ptr to type (Word *).  This is because (Word *) is
    a superset of (const Word *) and it is a non-trivial task to get the
    consts output in the correct places.  Hopefully consts will be
    output when I get the compiler to bootstrap using lcc.

scripts/mgnuc.in:
    Don't warn about casts which remove the const. ie (const char *) to
    (char *)

runtime/mercury_string.h:
    Get rid of a cast.

runtime/mercury_tags.h:
    Get rid of some of the const casts.

util/mkinit.c:
    Make mkinit compile using lcc.
1998-10-19 01:24:20 +00:00
Zoltan Somogyi
2ad286823d Fix silly mistake: s:$(INSTALL_LIBDIR/mdb):$(INSTALL_LIBDIR)/mdb:
Estimated hours taken: 0.1

scripts/Mmakefile:
	Fix silly mistake: s:$(INSTALL_LIBDIR/mdb):$(INSTALL_LIBDIR)/mdb:
1998-10-17 06:14:25 +00:00
Zoltan Somogyi
8a0ceb49aa This checkin has several major purposes, set out in the sections below,
Estimated hours taken: 240

This checkin has several major purposes, set out in the sections below,
all connected with the implementation of the new debugger command set.

DOCUMENT NEW DEBUG COMMAND SET

doc/user_guide.texi:
	Add a new section on the debugger. The description of the commands
	is complete, but some of the background sections, and the section
	about how to build debuggable executables, are not yet done.

	Update the documentation of the tracing options.

doc/generate_mdb_doc:
	A new shell script that automatically converts some of the new
	sections of the user guide into the online documentation of the
	debugger.

doc/mdb_categories:
	The fixed initial part of the online documentation.

doc/Mmakefile:
	Add rules for creating mdb_doc, the file that is the online
	documentation of the debugger, and for installing it together
	with mdbrc.

Mmake.common.in:
	Define INSTALL_DOC_DIR for doc/Mmakefile.

scripts/mdbrc.in:
	A debugger command script that reads in the online documentation
	and then defines some standard aliases.

configure.in:
	Define the variable that scripts/mdb.in and scripts/mdbrc.in use
	to find the right files, and get configure to perform the
	substitutions.

configure.in:
scripts/mdb:
scripts/mdb.in:
	Replace mdb with mdb.in. Mdb is now created during configuration
	from mdb.in, filling in the name of the file that contains the default
	debugger initialization commands.

util/info_to_mdb.c:
	A program that does most of the work involved in automatically
	converting user guide sections into online documentation.
	(This couldn't easily be written in sh, because sh's read
	command has no notion of pushback.)

util/Mmakefile:
	Add info_to_mdb to the list of targets.

tools/bootcheck:
	Make sure that the tests in tests/debugger are executed with an
	initialization setup that is equivalent to what users will see
	by default.

REORGANIZE TRACING OPTIONS

compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
compiler/trace.m:
	Reorganize the handling of trace levels around the new options
	--trace-internal, --trace-redo, and --trace-return.

compiler/*.m:
	Use the new ways of getting at trace levels.

tests/hard_coded/typeclasses/Mmakefile:
	s/--trace all/--trace deep/

SUPPORT RETRY

compiler/trace.m:
	After every call to MR_trace(), emit code that checks whether it
	should jump away, and if yes, performs the jump. This is used to
	implement retry. (The debugger cannot execute the jump itself
	because it is in the wrong C stack frame.)

compiler/llds.m:
compiler/continuation_info.m:
compiler/stack_layout.m:
	Modify the data structures that record information about live
	value at program points, to record the identity of each variable.
	This is necessary for the implementation of the restart command,
	since we do not want to confuse two distinct variables just because
	they have the same name. For example, a variable whose name is X
	and number is 5 is now recorded in the name array as "5:X".

	Clean up the data structure a bit, so that we don't have to store
	dummy names for values that are not variables.

compiler/*.m:
	Minor changes to conform to the data structure changes.

runtime/mercury_stack_layout.h:
	Redefine an existing macro to strip away the initial number: prefix
	from the "name" of a variable (keeping its original function on
	changed data), and add a new one to access the raw unstripped data.

runtime/mercury_init.h:
runtime/mercury_wrapper.h:
	Update the prototype of MR_trace_{fake,real}, and the type of the
	global that points to them.

runtime/mercury_layout_util.h:
	Add an extra function, MR_get_register_number, for use by retry.

USE FIXED STACK SLOTS FOR TRACE INFO

compiler/code_gen.m:
compiler/code_info.m:
compiler/live_vars.m:
compiler/trace.m:
	If execution tracing is enabled, reserve the first few stack slots
	to hold the event number of the call event, the call number, the
	call depth, the redo layout structure address (if generating redo
	events) and the from_full flag at the time of call (if we are doing
	shallow tracing). By allocating the first four of these to fixed stack
	slots, the debugger knows where to look for them without having
	to be told. It finds out the location of the fifth, if needed,
	from a new slot in the proc layout structure. (It is not possible
	to allocate all five to fixed stack slots without wasting stack space
	in some cases.)

compiler/trace.m:
	Remove from the call to MR_trace the parameters that are now in fixed
	stack slots, since MR_trace can now look them up itself.

compiler/continuation_info.m:
compiler/stack_layout.m:
	Add an extra field to the proc_layout_info. If the module is shallow
	traced, this field says which stack slot holds the saved value of
	MR_from_full. If it is not shallow traced, this field says that
	there is no such stack slot.

runtime/mercury_stack_layout.h:
	Add macros for accessing the fixed stack slots holding the event
	number of the call event, the call number, the call depth, and,
	at a redo event, the redo layout structure address.

	Support the new field in proc layouts that gives the location of the
	from-full flag (if any).

runtime/mercury_trace_base.[ch]:
trace/mercury_trace.[ch]:
	Remove the call number and call depth arguments from MR_trace
	and its avatars, since this info is now in fixed stack slots
	in every procedure that can call MR_trace. This should reduce
	the size of the executable significantly, since there are lots
	of calls to MR_trace.

runtime/mercury_init.h:
runtime/mercury_wrapper.h:
	Update the prototype of MR_trace_{fake,real}, and the type of the
	global that points to them.

START NUMBERING FRAMEVARS FROM ONE

compiler/code_info.m:
compiler/live_vars.m:
compiler/llds_out.m:
compiler/trace.m:
	Start numbering framevars from 1 internally to the compiler;
	the runtime already starts from 1. This simplifies several tasks.

ADD REDO EVENTS

compiler/trace.m:
compiler/code_gen.m:
	Before the code that executes "succeed()", emit code to push a
	a temp nondet frame whose redoip points to a label in the runtime
	that calls MR_trace for a REDO event and then fails, provided
	--trace-redo is set.

compiler/llds.m:
	Add a new code address constant, do_trace_redo_fail, which stands
	for the address in the trace system to which calls MR_trace for
	the redo event and then fails.

compiler/trace.m:
compiler/llds_out.m:
	Provided we are doing redo tracing, fill in the slot that holds
	the layout information for the REDO event.

compiler/*.m:
	Minor changes to conform to handle the new code address constant.

browser/debugger_interface.m:
	Add redo to trace_port_type.

runtime/mercury_trace_base.[ch]:
	Add a C module containing the code that calls MR_trace for REDO
	events.

ENSURE THAT INPUT ARGUMENTS ARE ALWAYS VISIBLE

compiler/trace.m:
	When generating the set of live variables at internal ports,
	the variables that are in the pre-death set of the goal into which
	we are entering may not be available. However, the variables in the
	pre-death set that are also in the resume vars set will be available,
	so now include info about them in the layout structure for the event.
	Since with tracing the non-clobbered input args are in all resume vars
	sets, this ensures that these input args will be available from all
	internal events.

compiler/code_info.m:
	Export a previously internal predicate (current_resume_point_vars)
	to make this possible.

BUG FIX: WANT RETURN LAYOUTS

compiler/globals.m:
compiler/call_gen.m:
compiler/code_info.m:
compiler/mercury_compile.m:
	Add a new pred globals__want_return_layouts, which says whether the
	compiler should generate layout structures for call returns. This pred
	centralizes the several previous copies of the test. One of those
	copies (the one in call_gen) was faulty, leading to a bug: in the
	presence of execution tracing but the absence of accurate gc,
	information about the variables that are live at the call return
	wasn't being gathered properly.

BUG FIX: #include mercury_trace_base.h

compiler/llds_out.m:
	#include mercury_trace_base.h, not mercury_trace.h, since now
	mercury_trace_base.h defines everything directly accessible from
	modules compiled with tracing.

RECAST MERCURY_TRACE_UTIL AS MERCURY_LAYOUT_UTIL

runtime/mercury_trace_util.[ch]:
runtime/mercury_layout_util.[ch]:
	Rename this module from trace_util to layout_util, since it is also
	used by the native garbage collector. Remove "trace" from the names
	of functions.

	Get rid of the global variable MR_saved_regs, and instead thread
	a pointer to this data structure through the relevant functions
	as an extra argument.

	Add a lot more documentation in the header file.

runtime/Mmakefile:
	Reflect the module rename.

runtime/*.c:
	Refer to the new module.

DELETE EASY-TO-MISUSE MACROS

runtime/mercury_stacks.h:
	Delete the based_framevar and based_detstackvar macros, since their
	continued use can lead to off-by-one errors, and the saved_framevar
	and saved_detstackvar macros, since they are no longer used.

runtime/*.c
	Update any references to any macros removed from mercury_stacks.h.

MISC RUNTIME CHANGES

runtime/mercury_trace_base.[ch]:
trace/mercury_trace*.[ch]:
	Make typedef'd names conform to the naming convention.

	Make MR_trace_call_{seqno,depth} consistently Unsigned, rather than
	sometimes Word and sometimes Unsigned.

FIX BUG: MAKE THE DEBUGGER PRINT TO STDOUT, NOT THE CURRENT STREAM

library/io.m:
	Export to C code the predicates that return the identities and types
	of stdin, stdout and stderr, as well as io__print/[34].

library/std_util.m:
	Export to C code a predicate that returns the type_info for the
	type stdutil:type_info. This type_info is required if C code
	wants to invoke make_permanent on any type_info structure,
	as the debugger does.

runtime/mercury_init.h:
	Add extern declarations for the C functions now exported from io.m.

runtime/mercury_wrapper.[ch]:
	Add new global variables to hold the addresses of these C functions.

runtime/mercury_layout_util.c:
	Use indirect calls through these global variables to print Mercury
	values, instead of lower-level code.

util/mkinit.c:
	Assign the addresses of the functions exported from io.m to the
	global variables defined in mercury_wrapper.h.

BUG FIX: STACK TRACE FUNCTIONS DEPEND ON THE LABEL TABLE

runtime/mercury_stack_trace.c:
	On entry to any of the functions exported from this module,
	ensure that the label table is loaded by calling do_init_modules.
	Without a filled-in label table, the stack trace will not be able to
	find any stack layout info.

BUG FIX: REMOVE BROWSER/*.C

configure.in:
	When removing .c files generated by the C compiler, remove those
	in the browser directory as well as the compiler, library and
	profiler directories.

IMPLEMENT NEW DEBUGGER COMMAND SET

runtime/mercury_stack_trace.[ch]:
	Factor out the code that prints the id of a procedure into a function
	of its own, so that it can also be used from the debugger, ensuring
	appearance commonality.

	Add more documentation in the header file.

trace/mercury_trace_internal.c:
	Implement the proposed command set. Command names are now words,
	and several commands now have options allowing the user to override
	the default print level or strictness of the command, or the
	invocation conditions or action of a break point. Allows control
	over command echoing and the scrolling of sequences of event reports.
	Supports aliases, command file sourcing etc. Implements the retry
	command, using the info in the fixed stack slots.

trace/mercury_trace.[ch]:
	Extend the trace controls to support the new functionalities
	required by the new debugger language, which are print levels,
	variable-strictness commands, a more flexible finish command,
	and the retry command.

	Pass the command structure to MR_trace_event_report, since
	the user can now forcibly terminate the scrolling of reports.

trace/mercury_trace_alias.[ch]:
	New module to manage aliases for the debugger.

trace/mercury_trace_help.[ch]:
	New module to interface to browser/help.m.

trace/mercury_trace_spy.[ch]:
	New module to manage break points. The test of whether an event
	matches a break point is now much more efficient than before.
	The new module also allows several breakpoints with different
	actions and different invocation conditions (e.g. all ports,
	entry port, interface ports or specific (possibly internal) port)
	to be defined on the same procedure.

trace/mercury_trace_tables.[ch]:
	New module to manage a table of the debuggable modules, in which
	each such module is linked to the list of the layouts of all the
	procedures defined in that module. This information allows the
	debugger to turn the name of a predicate/function (possibly together
	with its arity and mode number) into the procedure layout structure
	required by the spy point module. Eventually it may also be useful
	in supplying lists of identifiers for command line completion.

	Modules for which no stack layout information is available will
	not be included in the table, since do_init_modules will not
	register any labels for them in the label table.

trace/Mmakefile:
	Mention the new files.

runtime/mercury_array_macros.h:
	A new file holding macros that can be useful in more than one module.

runtime/Mmakefile:
	Mention the new file.

runtime/mercury_conf.h.in:
	Mention a new configuration macro, MR_CANNOT_USE_STRUCTURE_ASSIGNMENT,
	used by runtime/mercury_array_macros.h.

configure.in:
	Find out whether we need to define MR_CANNOT_USE_STRUCTURE_ASSIGNMENT.

ADD TRACE DEPTH HISTOGRAMS

runtime/mercury_conf_param.h:
	Document MR_TRACE_HISTOGRAM.

runtime/mercury_trace_base.[ch]:
	Define the data structures for the histogram, and print the histogram
	when a traced program exits if MR_TRACE_HISTOGRAM is set.

trace/mercury_trace.[ch]:
	If MR_TRACE_HISTOGRAM is defined, record a count of the number of
	events at each depth. This information can help us evaluate space-time
	tradeoffs.

FACTOR OUT SHELL CODE HANDLING GRADE IMPLICATIONS

scripts/final_grade_options.sh-subr:
	A new file to contain any code that implements implications between
	grade flags; currently implements the implication debug -> use trail.

scripts/mgnuc.in:
scripts/ml.in:
	Replace the code that is now in final_grade_options.sh-subr with
	an inclusion of final_grade_options.sh-subr.

configure.in:
	Handle final_grade_options.sh-subr as {init,parse}_grade_options.sh-subr
	are handled.

SIMPLIFY THE MAINTAINANCE OF CONSISTENCY BETWEEN DEBUGGER CODE AND DOCUMENTATION

doc/Mmakefile:
	Add rules for creating mdb_command_list, a C code fragment
	that can included manually in trace/mercury_trace_internal.c
	to supply the list of valid commands, and mdb_command_test.inp,
	which is a list of invalid invocations of debugger commands,
	which tests whether the help message for such invocations
	can be located as expected.

doc/generate_mdb_command_list:
doc/generate_mdb_command_test:
	Awk scripts to create mdb_command_list and mdb_command_test.inp
	respectively from mdb_doc.

tools/bootcheck:
	Copy mdb_command_test.inp from doc to tests/debugger.

tests/debugger/Mmakefile:
	Add a new test that checks whether we get an internal error, unable
	to locate the right help node, for each invalid command invocation in
	mdb_command_test.inp.

UPDATE TEST CASES

tests/debugger/Mmakefile:
	Reenable queens. Conform to the new set of options.

tests/debugger/*.inp:
tests/debugger/*.exp:
	Update the inputs and expected outputs of the debugger test cases
	to use the new command set and output formats.
1998-10-16 06:20:28 +00:00
Zoltan Somogyi
16f3d4ccaa This checkin has several major purposes, set out in the sections below,
Estimated hours taken: 240

This checkin has several major purposes, set out in the sections below,
all connected with the implementation of the new debugger command set.

DOCUMENT NEW DEBUG COMMAND SET

doc/user_guide.texi:
	Add a new section on the debugger. The description of the commands
	is complete, but some of the background sections, and the section
	about how to build debuggable executables, are not yet done.

	Update the documentation of the tracing options.

doc/generate_mdb_doc:
	A new shell script that automatically converts some of the new
	sections of the user guide into the online documentation of the
	debugger.

doc/mdb_categories:
	The fixed initial part of the online documentation.

doc/Mmakefile:
	Add rules for creating mdb_doc, the file that is the online
	documentation of the debugger, and for installing it together
	with mdbrc.

Mmake.common.in:
	Define INSTALL_DOC_DIR for doc/Mmakefile.

scripts/mdbrc.in:
	A debugger command script that reads in the online documentation
	and then defines some standard aliases.

configure.in:
	Define the variable that scripts/mdb.in and scripts/mdbrc.in use
	to find the right files, and get configure to perform the
	substitutions.

configure.in:
scripts/mdb:
scripts/mdb.in:
	Replace mdb with mdb.in. Mdb is now created during configuration
	from mdb.in, filling in the name of the file that contains the default
	debugger initialization commands.

util/info_to_mdb.c:
	A program that does most of the work involved in automatically
	converting user guide sections into online documentation.
	(This couldn't easily be written in sh, because sh's read
	command has no notion of pushback.)

util/Mmakefile:
	Add info_to_mdb to the list of targets.

tools/bootcheck:
	Make sure that the tests in tests/debugger are executed with an
	initialization setup that is equivalent to what users will see
	by default.

REORGANIZE TRACING OPTIONS

compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
compiler/trace.m:
	Reorganize the handling of trace levels around the new options
	--trace-internal, --trace-redo, and --trace-return.

compiler/*.m:
	Use the new ways of getting at trace levels.

tests/hard_coded/typeclasses/Mmakefile:
	s/--trace all/--trace deep/

SUPPORT RETRY

compiler/trace.m:
	After every call to MR_trace(), emit code that checks whether it
	should jump away, and if yes, performs the jump. This is used to
	implement retry. (The debugger cannot execute the jump itself
	because it is in the wrong C stack frame.)

compiler/llds.m:
compiler/continuation_info.m:
compiler/stack_layout.m:
	Modify the data structures that record information about live
	value at program points, to record the identity of each variable.
	This is necessary for the implementation of the restart command,
	since we do not want to confuse two distinct variables just because
	they have the same name. For example, a variable whose name is X
	and number is 5 is now recorded in the name array as "5:X".

	Clean up the data structure a bit, so that we don't have to store
	dummy names for values that are not variables.

compiler/*.m:
	Minor changes to conform to the data structure changes.

runtime/mercury_stack_layout.h:
	Redefine an existing macro to strip away the initial number: prefix
	from the "name" of a variable (keeping its original function on
	changed data), and add a new one to access the raw unstripped data.

runtime/mercury_init.h:
runtime/mercury_wrapper.h:
	Update the prototype of MR_trace_{fake,real}, and the type of the
	global that points to them.

runtime/mercury_layout_util.h:
	Add an extra function, MR_get_register_number, for use by retry.

USE FIXED STACK SLOTS FOR TRACE INFO

compiler/code_gen.m:
compiler/code_info.m:
compiler/live_vars.m:
compiler/trace.m:
	If execution tracing is enabled, reserve the first few stack slots
	to hold the event number of the call event, the call number, the
	call depth, the redo layout structure address (if generating redo
	events) and the from_full flag at the time of call (if we are doing
	shallow tracing). By allocating the first four of these to fixed stack
	slots, the debugger knows where to look for them without having
	to be told. It finds out the location of the fifth, if needed,
	from a new slot in the proc layout structure. (It is not possible
	to allocate all five to fixed stack slots without wasting stack space
	in some cases.)

compiler/trace.m:
	Remove from the call to MR_trace the parameters that are now in fixed
	stack slots, since MR_trace can now look them up itself.

compiler/continuation_info.m:
compiler/stack_layout.m:
	Add an extra field to the proc_layout_info. If the module is shallow
	traced, this field says which stack slot holds the saved value of
	MR_from_full. If it is not shallow traced, this field says that
	there is no such stack slot.

runtime/mercury_stack_layout.h:
	Add macros for accessing the fixed stack slots holding the event
	number of the call event, the call number, the call depth, and,
	at a redo event, the redo layout structure address.

	Support the new field in proc layouts that gives the location of the
	from-full flag (if any).

runtime/mercury_trace_base.[ch]:
trace/mercury_trace.[ch]:
	Remove the call number and call depth arguments from MR_trace
	and its avatars, since this info is now in fixed stack slots
	in every procedure that can call MR_trace. This should reduce
	the size of the executable significantly, since there are lots
	of calls to MR_trace.

runtime/mercury_init.h:
runtime/mercury_wrapper.h:
	Update the prototype of MR_trace_{fake,real}, and the type of the
	global that points to them.

START NUMBERING FRAMEVARS FROM ONE

compiler/code_info.m:
compiler/live_vars.m:
compiler/llds_out.m:
compiler/trace.m:
	Start numbering framevars from 1 internally to the compiler;
	the runtime already starts from 1. This simplifies several tasks.

ADD REDO EVENTS

compiler/trace.m:
compiler/code_gen.m:
	Before the code that executes "succeed()", emit code to push a
	a temp nondet frame whose redoip points to a label in the runtime
	that calls MR_trace for a REDO event and then fails, provided
	--trace-redo is set.

compiler/llds.m:
	Add a new code address constant, do_trace_redo_fail, which stands
	for the address in the trace system to which calls MR_trace for
	the redo event and then fails.

compiler/trace.m:
compiler/llds_out.m:
	Provided we are doing redo tracing, fill in the slot that holds
	the layout information for the REDO event.

compiler/*.m:
	Minor changes to conform to handle the new code address constant.

browser/debugger_interface.m:
	Add redo to trace_port_type.

runtime/mercury_trace_base.[ch]:
	Add a C module containing the code that calls MR_trace for REDO
	events.

ENSURE THAT INPUT ARGUMENTS ARE ALWAYS VISIBLE

compiler/trace.m:
	When generating the set of live variables at internal ports,
	the variables that are in the pre-death set of the goal into which
	we are entering may not be available. However, the variables in the
	pre-death set that are also in the resume vars set will be available,
	so now include info about them in the layout structure for the event.
	Since with tracing the non-clobbered input args are in all resume vars
	sets, this ensures that these input args will be available from all
	internal events.

compiler/code_info.m:
	Export a previously internal predicate (current_resume_point_vars)
	to make this possible.

BUG FIX: WANT RETURN LAYOUTS

compiler/globals.m:
compiler/call_gen.m:
compiler/code_info.m:
compiler/mercury_compile.m:
	Add a new pred globals__want_return_layouts, which says whether the
	compiler should generate layout structures for call returns. This pred
	centralizes the several previous copies of the test. One of those
	copies (the one in call_gen) was faulty, leading to a bug: in the
	presence of execution tracing but the absence of accurate gc,
	information about the variables that are live at the call return
	wasn't being gathered properly.

BUG FIX: #include mercury_trace_base.h

compiler/llds_out.m:
	#include mercury_trace_base.h, not mercury_trace.h, since now
	mercury_trace_base.h defines everything directly accessible from
	modules compiled with tracing.

RECAST MERCURY_TRACE_UTIL AS MERCURY_LAYOUT_UTIL

runtime/mercury_trace_util.[ch]:
runtime/mercury_layout_util.[ch]:
	Rename this module from trace_util to layout_util, since it is also
	used by the native garbage collector. Remove "trace" from the names
	of functions.

	Get rid of the global variable MR_saved_regs, and instead thread
	a pointer to this data structure through the relevant functions
	as an extra argument.

	Add a lot more documentation in the header file.

runtime/Mmakefile:
	Reflect the module rename.

runtime/*.c:
	Refer to the new module.

DELETE EASY-TO-MISUSE MACROS

runtime/mercury_stacks.h:
	Delete the based_framevar and based_detstackvar macros, since their
	continued use can lead to off-by-one errors, and the saved_framevar
	and saved_detstackvar macros, since they are no longer used.

runtime/*.c
	Update any references to any macros removed from mercury_stacks.h.

MISC RUNTIME CHANGES

runtime/mercury_trace_base.[ch]:
trace/mercury_trace*.[ch]:
	Make typedef'd names conform to the naming convention.

	Make MR_trace_call_{seqno,depth} consistently Unsigned, rather than
	sometimes Word and sometimes Unsigned.

FIX BUG: MAKE THE DEBUGGER PRINT TO STDOUT, NOT THE CURRENT STREAM

library/io.m:
	Export to C code the predicates that return the identities and types
	of stdin, stdout and stderr, as well as io__print/[34].

library/std_util.m:
	Export to C code a predicate that returns the type_info for the
	type stdutil:type_info. This type_info is required if C code
	wants to invoke make_permanent on any type_info structure,
	as the debugger does.

runtime/mercury_init.h:
	Add extern declarations for the C functions now exported from io.m.

runtime/mercury_wrapper.[ch]:
	Add new global variables to hold the addresses of these C functions.

runtime/mercury_layout_util.c:
	Use indirect calls through these global variables to print Mercury
	values, instead of lower-level code.

util/mkinit.c:
	Assign the addresses of the functions exported from io.m to the
	global variables defined in mercury_wrapper.h.

BUG FIX: STACK TRACE FUNCTIONS DEPEND ON THE LABEL TABLE

runtime/mercury_stack_trace.c:
	On entry to any of the functions exported from this module,
	ensure that the label table is loaded by calling do_init_modules.
	Without a filled-in label table, the stack trace will not be able to
	find any stack layout info.

BUG FIX: REMOVE BROWSER/*.C

configure.in:
	When removing .c files generated by the C compiler, remove those
	in the browser directory as well as the compiler, library and
	profiler directories.

IMPLEMENT NEW DEBUGGER COMMAND SET

runtime/mercury_stack_trace.[ch]:
	Factor out the code that prints the id of a procedure into a function
	of its own, so that it can also be used from the debugger, ensuring
	appearance commonality.

	Add more documentation in the header file.

trace/mercury_trace_internal.c:
	Implement the proposed command set. Command names are now words,
	and several commands now have options allowing the user to override
	the default print level or strictness of the command, or the
	invocation conditions or action of a break point. Allows control
	over command echoing and the scrolling of sequences of event reports.
	Supports aliases, command file sourcing etc. Implements the retry
	command, using the info in the fixed stack slots.

trace/mercury_trace.[ch]:
	Extend the trace controls to support the new functionalities
	required by the new debugger language, which are print levels,
	variable-strictness commands, a more flexible finish command,
	and the retry command.

	Pass the command structure to MR_trace_event_report, since
	the user can now forcibly terminate the scrolling of reports.

trace/mercury_trace_alias.[ch]:
	New module to manage aliases for the debugger.

trace/mercury_trace_help.[ch]:
	New module to interface to browser/help.m.

trace/mercury_trace_spy.[ch]:
	New module to manage break points. The test of whether an event
	matches a break point is now much more efficient than before.
	The new module also allows several breakpoints with different
	actions and different invocation conditions (e.g. all ports,
	entry port, interface ports or specific (possibly internal) port)
	to be defined on the same procedure.

trace/mercury_trace_tables.[ch]:
	New module to manage a table of the debuggable modules, in which
	each such module is linked to the list of the layouts of all the
	procedures defined in that module. This information allows the
	debugger to turn the name of a predicate/function (possibly together
	with its arity and mode number) into the procedure layout structure
	required by the spy point module. Eventually it may also be useful
	in supplying lists of identifiers for command line completion.

	Modules for which no stack layout information is available will
	not be included in the table, since do_init_modules will not
	register any labels for them in the label table.

trace/Mmakefile:
	Mention the new files.

runtime/mercury_array_macros.h:
	A new file holding macros that can be useful in more than one module.

runtime/Mmakefile:
	Mention the new file.

runtime/mercury_conf.h.in:
	Mention a new configuration macro, MR_CANNOT_USE_STRUCTURE_ASSIGNMENT,
	used by runtime/mercury_array_macros.h.

configure.in:
	Find out whether we need to define MR_CANNOT_USE_STRUCTURE_ASSIGNMENT.

ADD TRACE DEPTH HISTOGRAMS

runtime/mercury_conf_param.h:
	Document MR_TRACE_HISTOGRAM.

runtime/mercury_trace_base.[ch]:
	Define the data structures for the histogram, and print the histogram
	when a traced program exits if MR_TRACE_HISTOGRAM is set.

trace/mercury_trace.[ch]:
	If MR_TRACE_HISTOGRAM is defined, record a count of the number of
	events at each depth. This information can help us evaluate space-time
	tradeoffs.

FACTOR OUT SHELL CODE HANDLING GRADE IMPLICATIONS

scripts/final_grade_options.sh-subr:
	A new file to contain any code that implements implications between
	grade flags; currently implements the implication debug -> use trail.

scripts/mgnuc.in:
scripts/ml.in:
	Replace the code that is now in final_grade_options.sh-subr with
	an inclusion of final_grade_options.sh-subr.

configure.in:
	Handle final_grade_options.sh-subr as {init,parse}_grade_options.sh-subr
	are handled.

SIMPLIFY THE MAINTAINANCE OF CONSISTENCY BETWEEN DEBUGGER CODE AND DOCUMENTATION

doc/Mmakefile:
	Add rules for creating mdb_command_list, a C code fragment
	that can included manually in trace/mercury_trace_internal.c
	to supply the list of valid commands, and mdb_command_test.inp,
	which is a list of invalid invocations of debugger commands,
	which tests whether the help message for such invocations
	can be located as expected.

doc/generate_mdb_command_list:
doc/generate_mdb_command_test:
	Awk scripts to create mdb_command_list and mdb_command_test.inp
	respectively from mdb_doc.

tools/bootcheck:
	Copy mdb_command_test.inp from doc to tests/debugger.

tests/debugger/Mmakefile:
	Add a new test that checks whether we get an internal error, unable
	to locate the right help node, for each invalid command invocation in
	mdb_command_test.inp.

UPDATE TEST CASES

tests/debugger/Mmakefile:
	Reenable queens. Conform to the new set of options.

tests/debugger/*.inp:
tests/debugger/*.exp:
	Update the inputs and expected outputs of the debugger test cases
	to use the new command set and output formats.
1998-10-16 06:20:21 +00:00
David Overton
ed91b801be Fix some scripts in the tools directory to work with the new
Estimated hours taken: 0.5

Fix some scripts in the tools directory to work with the new
directories and library names.

tools/binary:
tools/binary_step:
tools/linear:
	Update these scripts to work properly with the new browser and
	trace directories and the renamed libraries.

Mmake.common.in:
scripts/c2init.in:
scripts/ml.in:
	Add tools/binary, tools/binary_step and tools/linear to the
	list of files that know about library names.
1998-10-09 05:41:58 +00:00
Thomas Conway
2b4f16bb9b Remove mint since it isn't very useful anymore, is buggy, and
Estimated hours taken: 0.2

Remove mint since it isn't very useful anymore, is buggy, and
has been surplanted by the library reference manual.

scripts/mint.in:
	removed.

mercury/configure.in:
bindist/bindist.Mmakefile.in:
bindist/bindist.configure.in:
scripts/Mmakefile:
	remove references to `mint' and `mint.in'.
1998-10-06 05:36:15 +00:00
Zoltan Somogyi
f633c977f6 Update the comments about the other locations that know the names of
Estimated hours taken: 0.2

Mmake.common.in:
scripts/ml.in:
tools/bootcheck:
	Update the comments about the other locations that know the names of
	the libraries, now that c2init knows them too.

scripts/c2init.in:
	Add a comment about the other locations.
1998-10-01 09:11:10 +00:00
Fergus Henderson
1f6694098b Fix a bug introduced in zs's change to add two new directories.
Estimated hours taken: 0.5

Fix a bug introduced in zs's change to add two new directories.

scripts/c2init.in:
	Update the list of `.init' files to match the new names
	and to include the init file for the `browser' library.
1998-10-01 04:19:49 +00:00
Zoltan Somogyi
8ddce575d4 Introduce two new directories, trace and browser, containing libraries
Estimated hours taken: 10

Introduce two new directories, trace and browser, containing libraries
holding the C and Mercury code of the debugger respectively. (Although
the browser directory does not have a browser in it yet, the browser
should soon become its biggest component.) Take the opportunity to
rename the existing libraries, for consistency.

After this change, the linking order becomes:

	the object of the auto-generated init file
	program object files
	trace library (libmer_trace.a)
	browser library (libmer_browser.a)
	standard library (libmer_std.a)
	runtime library (libmer_rt.a)
	Boehm collector (libgc.a)

To avoid circularities, libraries cannot contain direct calls to
any routines that are defined in libraries (or object files) that
occur earlier in the above list.  Any such calls must be made into
indirect calls via function pointers.

In particular, there was a circularity caused by the library calling
MR_trace() which invokes the tracer which in turn invokes the
library.  This circularity was broken by having MR_trace(),
which is defined in the runtime, call the tracer indirectly via
a global variable named MR_trace_func_ptr.  This global variable
is initialized by the auto-generated *_init.c file.

To avoid linking in the tracer even when it is not being used,
this global variable is only set to point to MR_trace_real()
if you're using a debugging grade or if c2init was invoked
with the `-t' flag.  Otherwise it is set to MR_trace_fake()
which just prints an error message telling the user to
rebuild the executable with debugging enabled.

Makefile.DLLs:
	Reserve random locations for the two new libraries. Whether they work
	will be decided by testing on Windows.

Mmake.common.in:
	Add variables naming the new directories, and create variables
	naming the libraries.

Mmakefile:
	Add targets for the new directories, and modify existing rules
	as appropriate.

browser/Mmakefile:
	Mmakefile for the new directory, modelled on library/Mmakefile.

browser/browser_library.m:
	Umbrella file for the new directory, modelled on library/library.m.

{browser,library}/debugger_interface.m:
	Moved this file from library to browser without change.

browser/help.m:
	A new module for the help system of the debugger. Not yet used.

compiler/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate.

compiler/mercury_compile.m:
	If we are doing tracing, then pass -t instead of -i to c2init.

compiler/modules.m:
	When generating the .dep file, get the grade flags passed to c2init.

doc/Mmakefile:
	Remove the special treatment of library/debugger_interface.m.

library/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate, and to conform to the new name of the library.

library/library.m:
	Do not import debugger_interface.

profiler/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate.

runtime/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate, and to conform to the new name of the library.

	Remove references to files being moved to the trace directory.

runtime/mercury_init.h:
	Refer to the automatically generated dll header file by its new name
	(renamed because the runtime library is renamed).

	Add declarations to support the new global variable MR_trace_func_ptr.

runtime/mercury_memory_handlers.c:
runtime/mercury_memory_zones.c:
runtime/mercury_misc.c:
	Remove inappropriate #includes of "mercury_trace.h", and substitute
	a #include of "mercury_trace_base.h" if necessary.

{runtime,trace}/mercury_trace.[ch]:
{runtime,trace}/mercury_trace_external.[ch]:
{runtime,trace}/mercury_trace_internal.[ch]:
	Move these files from the runtime to the trace directory.

	The only changes are the removal from mercury_trace.h of declarations
	added to runtime/mercury_trace_base.h, and the change from MR_trace
	to MR_trace_real.

runtime/mercury_trace_base.[ch]:
	Define MR_trace(), which does an indirect call through
	MR_trace_func_ptr if the event should be traced.

	Define MR_trace_fake, which just prints an error message.
	Its address will be assigned to MR_trace_func_ptr if tracing
	is not enabled.

	Define the types needed by the signature of MR_trace.

	Fix an old bug: s/MERCURY_TRACE_PERMANENT_H/MERCURY_TRACE_BASE_H/.

runtime/mercury_wrapper.[ch]:
	Add the new global variable MR_trace_func_ptr.

scripts/c2init.in:
	Add a new option, -t/--trace, which enables tracing by causing the
	address of MR_trace_real to be assigned to MR_trace_func_ptr.

	Have this option be implied by the grade. Also have the old option
	-i (need initialization code) be implied by the grade, as well as by
	-t.

scripts/ml.in:
	Include the new libraries in the link command.

tests/debugger/Mmakefile:
	Include -t instead of -i in the list of c2init options. (-t implies
	-i.)

tools/bootcheck:
	Copy and build the new directories as appropriate. The trace directory
	is treated like the runtime, the browser directory is treated like the
	library.

trace/Mmakefile:
	Mmakefile for the new directory, modelled on runtime/Mmakefile.

util/mkinit.c:
	Add the new option -t, as discussed above.
	Mmakefile for the new directory, modelled on runtime/Mmakefile.

util/Mmakefile:
	Specify -O0, since with the default optimization level, gcc on
	cyclone ignores the assignment of TRUE to need_tracing when -t is
	given (!!!).
1998-09-29 05:12:06 +00:00
Thomas Conway
5927080429 When parsing a --grade option, set all the grade options to the
Estimated time taken: 1

sripts/parse_grade_options.sh-subr:
	When parsing a --grade option, set all the grade options to the
	appropriate `off' value. As a result the last --grade option overides
	all earlier ones.

compiler/handle_options.m:
	Add a table for the `off' values for grade options, and reset the
	grade options to those values when processing a --grade option.
1998-09-22 22:57:11 +00:00
Fergus Henderson
1665b44c55 A bug fix from Warwick Harvey.
Estimated hours taken: 0.25

A bug fix from Warwick Harvey.

scripts/parse_grade_options.sh-subr:
	If a grade is specified, the GC method should default
	to `none' rather than `conservative'.
1998-09-14 10:40:47 +00:00
Fergus Henderson
206888ea3b Fix a bug: it was using the wrong variable name.
Estimated hours taken: 0.25

scripts/mprof_merge_runs:
	Fix a bug: it was using the wrong variable name.
1998-09-02 06:42:06 +00:00
Peter Ross
25a8b67d83 When using target specific MCFLAGS they should occur on the command line
Estimated hours taken: 0.25

When using target specific MCFLAGS they should occur on the command line
last so that they override any previous settings, including those set by
EXTRA_MCFLAGS.

scripts/Mmake.vars.in:
    Switch all occurences of EXTRA_* and TARGET_* so that TARGET_* comes
    last.
1998-08-25 04:32:01 +00:00
David Overton
55c5d8a5cd Strip impure' and semipure' from predicate and function
Estimated hours taken: 0.5

scripts/mtags:
	Strip `impure' and `semipure' from predicate and function
	declarations.

	Fix a comment.
1998-08-10 06:54:59 +00:00
Thomas Conway
2b605fa6e8 Fix several bugs in the runtime engine to do with thread-safe execution.
Estimated hours taken: 15

Fix several bugs in the runtime engine to do with thread-safe execution.

Add a new flag to pragma c_code/import to allow programmers to specify
whether or not the C code is thread-safe or not, and modify code generation
to put a lock around C code that isn't thread_safe.

runtime/mercury_thread.{c,h}:
	Add a global lock.
	Change the handling of thread creation. create_thread now takes
	a "closure" (a C struct with a fn pointer and an argument to pass
	the function) which it calls in the new thread. (The same mechanism
	is used in the Boehm collector), or NULL which causes the thread
	to wait for work to appear in the Mercury runqueue.

runtime/mercury_context.c:
	initialize the global lock.

runtime/mercury_engine.{c,h}:
	Add a new field to the MercuryEngine structre which is used to
	store a list of saved thread ids. These were being saved in a
	local variable in call_engine_inner which was a bug because
	call_engine_inner's (C) stack frame gets scribbled on by Mercury
	execution. For more detail see the comments in mercury_engine.h

runtime/mercury_wrapper.c:
	Use the new interface to create_thread.

compiler/prog_io_pragma.m:
	Parse either a single attribute or a list of attributes instead
	of just 'may_call_mercury' in pragma c code and pragma import.
	These are stored in an abstract type 'pragma_c_code_attributes'
	that uses a bit array (aka int) to store the attributes.

compiler/pragma_c_gen.m:
	Get the code generator to emit c code to obtain and release the
	global lock for pragma c code that isn't thread_safe.

compiler/<various>.m:
	Change may_call_mercury to pragma_c_code_attributes.

doc/reference_manual.m:
	Document the change to pragma c code.

scripts/mgnuc.in:
	Pass some extra C flags for thread-safe compilation for Linux.
1998-08-07 00:50:40 +00:00
Fergus Henderson
fc0cbfe9ab Fix a bug introduced in my previous change:
Estimated hours taken: 0.1

scripts/Mmake.vars.in:
	Fix a bug introduced in my previous change:
	ALL_GRADEFLAGS needs to include GRADEFLAGS.
1998-08-05 07:33:45 +00:00
Fergus Henderson
1eca19786e Add Mmake support for target-specific MCFLAGS flags (MCFLAGS-foo, etc.)
Estimated hours taken: 3

Add Mmake support for target-specific MCFLAGS flags (MCFLAGS-foo, etc.)
using some tricky GNU Make hackery that avoids warning about undefined
variables.
Also define ALL_MCFLAGS = $(MCFLAGS) $(TARGET_MCFLAGS) $(EXTRA_MCFLAGS)
and use $(ALL_MCFLAGS) instead of $(MCFLAGS).  This allows user Mmakefiles
to override MCFLAGS without suppressing the use of the TARGET_MCFLAGS
and EXTRA_MCFLAGS.

Similarly for the other *FLAGS variables.

scripts/Mmake.vars.in:
	Define ALL_*FLAGS and TARGET_*FLAGS.

scripts/Mmake.rules:
	Use ALL_*FLAGS instead of *FLAGS.

scripts/mmake.in:
	Re-enable the warnings about undefined variables,
        since we won't get too many spurious warnings now.

Mmake.common.in:
	Delete `$(MCFLAGS-$*)' from the definition of `MCFLAGS', since this
	is now done automatically by Mmake.

tests/Mmake.common:
	Delete the definitions of MCFLAGS and GRADEFLAGS, since this stuff
	is now done automatically by Mmake.

doc/user_guide.texi:
NEWS:
	Document these changes.
1998-08-04 14:06:10 +00:00
Thomas Conway
b1aa225ce3 This change makes the parsing of GRADE/--grade strings more flexible.
Estimated hours taken: 4

This change makes the parsing of GRADE/--grade strings more flexible.
The GRADE string can now have its components given in any order. The
only places that depend on the order are those that use the grade as
part of a pathname: ml and install_grades. There is also a new option
to the compiler `--output-grade-string' which prints the grade string
for the set of options given to mmc/mmake.

NEWS:
	mention the changes.

compiler/handle_options.m:
	Reimplement convert_grade_option to accept a grade string with
	its components in any order. The conversion is now table-driven,
	which should make it easier to add new dimensions to the grade
	and new values to existing ones.

	Reimplement compute_grade to use the same table as
	convert_grade_option.

compiler/mercury_compile.m:
	If --output-grade-string option was given, just compute the
	grade string and print it.

compiler/options.m:
	Add the --output-grade-string option.

library/list.m:
	Add an extra mode to list__foldl2 (gee, it would be nice to be
	able to make higher order predicates polymorphic in their
	determinism).

scripts/ml.in:
	Include .par in the grade string. (bugfix)

scripts/parse_grade_options.sh-subr:
	split the grade string into . separated pieces and process them
	in a loop, setting the appropriate options.

doc/user_guide.texi:
	Add documentation on --output-grade-string.
	Change the description of how grades are handled to match
	the implementation. Add a some missing bits.
1998-07-27 01:05:20 +00:00
Fergus Henderson
4647a1c2af Make the warnings about undefined variables optional;
Estimated hours taken: 0.5

scripts/mmake.in:
	Make the warnings about undefined variables optional;
	by default they are not enabled.
1998-07-25 12:01:43 +00:00
David Overton
f371824b71 Enhance the mtags script to produce tags for typeclasses and to
Estimated hours taken: 5

Enhance the mtags script to produce tags for typeclasses and to
support some new features of Vim and Elvis.

scripts/mtags:
        Add support for producing tags for typeclass, instance and
	method declarations.
	Current limitation: assumes each method declaration starts on a
	new line.

	Add new options `--elvis', `--ext' and  `--keep-duplicates'
	which support the extended tags features of Vim 5.0 and Elvis 2.1.

	Add new option `--help'.  (Do `mtags --help' for a description
	of all options.)

doc/Mmakefile:
	Add mtags to the list of manpages.
1998-07-13 00:59:22 +00:00
Zoltan Somogyi
4ada219856 Reorganize the label table to better fit the needs of accurate gc
Estimated hours taken: 25

Reorganize the label table to better fit the needs of accurate gc
and the tracer, and reduce the size of executables.

With these changes, the size of hello world, compiled with static
Mercury libraries but dynamic C libraries, goes from 150+ Kb to
138+ Kb, much of which is beyond our control (e.g. Boehm gc).

runtime/mercury_label.[ch]:
	The old label table contained both entry labels and internal labels,
	even though they had different kinds of layouts associated with them
	(proc layouts and label layouts respectively). The two kinds of labels
	have different usage patterns. Internal labels are needed for stack
	walking, which requires random access by exact label address. Entry
	labels are needed for finding which procedure a program counter is in
	for accurate GC, which requires lower-bound inexact search.

	The module now has two separate data structures for the two
	different kinds of labels. Internal labels are in a hash table,
	as before. Entry labels are in an array (resized on demand),
	which is sorted for binary search. The entry label array and
	its associated functions are present only if they are needed.

runtime/mercury_goto.h:
	Call the new functions in mercury_label.c from the
	init_{local,label,entry}{,_sl} macros.

runtime/mercury_misc.[ch]
	Use the new functions in mercury_label. Fix some software rot,
	so that the code now compiles with MR_DEBUG_GOTOS. (It still does not
	compile with MR_LOWLEVEL_DEBUG, but the fix for that would conflict
	with Tom's planned change to zone handling, so that fix should be
	done after Tom is done.)

	Note that mercury_misc.c still defines newmem() and oldmem()
	although they are declared in mercury_std.h.

runtime/mercury_stack_trace.c:
	Use the new functions in mercury_label. As a result, we also need
	to make a few more pointers const.

runtime/mercury_table.[ch]:
	Add a new traversal predicate to support a new function in
	mercury_label.c. (That function is not used yet, but will be soon.)

runtime/mercury_trace.[ch]:
runtime/mercury_trace_base.[ch]:
	Split the old mercury_trace module into two. The functions and
	variables that will always be linked in (because they are referenced
	from modules such as mercury_wrapper which are always needed) are
	now in mercury_trace_base; the other functions and variables
	stay in mercury_trace. This way, mercury_trace.o will be linked in
	only if some module was compiled with execution tracing. Since
	mercury_trace.o drags in mercury_trace_internal.o which drags in
	everything needed for printing arbitrary terms (which is a lot),
	this can be a significant win.

runtime/Mmakefile:
	Include the new module in the library.

runtime/mercury_wrapper.c:
runtime/mercury_conf_param.h:
	Remove some obsolete MERCURY_OPTIONS options, which would be
	difficult to support with the new label table.

	Move the #ifdefs around the -P option, so that programs not
	compiled with MR_THREAD_SAFE will accept but ignore the option,
	instead of aborting with the usage message.

	Replace the long usage message for malformed MERCURY_OPTIONS
	environment variables with a pointer to the user's guide.
	This saves about 1 Kb on every executable.

runtime/mercury_conf_param.h:
	Document MR_STACK_TRACE_THIS_MODULE.

util/mkinit.c:
	Add a new flag, -i. If this flag is given, include the initialization
	code regardless of grade. If it is not given, include the init code
	only if the grade requires it.

	The -i should be given if you want the executable to support stack
	tracing, or uplevel printing in execution tracing, at the cost of
	making the executable link in the init functions of all the modules
	in the library.

	Put the option handling code in alphabetical order.

	Fix the wrong default name of the entry point. (It only worked because
	c2init was always overriding the default.)

scripts/c2init.in:
	Pass through the -i flag to mkinit.

	Put the option handling code in alphabetical order.

compiler/mercury_compile.m:
	If the trace level specifies any kind of tracing, pass -i to c2init.

tests/debugger/Mmakefile:
	Add -i to the c2init flags.

tests/debugger/*
	Update the other half the test cases (those which assume a traced
	library) to conform to the changes in the debugger interface.
	The first half were updated earlier.

doc/user_guide.texi:
	In the environment variable section, modify the entry for
	MERCURY_OPTIONS to document all the options it makes sense
	for non-developers to use.

	Slight changes to two other parts of the guide to reduce duplication
	with the new material.
1998-07-03 02:36:09 +00:00