Commit Graph

64 Commits

Author SHA1 Message Date
Warwick Harvey
67a204a188 If a shared library directory given to `ml' is relative, turn it
Estimated hours taken: 1.5

scripts/ml.in:
	If a shared library directory given to `ml' is relative, turn it
	into an absolute path by prepending the current directory.  Also
	add options `--[no-]leave-shared-lib-dirs-relative' to `ml' to
	turn off/on this behaviour.
1999-07-01 02:58:50 +00:00
Fergus Henderson
27eb98582a Make static linking the default on FreeBSD,
Estimated hours taken: 1

scripts/ml.in:
	Make static linking the default on FreeBSD,
	since shared linking doesn't work.

README.FreeBSD:
	Document that shared libraries are not supported on FreeBSD.
	Add some hints about what would need to be done to make them work.
1999-06-21 07:45:52 +00:00
Zoltan Somogyi
95517bc1c8 Remove support for --args simple. We don't use it, we won't use it even for
Estimated hours taken: 4.5

Remove support for --args simple. We don't use it, we won't use it even for
experiments, and it is unnecessary complication.

If anybody were using --args simple, this would need bootstrapping, but
since nobody does, there is no need, and this can be committed as an
ordinary change.

compiler/options.m:
doc/user_guide.texi:
scripts/*.in:
scripts/*.sh-subr:
	Remove the --args option.

compiler/globals.m:
	Remove the args_method global and its access predicates.

compiler/handle_options.m:
	Don't set the args_method global from the option.

compiler/arg_info.m:
	Remove support for --args simple. This allows us to remove a now
	redundant argument from an exported predicate.

compiler/mercury_compile.m:
	Remove the code for passing -DCOMPACT_ARGS to the C compiler.

compiler/bytecode_gen.m:
compiler/fact_table.m:
compiler/follow_vars.m:
compiler/live_vars.m:
compiler/call_gen.m:
	Don't pass the unnecessary argument to arg_info.

compiler/call_gen.m:
compiler/unify_gen.m:
	Remove now unnecessary assertions.

compiler/hlds_pred.m:
	Don't include an args_method in proc_infos; instead, include
	a slot that says whether the procedure's address is taken or not.
	(In most cases, this determined whether the args_method was
	simple or compact.) We will need this bool in the near future
	(when we generate layout structures for procedures whose address
	is taken).

	Modify the signatures of exported predicates to accommodate
	this change to the data structure.

compiler/hlds_out.m:
	Print the new slot, not the args_method.

compiler/lambda.m:
	When creating procedures from lambdas, set the address-taken slot
	to address_is_taken instead of setting up its args_method.

compiler/make_hlds.m:
	Minor changes to conform to the changes in the signatures of
	the predicates exported from hlds_pred.m.

compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/dnf.m:
compiler/magic.m:
compiler/magic_util.m:
compiler/modecheck_call.m:
compiler/pd_info.m:
compiler/post_typecheck.m:
compiler/unify_gen.m:
	Minor changes to conform to the changes in the signatures of
	the predicates exported from hlds_pred.m and make_hlds.m.

runtime/mercury_type_info.h:
	Remove the conditional definition of the macros that provided
	an argument-method-independent way of referring to the registers
	holding the inputs and outputs of e.g. unification procedures.
	We don't need the independence anymore, and using registers instead
	of macros in the code ensures that maintainers are aware of register
	reuse issues (e.g. they copy an input from r1 before overwriting it
	with an output).

runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
	Remove support for the args method component of the grade.

runtime/mercury_ho_call.c:
runtime/mercury_tabling.c:
library/*.m:
	Conform to the changes in runtime/mercury_type_info.h by effectively
	applying the #defines appropriate to compact args by hand.

	Remove code and data structures only needed for simple args.
	Remove comments needed only in the presence of uncertainty about
	the args method.
1999-06-01 09:46:19 +00:00
Fergus Henderson
67b2853b47 Ensure that `ml' by default reports errors about undefined symbols
Estimated hours taken: 1.5

Ensure that `ml' by default reports errors about undefined symbols
when building shared libraries.  Add a new option `--allow-undefined'
to enable the previous, more permissive behaviour.

configure.in:
	Define new variables ALLOW_UNDEFINED and ERROR_UNDEFINED,
	which get set to the appropriate linker options for
	allowing/disallowing undefined symbol errors when building
	shared libraries.

scripts/ml.in:
	Add new option --allow-undefined.  When building shared libraries,
	pass either $ALLOW_UNDEFINED or $ERROR_UNDEFINED to the linker,
	depending on the setting of this new option.
1999-05-22 02:16:47 +00:00
Fergus Henderson
e011674971 A couple of fixes to trd's previous change:
Estimated hours taken: 0.25

scripts/ml.in:
	A couple of fixes to trd's previous change:
	- the libraries in TRACE_LIBS_SYSTEM should come before STDLIBS,
	  since the former might refer to the latter
	  (this is important with static linking and with DLLs,
	  since in both those situations you only get single-pass
	  linking unless you name the libraries multiple times on
	  the command line)
	- TRACE_LIBS_SYSTEM needs to be included even in the
	  `--mercury-libs none' case, otherwise compiler/Mmakefile
	  breaks.
1999-04-06 18:27:27 +00:00
Tyson Dowd
6157c50f67 Bootstrapping was a problem on my machine at home -- kept getting
Estimated hours taken: 3

Bootstrapping was a problem on my machine at home -- kept getting
linking errors with the debugging tests.

scripts/ml.in:
	Separate the variables for Mercury libraries from those
	with system libraries.  When bootstrapping we want to
	override the Mercury libraries to use the stage 2 version,
	but we don't want to override other library options such as -ldl
	and -lreadline, because they are system specific while the
	bootstrapping script is general.
1999-04-05 15:05:28 +00:00
Fergus Henderson
3dd5b4ea9d Search for header files and libraries in /usr/local/include
Estimated hours taken: 0.75

configure.in:
scripts/mgnuc.in:
scripts/ml.in:
	Search for header files and libraries in /usr/local/include
	and /usr/local/lib.  This is useful because readline is often
	installed there.
1999-04-03 17:10:55 +00:00
Fergus Henderson
ab8545cec1 Add GNU readline support to the debugger.
Estimated hours taken: 16

Add GNU readline support to the debugger.

Because GNU readline is licensed under the GPL, not the LGPL,
I was careful to ensure that (1) the readline library is
only linked into your application if it is compiled with
debugging enabled and (2) even in the latter case, the readline
support is disable-able (if you use the source distribution).

Mmakefile:
bindist/Mmakefile:
	Add dependency of configure on new file aclocal.m4.

aclocal.m4:
	Define a macro MERCURY_CHECK_READLINE to check for the readline
	headers, the readline library, and for libraries needed by readline,
	in particular -l{termcap,curses,ncurses}.
	If they're not found, define MR_NO_USE_READLINE.
	Otherwise, define various variables for using & installing readline.

bindist/bindist.configure.in:
configure.in:
	Add call to MERCURY_CHECK_READLINE to check for readline.

scripts/ml.in:
	If tracing is enabled, then (by default) link in readline,
	and hence also termcap/curses/ncurses.
	Add a new option `--no-readline' to disable this.

trace/mercury_trace_internal.c:
	Delete the FILE * parameter from the MR_getline() function,
	because there are actually two files involved (MR_mdb_in and
	MR_mdb_out), and they are always the same for all calls to this
	function.
	Also change this function so that it calls MR_trace_readline() rather
	than printing the prompt and then calling MR_trace_getline_raw().
	Delete the MR_trace_getline_raw() function -- this has been renamed
	as MR_trace_readline_raw() and moved to mercury_trace_readline.c.

trace/mercury_trace_readline.h:
trace/mercury_trace_readline.c:
	New module containing a new function MR_trace_readline() that prints
	a prompt and reads a line in by calling the readline library.
	I put all this new code inside `#ifndef MR_NO_USE_READLINE' so that
	the use of readline can be disabled.  If that symbol is defined,
	it reverts to the old implementation using MR_trace_readline_raw()
	(formerly called MR_trace_getline_raw()).

runtime/mercury_conf.h.in:
	Define the new configuration parameter `MR_NO_USE_READLINE'.

trace/Mmakefile:
	Add the new files mercury_trace_readline.[ch].
	Ensure that this new module is compiled with warnings disabled,
	to avoid spurious warnings resulting from the readline header files.
	Also simplify the code by deleting unnecessary uses of $(EXTRA_*) --
	that's handled by scripts/Mmake.vars now.

NEWS:
	Mention the readline support.

.INSTALL.in:
	Mention that it is helpful to have GNU Readline installed.

bindist/bindist.INSTALL:
	Mention that you may need to have GNU Readline installed.
1999-03-30 05:45:54 +00:00
Fergus Henderson
b44a1d88bd For Linux with ELF, if `--trace' is enabled, then
Estimated hours taken: 0.25

scripts/ml.in:
	For Linux with ELF, if `--trace' is enabled, then
	pass `-rdynamic' to gcc.   This is needed to make symbols
	exported for use in code linked in with dlopen(),
	which is used for interactive queries in the
	Mercury debugger.
1999-03-29 10:55:34 +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
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
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
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
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
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
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
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
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
006f7902d5 Various changes to make the `--debug' option work.
Estimated hours taken: 2

Various changes to make the `--debug' option work.

compiler/options.m:
	Fix an omission in a previous change of mine:
	add a special_handler for the `--debug' option.

compiler/handle_options.m:
scripts/mgnuc.in:
scripts/ml.in:
	Make the .debug grade imply --use-trail.  The reason for this is
	to avoid unnecessary proliferation in the number of different grades.
	If you're using .debug, you've already taken a major performance
	hit, so you should be able to afford the performance hit caused
	by --use-trail.

configure.in:
	Include a `.tr.debug' grade in LIBGRADES, which holds the set of
	library grades that get installed.

scripts/mdb:
NEWS:
	Update some obsolete documentation referring to the old
	`--generate-trace' option.

NEWS:
	Update some more obsolete documentation listing the commands
	supported by the debugger and describing how to build programs
	with debugging enabled.
1998-07-01 07:41:47 +00:00
Fergus Henderson
35090c6099 Ensure that the scripts clean up properly if interrupted --
Estimated hours taken: 0.5

scripts/mmake.in:
scripts/ml.in:
	Ensure that the scripts clean up properly if interrupted --
	avoid a small timing window during which an interrupt signal
	could cause the scripts to leave temporary directories lying
	around in /tmp.
1998-06-28 07:46:09 +00:00
Thomas Conway
a70b59e83c Add a test to find the number of words needed to represent a
configure.in:
        Add a test to find the number of words needed to represent a
        synchronization term.

boehm_gc/gc.h:
        fix a declaration by replacing the args () with (void).
boehm_gc/solaris_pthreads.c:
        add a missing include
        check the return values of pthread calls.

compiler/*.m:
        Add handling for the new HLDS goal type par_conj.
        Add handling for the four new LLDS instructions:
                init_sync_term
                fork
                join_and_terminate
                join_and_continue

compiler/code_info.m:
        add a new alternative for slot_contents - sync_term.

compiler/handle_options.m:
        add .par as part of the grade

compiler/hlds_goal.m:
        add the new goal type par_conj.

compiler/instmap.m:
        add instmap__unify which takes a list of instmaps
                and abstractly unifies them.
        add unify_instmap_delta which tajes two instmap deltas
                and abstractly unifies them.

compiler/llds.m:
        add the new llds instructions.

compiler/mode_info.m:
        add par_conj as a lock reason.

library/Makefile:
        work around a bug in the solaris version pthread.h

library/benchmarking.m:
        reference the stack zones from the engine structure
        rather than from global variables.

library/{nc,sp}_builtin.nl:
        add an op declaration for &.

library/std_util.m:
        change references to global variables to references inside
        the engine structure.

runtime/Mmakefile:
        add mercury_thread.{c,h}
        add THREADLIBS to the libraries

runtime/*.{c,h}
        Remove some old junk from the previous processes/shrd-mem
        changes that found their way into the repository.
        Add MR_ prefixes to lots of names.

runtime/mercury_context.c:
        Add init_thread_stuff for creating and initializing a
        context structure for the current thread.

runtime/mercury_context.h:
        add a field to the mercury context which stores the thread id
        of the thread where this context originated.
        add various macros for implementing the new llds instructions.

runtime/mercury_engine.c:
        initialize the engine structure, rather than a bunch of globals.

runtime/mercury_engine.h:
        declare the mercury_engine structure.

runtime/mercury_regorder.h:
        if MR_THREAD_SAFE, and there is at least one global register
        then use mr0 as a pointer to the mercury engine structure.

scripts/init_grade_options.sh-subr
        add thread_safe

scripts/mgnuc.in
        add THREAD_OPTS

scripts/ml.in:
        add THREAD_LIBS
1998-06-09 02:16:31 +00:00
Fergus Henderson
6921e0e015 Add a `--debug' option for Mercury-level debugging
Estimated hours taken: 6

Add a `--debug' option for Mercury-level debugging
using the trace-based debugger.

scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/ml.in:
compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
	Split the old `--debug' option into `--low-level-debug'
	(formerly the absence of -DSPEED, now handle by -DLOWLEVEL_DEBUG)
	and `--c-debug' (passes -g to C compiler).
	Delete the old `debug' grade.
	Add support for new options `--require-tracing'
	(makes --trace minimum equivalent to --trace interfaces,
	and passes -DMR_REQUIRE_TRACING to C compiler)
	`--stack-trace' (passes -DMR_STACK_TRACE to C compiler;
	actually this one was already supported)
	and `--debug' (implies previous two),
	with corresponding grade modifiers `.trace', `.strce', and `.debug'.
	Actually I think there's little point in specifying just one
	of `--require-tracing' and `--stack-trace' so for the moment
	I'm just providing `--debug': the code for the more fine-grained
	options and grade modifiers has been added but commented out.

runtime/mercury_conf_param.h:
	Document the new configuration parameter MR_REQUIRE_TRACING
	and the existing but undocumented parameter MR_STACK_TRACE.

runtime/mercury_grade.h:
	Include MR_REQUIRE_TRACING in the mangled grade identifier.

compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
	Allow new tracing type `--trace default', and make it the default.
	This gets replaced with `full' if require_tracing is yes
	or `minimal' if require_tracing is no.
	Also `--trace minimum' gets replaced with `interface' if
	require_tracing is yes.

doc/user_guide.texi:
	Document the new `--debug', `--low-level-debug', and `--c-debug'
	options.

scripts/mgnuc.in:
compiler/mercury_compile.m:
doc/user_guide.texi:
	Change things so that `--c-debug' does not imply `--no-c-optimize'.

configure.in:
	Add `-fomit-frame-pointer' to CFLAGS_FOR_GOTOS on alpha-*.
	Empirically, this seems to be needed, otherwise lots of
	the test cases fail when compiled with `--no-c-optimize'.
	(It might also be needed for other architectures, I don't know.)
1998-05-20 11:11:57 +00:00
Zoltan Somogyi
b636671a97 Replace "if ! mkdir ..." with "if mkdir ... then true else ...",
Estimated hours taken: 0.1

scripts/ml.in:
	Replace "if ! mkdir ..." with "if mkdir ... then true else ...",
	since the former doesn't work in sh.
1998-03-31 02:05:02 +00:00
Tyson Dowd
d928e526a0 Fix two security holes in the way temporary files in /tmp are handled.
Estimated hours taken: 1

Fix two security holes in the way temporary files in /tmp are handled.

configure.in:
	Look for mktemp.

scripts/ml.in:
	Previously, if a file /tmp/ml$$ existed, linker errors would
	be missed (or fake linker errors could be provided).
	Use
		mkdir /tmp/ml.$$ || exit 1
	approach to create a directory, then use a file in that
	directory as the fifo for linker errors.

scripts/mmake.in:
	Previously, if a file /tmp/mmake.$$ existed, it would stop
	the generation of a mmake file, and the system would invoke
	gmake on the existing file (possibly executing arbitrary
	commands).
	Use mktemp (if available) to create the file, and exit if
	it is not possible to create the file.
	If mktemp is not available, use mkdir || exit 1 technique.
1998-03-30 05:26:33 +00:00
Fergus Henderson
1dffaac715 Add support for -L' (--lib-dir').
Estimated hours taken: 1

scripts/ml.in:
	Add support for `-L' (`--lib-dir').
	`-L' options are basically just passed on to the system linker.
1998-03-06 03:20:57 +00:00
Fergus Henderson
3434794fd9 Fix a bug (missing backslash before "`" in an error message)
Estimated hours taken: 0.1

scripts/ml.in:
	Fix a bug (missing backslash before "`" in an error message)
	reported by Kevet Duncombe <dunc@acm.org>.
	Apparently this bug broke things on FreeBSD 2.2.5.
1998-02-26 09:34:03 +00:00
Tyson Dowd
e4d9c1b334 Fix the handling of the default linking options (shared or static).
Estimated hours taken: 0.5

Fix the handling of the default linking options (shared or static).

Under Linux, the default linkage is supposed to be static, but
only the linkage of the mercury libraries was being set, so
if you tried to link with another library, you needed to add
-static by hand.

Note that this will link in other libraries (such as the C library)
statically as well.

scripts/ml.in:
	Set link flags after handling options, so the flags are
	only set in one place.
	Add default handling for -static and -shared, previously
	there were only defaults for --mercury-libs static/shared.

README.Linux:
	Document that you should use --shared, not just --mercury-libs
	shared, if you want to link statically against other libraries.


Estimated hours taken: _____

<overview or general description of changes>

<directory>/<file>:
	<detailed description of changes>
1998-02-16 06:50:21 +00:00
Fergus Henderson
e6ac077bae Add support for memory profiling.
Estimated hours taken: 40 (+ unknown time by Zoltan)

Add support for memory profiling.

(A significant part of this change is actuallly Zoltan's work.  Zoltan
did the changes to the compiler and a first go at the changes to the
runtime and library.  I rewrote much of Zoltan's changes to the runtime
and library, added support for the new options/grades, added code to
interface with mprof, did the changes to the profiler, and wrote the
documentation.)

[TODO: add test cases.]

NEWS:
	Mention support for memory profiling.

runtime/mercury_heap_profile.h:
runtime/mercury_heap_profile.c:
	New files.  These contain code to record heap profiling information.

runtime/mercury_heap.h:
	Add new macros incr_hp_msg(), tag_incr_hp_msg(),
	incr_hp_atomic_msg(), and tag_incr_hp_atomic_msg().
	These are like the non-`msg' versions, except that if
	PROFILE_MEMORY is defined, they also call MR_record_allocation()
	from mercury_heap_profile.h to record heap profiling information.
	Also, fix up the indentation in lots of places.

runtime/mercury_prof.h:
runtime/mercury_prof.c:
	Added code to dump out memory profiling information to files
	`Prof.MemoryWords' and `Prof.MemoryCells' (for use by mprof).
	Change the format of the `Prof.Counts' file so that the
	first line says what it is counting, the units, and a scale
	factor.  Prof.MemoryWords and Prof.MemoryCells can thus have
	exactly the same format as Prof.Counts.
	Also cleaned up the interface to mercury_prof.c a bit, and did
	various other minor cleanups -- indentation changes, changes to
	use MR_ prefixes, additional comments, etc.

runtime/mercury_prof_mem.h:
runtime/mercury_prof_mem.c:
	Rename prof_malloc() as MR_prof_malloc().
	Rename prof_make() as MR_PROF_NEW() and add MR_PROF_NEW_ARRAY().

runtime/mercury_wrapper.h:
	Minor modifications to reflect the new interface to mercury_prof.c.

runtime/mercury_wrapper.c:
runtime/mercury_label.c:
	Rename the old `-p' (primary cache size) option as `-C'.
	Add a new `-p' option to disable profiling.

runtime/Mmakefile:
	Add mercury_heap_profile.[ch].
	Put the list of files in alphabetical order.
	Delete some obsolete stuff for supporting `.mod' files.
	Mention that libmer_dll.h and libmer_globals.h are
	produced by Makefile.DLLs.

runtime/mercury_imp.h:
	Mention that libmer_dll.h is produced by Makefile.DLLs.

runtime/mercury_dummy.c:
	Change a comment to refer to libmer_dll.h rather than
	libmer_globals.h.

compiler/llds.m:
	Add a new field to `create' and `incr_hp' instructions
	holding the name of the type, for heap profiling.

compiler/unify_gen.m:
	Initialize the new field of `create' instructions with
	the appropriate type name.

compiler/llds_out.m:
	Output incr_hp_msg() / tag_incr_hp_msg() instead of
	incr_hp() / tag_incr_hp().

compiler/*.m:
	Minor changes to most files in the compiler back-end to
	accomodate the new field in `incr_hp' and `create' instructions.

library/io.m:
	Add `io__report_full_memory_stats'.

library/benchmarking.m:
	Add `report_full_memory_stats'.  This uses the information saved
	by runtime/mercury_heap_profile.{c,h} to print out a report
	of memory usage by procedures and by types.
	Also modify `report_stats' to print out some of that information.

compiler/mercury_compile.m:
	If `--statistics' is enabled, call io__report_full_memory_stats
	at the end of main/2.  This will print out full memory statistics,
	if the compiler was compiled with memory profiling enabled.

compiler/options.m:
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/ml.in:
scripts/mgnuc.in:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	Add new option `--memory-profiling' and new grade `.memprof'.
	Add `--time-profiling' as a new synonym for `--profiling'.
	Also add `--profile-memory' for more fine-grained control:
	`--memory-profiling' implies both `--profile-memory' and
	`--profile-calls'.

scripts/mprof_merge_runs:
	Update to handle the new format of Prof.Counts and to
	also merge Prof.MemoryWords and Prof.MemoryCells.

profiler/options.m:
profiler/mercury_profile.m:
	Add new options `--profile memory-words' (`-m'),
	`--profile memory-cells' (`-M') and `--profile time' (`-t').
	Thes options make the profiler select a different count file,
	Prof.MemoryWords or Prof.MemoryCells instead of Prof.Counts.
	specific to time profiling.

profiler/read.m:
profiler/process_file.m:
profiler/prof_info.m:
profiler/generate_output.m:
	Update to handle the new format of the counts file.
	When reading the counts file, look at the first line of
	the file to determine what is being profiled.

profiler/globals.m:
	Add a new global variable `what_to_profile' that records
	what is being profiled.

profiler/output.m:
	Change the headings to reflect what is being profiled.

doc/user_guide.texi:
	Document memory profiling.
	Document new options.

doc/user_guide.texi:
compiler/options.m:
	Comment out the documentation for `.proftime'/`--profile-time',
	since doing time and call profiling seperately doesn't work,
	because the code addresses change when you recompile with a
	different grade.  Ditto for `.profmem'/`--profile-memory'.
	Also comment out the documentation for
	`.profcalls'/`--profile-calls', since it is redundant --
	`.memprof' produces the same information and more.

configure.in:
	Build a `.memprof' grade.  (Hmm, should we do this only
	if `--enable-all-grades' is specified?)
	Don't ever build a `.profcalls' grade.
1997-12-05 15:58:34 +00:00
Fergus Henderson
3b1b5166f0 Make the user's -R' (-rpath') options precede the Mercury ones.
Estimated hours taken: 0.25

scripts/ml.in:
	Make the user's `-R' (`-rpath') options precede the Mercury ones.
	This allows the user to use their own local copies of the
	Mercury shared libraries.
1997-10-12 13:46:45 +00:00
Fergus Henderson
eb7bcf0fd9 Change mgnuc and ml to support the same
compilation model options as mmc.
Allow the user to mix `--grade foo' options with
other options that affect the grade such as `--profiling'.
Compute the final grade to link with from the options.

Also add a few new options and grade modifiers.

compiler/options.m:
compiler/mercury_compile.m:
	Add `--profile-time' and `--profile-calls' options.
	Change `--profiling' to now just imply both of those.
	Add `--pic-reg' option (just implies `-DPIC_REG' in cflags).

compiler/handle_options.m:
	Add support for grade modifiers `.proftime' and `.profcalls'.
	Make `.debug' a grade modifier, rather than having a base
	grade `debug'.

scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	New files containing sh subroutines for parsing grade-related
	options.

configure.in:
bindist/bindist.configure.in:
	Use AC_SUBST_FILE to allow #inclusion of the above-mentioned
	`.sh-subr' files.

scripts/ml.in:
scripts/mgnuc.in:
	Use the above-mentioned sh subroutines.

scripts/ml.in:
compiler/mercury_compile.m:
compiler/handle_options.m:
	Compute the final grade to link with from the various
	grade-related options.

scripts/mgnuc.in:
	Support the `--inline-alloc' option.

doc/user_guide.texi:
README.Linux:
	Document the above changes.
1997-10-08 13:16:33 +00:00
Fergus Henderson
5852b953ea For Linux, make --make-shared-lib' imply --mercury-libs shared',
Estimated hours taken: 0.5

scripts/ml.in:
	For Linux, make `--make-shared-lib' imply `--mercury-libs shared',
	since on Linux the shared and non-shared grades are not compatible.
1997-10-07 17:50:53 +00:00
Fergus Henderson
64c2d3e991 Fix a bug that broke things on SunOS 4.x.
Estimated hours taken: 0.25

Fix a bug that broke things on SunOS 4.x.

scripts/ml.in:
	Don't pass -rpath options unless the system supports shared
	libraries.
1997-10-02 16:23:08 +00:00
Fergus Henderson
04b720630b Update the copyright messages so that (a) they contain the correct years
and (b) they say "Copyright (C) ... _The_ University of Melbourne".
1997-07-27 15:09:59 +00:00
Fergus Henderson
94c8131746 Add support to `ml' for creating and using shared libraries.
Estimated hours taken: 2

Add support to `ml' for creating and using shared libraries.

scripts/ml.in:
	- Change the `--shared' option so that it does not pass
	  `-shared' to $CC.   This is because passing `-shared' to gcc
	  would have the effect of *creating* a shared library, but
	  ml's documentation for `--shared' says that it means the
	  generated executable should *use* shared libs.  Also rename
	  the variable $SHARED_OR_STATIC_OPT as $MAYBE_STATIC_OPT,
	  since the previous name was now misleading.

	- Add a new option `--make-shared-lib', for creating shared libraries.
	  This is to allow users to create their own shared libraries.

	- Add a new option `-R<dir>' / `--shared-lib-directory', that
	  adds a directory to the RPATH used by the dynamic linker to
	  search for shared libraries.  This is to allow users to link
	  in their own shared libraries.
1997-07-14 09:14:07 +00:00
Fergus Henderson
715634e5ef Fix a problem with shared libraries on Linux.
They weren't working because Linux requires the `-rpath' option
be specified when linking the shared libraries, as well as when
linking executables.  Previously we only passed `-rpath' option
when linking executables.

configure.in:
Mmake.common.in:
bindist/bindist.build_vars.in:
	Add new configuration variables for handling `-rpath' or `-R' options:
	EXE_RPATH_OPT, EXE_RPATH_SEP, SHLIB_RPATH_OPT, and SHLIB_RPATH_SEP.

scripts/ml.in:
	Rewrite the system-specific code for handling rpaths
	to instead use the new rpath configuration variables.

library/Mmakefile:
runtime/Mmakefile:
	When linking shared libraries that depend on other shared libraries,
	pass appropriate rpath options using the rpath configuration variables.
1997-06-16 13:35:34 +00:00
Fergus Henderson
0d2a940783 Fix a bug with the `-v' (verbose) option: it was not echoing
Estimated hours taken: 0.25

scripts/ml.in:
	Fix a bug with the `-v' (verbose) option: it was not echoing
	all of the options it passed to gcc.
1997-04-15 04:39:58 +00:00
Fergus Henderson
f25b679f39 Allow `*-cygwin32' as a another name for Windows running gnu-win32,
Estimated hours taken: 0.1

scripts/ml.in:
	Allow `*-cygwin32' as a another name for Windows running gnu-win32,
	since that is the name that `config.guess' outputs.
1997-02-26 14:43:48 +00:00
Fergus Henderson
237a4c0524 Oops, fix another bug in the handling of -shared and -static:
Estimated hours taken: 0.25

scripts/ml.in:
	Oops, fix another bug in the handling of -shared and -static:
	it wasn't actually passing them on to gcc.
1997-02-10 07:18:53 +00:00
Fergus Henderson
39441951c0 Fix a problem where the new support for Linux ELF shared libraries
in gc 4.11 meant that `ml -static' didn't work on Linux, because
you got unresolved references to _DYNAMIC in dyn_load.o.

scripts/ml.in:
	If we're passed `-static' or `--static', then pass
	`-static -Wl,-defsym,_DYNAMIC=0' to gcc, so that gcc
	will pass `-defsym _DYNAMIC=0' to the linker.
1997-02-09 12:26:57 +00:00
Fergus Henderson
cc813fbac2 Fix a bug in the code to parse the new -static, --static, -shared and
Estimated hours taken: 0.25

scripts/ml.in:
	Fix a bug in the code to parse the new -static, --static, -shared and
	--shared options: add in some missing `shift' statements.
1997-02-09 11:20:02 +00:00
Fergus Henderson
1d3043d497 Make a couple of changes to the help message, as suggested
Estimated hours taken: 0.25

scripts/ml.in:
	Make a couple of changes to the help message, as suggested
	by Tyson.
1997-02-09 02:59:34 +00:00
Fergus Henderson
ac041e1f8a Some work towards making it easier to use shared libraries on Linux.
Estimated hours taken: 1

Some work towards making it easier to use shared libraries on Linux.

scripts/ml.in:
	Add a `--mercury-libs {shared, static, none}' option
	(`--mercury-libs none' replaces the old `--no-libs' option).
	Add `--shared' and `--static' options.
	Add a `--help' option.
1997-02-07 13:46:06 +00:00
Fergus Henderson
a3aa0897f9 One of several changes to add support for ELF shared libraries on Linux.
Estimated hours taken: 0.5

One of several changes to add support for ELF shared libraries on Linux.

scripts/ml.in:
	For i?86-*-linux*, pass the appropriate flags to the linker to
	link in shared libraries, if there are any.

#endif
1997-02-05 05:40:41 +00:00
Fergus Henderson
b96891a686 Put @CC@ in quotes, so that it works in the case when someone
Estimated hours taken: 0.25

scripts/mc.in:
scripts/mgnuc.in:
scripts/ml.in:
	Put @CC@ in quotes, so that it works in the case when someone
	does `CC="gcc -some -options" configure'.  Similarly for @MKFIFO@.
1996-12-11 18:02:45 +00:00
Fergus Henderson
6b9a292e7d For gnu-win32, don't strip the executable by default, since
Estimated hours taken: 8 (to find the problem) + 0.25 (to fix it)

scripts/ml.in:
	For gnu-win32, don't strip the executable by default, since
	`gcc -s' seems to be broken on gnu-win32 for Windows NT.
1996-12-09 08:24:49 +00:00
David Jeffery
4e08aed48b Mercurial Constraints III (the happy ending)
Estimated hours taken: 1 summer studentship

scripts/ml.in:
	Handle the new set of grades (*.cnstr).
scripts/mgnuc.in:
	Pass -DCONSTRAINTS if the grade is *.cnstr
1996-03-26 16:56:29 +00:00
Fergus Henderson
acb427b669 Fix a bug reported by Dominique de Waleffe:
rename `libgc.prof.{a,so}' as `libgc_prof.{a,so}',
because SunOS 4.1.3 doesn't seem to like library names with `.' in them.

scripts/ml.in:
	Link with -lgc_prof rather than -lgc.prof for `.prof' grades.
1996-02-16 03:21:04 +00:00
Fergus Henderson
14ffa5fcd0 Ensure that mmake does not attempt to remake the `.c' file if it is up-to-date.
Estimated hours taken: 1

Ensure that mmake does not attempt to remake the `.c' file if it is up-to-date.
(This change should hopefully fix a problem with the source distribution not
being able to bootstrap itself.)

Also a couple of minor tidy-ups.

scripts/mmake.in:
	Export new variable MMAKE_MAKE_CMD, for use by Mmake.rules.

scripts/Mmake.rules:
	In the rule for `.m' -> `.o', use a recursive invocatino of
	make (via the MMAKE_MAKE_CMD variable) to build the `.c' file,
	rather than unconditionally invoking `$(MCG)'.

scripts/.cvsignore:
	Add Mmake.vars, since it is now automatically-generated.

scripts/ml.in:
	Some stylistic changes: make sure that autoconf @var@ variables occur
	only in assignments to shell variables at the start of the script,
	not scattered throughout the body of the script.
1996-02-04 06:17:30 +00:00
Fergus Henderson
843a7916f3 Link with -lmer -lmercury' not -lmercury -lmer'.
scripts/ml.in:
	Link with `-lmer -lmercury' not `-lmercury -lmer'.
	The order matters: libmercury references things in libmer,
	and each library is only searched once.
1995-10-24 07:13:40 +00:00