[m-rev.] for review: infrastructure for libmer_ssdb

Peter Wang novalazy at gmail.com
Fri Oct 19 17:15:06 AEST 2007


Estimated hours taken: 8
Branches: main

Update files as required for the addition of the new library `libmer_ssdb',
and make the changes to add a new grade component `ssdebug'.

Mmake.workspace:
Mmakefile:
	Add `mer_ssdb.init', `libmer_ssdb' and `ssdb' directory to the
	appropriate lists.

	Order "ssdb" occurrences according to its position in the list of
	which libraries can call functions in which other libraries.

configure.in:
	Check the bootstrap compiler supports the `--no-ssdb' option.

browser/MDB_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
	Add `--no-ssdb' to break the cyclic dependencies between these
	libraries and `libmer_ssdb' that would be introduced if the
	source-to-source debugging transformation was applied these libraries.
	It also prevents the infinite recursion which would result from ssdb
	procedures calling transformed library procedures and vice versa.

analysis/.mgnuc_copts:
analysis/ANALYSIS_FLAGS.in:
analysis/Mmakefile:
profiler/.mgnuc_copts:
profiler/Mmakefile:
profiler/PROF_FLAGS.in:
slice/.mgnuc_copts:
slice/Mmakefile:
slice/SLICE_FLAGS.in:
	Search the `ssdb' directory for files.

compiler/Mmakefile:
	Remove the explicit `libmer_ssdb.a' from MLOBJS as it is redundant.

	Make the compiler binary depend on `libmer_ssdb'.

compiler/compile_target_code.m:
scripts/mgnuc.in:
	Pass "-DMR_SS_DEBUG" when compiling a C file if `--ssdb' is enabled.

	Implicitly include `mer_ssdb.init' and `libmer_ssdb' in various lists
	when `--ssdb' is enabled.

runtime/mercury_conf_param.h:
	Document `MR_SS_DEBUG' preprocessor macro.

compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	Add "ssdebug" grade component.

scripts/c2init.in:
scripts/ml.in:
	Link in `libmer_ssdb' if `--ssdb' enabled.

tools/lmc.in:
tools/lml:
	Link in `libmer_ssdb' and add `mer_ssdb.init'.

tools/bootcheck:
	Delete `ssdb' directory if `--disable-debug-libs' option enabled.

tools/binary:
tools/linear:
	Link `ssdb' directory.

compiler/notes/overall_design.html:
	Mention `ssdb' directory.

Index: Mmake.workspace
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/Mmake.workspace,v
retrieving revision 1.27
diff -u -r1.27 Mmake.workspace
--- Mmake.workspace	3 Oct 2007 12:11:52 -0000	1.27
+++ Mmake.workspace	19 Oct 2007 07:11:14 -0000
@@ -49,9 +49,9 @@
 RUNTIME_DIR = $(WORKSPACE)/runtime
 LIBRARY_DIR = $(WORKSPACE)/library
 TRACE_DIR = $(WORKSPACE)/trace
+SSDB_DIR = $(WORKSPACE)/ssdb
 MDBCOMP_DIR = $(WORKSPACE)/mdbcomp
 BROWSER_DIR = $(WORKSPACE)/browser
-SSDB_DIR = $(WORKSPACE)/ssdb
 BOEHM_GC_DIR = $(WORKSPACE)/boehm_gc
 MPS_GC_DIR = $(WORKSPACE)/mps_gc/code
 COMPILER_DIR = $(WORKSPACE)/compiler
@@ -82,8 +82,8 @@
 STD_LIB_NAME = mer_std
 TRACE_LIB_NAME = mer_trace
 EVENTSPEC_LIB_NAME = mer_eventspec
-BROWSER_LIB_NAME = mer_browser
 SSDB_LIB_NAME = mer_ssdb
+BROWSER_LIB_NAME = mer_browser
 MDBCOMP_LIB_NAME = mer_mdbcomp
 ANALYSIS_LIB_NAME = mer_analysis
 
@@ -119,9 +119,13 @@
 # MCFLAGS    += -I$(LIBRARY_DIR)
 # no in .mgnuc_opt files
 # MGNUCFLAGS += --no-mercury-stdlib-dir
+
+# XXX browser.init and mdbcomp.init might need to be included even if tracing
+# is disabled if ssdb uses code from the browser or mdbcomp libraries
 C2INITFLAGS  += --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init \
 		--trace-init-file $(MDBCOMP_DIR)/$(MDBCOMP_LIB_NAME).init
-C2INITARGS   += $(LIBRARY_DIR)/$(STD_LIB_NAME).init \
+C2INITARGS   += $(SSDB_DIR)/$(SSDB_LIB_NAME).init \
+		$(LIBRARY_DIR)/$(STD_LIB_NAME).init \
 		$(RUNTIME_DIR)/$(RT_LIB_NAME).init
 MLFLAGS      += --no-mercury-stdlib-dir
 
@@ -192,6 +196,7 @@
 ifneq ($(LINK_STDLIB_ONLY),yes)
 STATIC_TRACE_LIBS = $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A \
 		$(TRACE_DIR)/lib$(EVENTSPEC_LIB_NAME).$A \
+		$(SSDB_DIR)/lib$(SSDB_LIB_NAME).$A \
 		$(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A \
 		$(MDBCOMP_DIR)/lib$(MDBCOMP_LIB_NAME).$A
 endif
@@ -206,23 +211,23 @@
 
 LINK_RT_LIB_OPTS=
 LINK_STD_LIB_OPTS=
-LINK_TRACE_LIB_OPTS=
+LINK_TRACE_SSDB_LIB_OPTS=
 ifneq ($(LINK_BOEHM_GC_ONLY),yes)
 LINK_RT_LIB_OPTS = -l$(RT_LIB_NAME)
 ifneq ($(LINK_RUNTIME_ONLY),yes)
 LINK_STD_LIB_OPTS = -l$(STD_LIB_NAME)
 ifneq ($(LINK_STDLIB_ONLY),yes)
-LINK_TRACE_LIB_OPTS = -l$(TRACE_LIB_NAME) -l$(EVENTSPEC_LIB_NAME) \
-	-l$(BROWSER_LIB_NAME) -l$(MDBCOMP_LIB_NAME)
+LINK_TRACE_SSDB_LIB_OPTS = -l$(TRACE_LIB_NAME) -l$(EVENTSPEC_LIB_NAME) \
+	-l$(SSDB_LIB_NAME) -l$(BROWSER_LIB_NAME) -l$(MDBCOMP_LIB_NAME)
 endif
 endif
 endif
 
-LINK_LIB_OPTS = $(LINK_TRACE_LIB_OPTS) $(LINK_STD_LIB_OPTS) \
+LINK_LIB_OPTS = $(LINK_TRACE_SSDB_LIB_OPTS) $(LINK_STD_LIB_OPTS) \
 		$(LINK_RT_LIB_OPTS) $(SHARED_GC_LIBS)
 LIB_DIR_OPTS = -L$(BOEHM_GC_DIR) -L$(MPS_GC_DIR) -L$(RUNTIME_DIR) \
 		-L$(LIBRARY_DIR) -L$(TRACE_DIR) -L$(MDBCOMP_DIR) \
-		-L$(BROWSER_DIR)
+		-L$(BROWSER_DIR) -L$(SSDB_DIR)
 
 MLFLAGS      += $(LIB_DIR_OPTS)
 # now in FLAGS files
Index: Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.127
diff -u -r1.127 Mmakefile
--- Mmakefile	15 Oct 2007 10:50:20 -0000	1.127
+++ Mmakefile	19 Oct 2007 07:11:14 -0000
@@ -37,9 +37,9 @@
 		robdd \
 		library \
 		trace \
+		ssdb \
 		mdbcomp \
 		browser \
-		ssdb \
 		analysis \
 		compiler \
 		doc \
@@ -68,9 +68,9 @@
 STD_LIB_NAME = mer_std
 TRACE_LIB_NAME = mer_trace
 EVENTSPEC_LIB_NAME = mer_eventspec
+SSDB_LIB_NAME = mer_ssdb
 MDBCOMP_LIB_NAME = mer_mdbcomp
 BROWSER_LIB_NAME = mer_browser
-SSDB_LIB_NAME = mer_ssdb
 ANALYSIS_LIB_NAME = mer_analysis
 
 #-----------------------------------------------------------------------------#
@@ -79,8 +79,8 @@
 # `mmake depend' forces them to be remade to ensure that they are up-to-date.
 
 .PHONY: dep
-dep: dep_library dep_mdbcomp dep_browser dep_analysis dep_compiler \
-		dep_slice dep_profiler dep_deep_profiler dep_ssdb
+dep: dep_library dep_ssdb dep_mdbcomp dep_browser dep_analysis dep_compiler \
+		dep_slice dep_profiler dep_deep_profiler
 
 .PHONY: dep_library
 dep_library: library/$(deps_subdir)$(STD_LIB_NAME).dep
@@ -258,7 +258,7 @@
 
 .PHONY: analysis
 analysis: dep_analysis scripts util boehm_gc runtime library mdbcomp browser \
-		trace ssdb
+    		ssdb trace
 	+cd analysis && $(SUBDIR_MMAKE)
 
 .PHONY: runtime
@@ -267,12 +267,12 @@
 
 .PHONY: compiler
 compiler: dep_compiler scripts util boehm_gc runtime library \
-		mdbcomp browser trace ssdb analysis
+		mdbcomp browser ssdb trace analysis
 	+cd compiler && $(SUBDIR_MMAKE)
 
 .PHONY: libmmc
 libmmc: dep_compiler scripts util boehm_gc runtime library \
-		mdbcomp browser trace ssdb analysis
+		mdbcomp browser ssdb trace analysis
 	+cd compiler && $(SUBDIR_MMAKE) libmmc
 
 .PHONY: doc
@@ -281,24 +281,24 @@
 
 .PHONY: slice
 slice: dep_slice scripts util boehm_gc runtime library \
-		mdbcomp browser trace ssdb
+		mdbcomp browser ssdb trace
 	+cd slice && $(SUBDIR_MMAKE)
 
 .PHONY: profiler
 profiler: dep_profiler scripts util boehm_gc runtime library \
-		mdbcomp browser trace ssdb
+		mdbcomp browser ssdb trace
 	+cd profiler && $(SUBDIR_MMAKE)
 
 .PHONY: deep_profiler
 deep_profiler: dep_deep_profiler scripts util boehm_gc runtime library \
-		mdbcomp browser trace ssdb
+		mdbcomp browser ssdb trace
 	+cd deep_profiler && $(SUBDIR_MMAKE)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: tags
-tags: tags_compiler tags_library tags_mdbcomp tags_browser tags_analysis \
-		tags_slice tags_profiler tags_deep_profiler tags_ssdb
+tags: tags_compiler tags_library tags_mdbcomp tags_browser tags_ssdb \
+    		tags_analysis tags_slice tags_profiler tags_deep_profiler
 
 .PHONY: tags_compiler
 tags_compiler:
@@ -316,6 +316,10 @@
 tags_browser:
 	+cd browser && $(SUBDIR_MMAKE) tags
 
+.PHONY: tags_ssdb
+tags_ssdb:
+	+cd ssdb && $(SUBDIR_MMAKE) tags
+
 .PHONY: tags_analysis
 tags_analysis:
 	+cd analysis && $(SUBDIR_MMAKE) tags
@@ -332,10 +336,6 @@
 tags_deep_profiler:
 	+cd deep_profiler && $(SUBDIR_MMAKE) tags
 
-.PHONY: tags_ssdb
-tags_ssdb:
-	+cd ssdb && $(SUBDIR_MMAKE) tags
-
 #-----------------------------------------------------------------------------#
 
 # Remove from each of the listed directories mmc-generated files that don't
@@ -524,8 +524,8 @@
 .PHONY: install_main
 install_main: all \
 		install_scripts install_util install_runtime install_boehm_gc \
-		install_library install_mdbcomp install_browser install_trace \
-		install_compiler install_slice install_profiler install_ssdb \
+		install_library install_mdbcomp install_browser install_ssdb \
+		install_trace install_compiler install_slice install_profiler \
 		install_deep_profiler install_doc install_config
 
 .PHONY: install_scripts
@@ -670,13 +670,13 @@
 	touch browser/*.optdate
 	chmod +w browser/*.dep
 	touch browser/*.dep
-	touch analysis/*.date*
-	chmod +w analysis/*.dep
-	touch analysis/*.dep
 	touch ssdb/*.date*
 	touch ssdb/*.optdate
 	chmod +w ssdb/*.dep
 	touch ssdb/*.dep
+	touch analysis/*.date*
+	chmod +w analysis/*.dep
+	touch analysis/*.dep
 	touch compiler/*.date*
 	chmod +w compiler/*.dep
 	touch compiler/*.dep
Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.504
diff -u -r1.504 configure.in
--- configure.in	15 Oct 2007 10:29:51 -0000	1.504
+++ configure.in	19 Oct 2007 07:11:15 -0000
@@ -338,6 +338,7 @@
 			--erlang-native-code \
 			--no-no-det-warning-compound-compare-2007-07-17 \
 			--foreign-enum-switch-fix \
+			--no-ssdb \
 			</dev/null >&AC_FD_CC 2>&1 &&
 		test "`./conftest 2>&1 | tr -d '\015'`" = "Hello, world" &&
 		# Test for the --record-term-sizes-as-words option.
Index: analysis/.mgnuc_copts
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/analysis/.mgnuc_copts,v
retrieving revision 1.1
diff -u -r1.1 .mgnuc_copts
--- analysis/.mgnuc_copts	20 May 2005 06:15:04 -0000	1.1
+++ analysis/.mgnuc_copts	19 Oct 2007 07:11:15 -0000
@@ -7,4 +7,6 @@
 -I../mdbcomp/Mercury/mihs
 -I../browser
 -I../browser/Mercury/mihs
+-I../ssdb
+-I../ssdb/Mercury/mihs
 -I../trace
Index: analysis/ANALYSIS_FLAGS.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/analysis/ANALYSIS_FLAGS.in,v
retrieving revision 1.3
diff -u -r1.3 ANALYSIS_FLAGS.in
--- analysis/ANALYSIS_FLAGS.in	20 Jul 2007 01:22:00 -0000	1.3
+++ analysis/ANALYSIS_FLAGS.in	19 Oct 2007 07:11:15 -0000
@@ -6,6 +6,7 @@
 -I../library
 -I../browser
 -I../mdbcomp
+-I../ssdb
 --c-include-directory ../boehm_gc
 --c-include-directory ../boehm_gc/include
 --c-include-directory ../runtime
@@ -15,12 +16,16 @@
 --c-include-directory ../mdbcomp/Mercury/mihs
 --c-include-directory ../browser
 --c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../ssdb
+--c-include-directory ../ssdb/Mercury/mihs
 --c-include-directory ../trace
 --c-include-directory ../analysis
 --erlang-include-directory ../library/Mercury/hrls
 --erlang-include-directory ../mdbcomp/Mercury/hrls
+--erlang-include-directory ../ssdb/Mercury/hrls
 --erlang-include-directory ../analysis/Mercury/hrls
 -L../boehm_gc
 -L../runtime
 -L../library
+-L../ssdb
 --config-file ../scripts/Mercury.config.bootstrap
Index: analysis/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/analysis/Mmakefile,v
retrieving revision 1.5
diff -u -r1.5 Mmakefile
--- analysis/Mmakefile	6 May 2005 08:42:04 -0000	1.5
+++ analysis/Mmakefile	19 Oct 2007 07:11:15 -0000
@@ -17,6 +17,8 @@
 MAIN_TARGET=all
 MERCURY_MAIN_MODULES=$(ANALYSIS_LIB_NAME)
 
+VPATH = $(LIBRARY_DIR) $(SSDB_DIR)
+
 #-----------------------------------------------------------------------------#
 
 # Specify which compilers to use to compile the library.
Index: browser/MDB_FLAGS.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/MDB_FLAGS.in,v
retrieving revision 1.2
diff -u -r1.2 MDB_FLAGS.in
--- browser/MDB_FLAGS.in	19 Jun 2005 02:14:16 -0000	1.2
+++ browser/MDB_FLAGS.in	19 Oct 2007 07:11:16 -0000
@@ -5,6 +5,7 @@
 --no-mercury-stdlib-dir
 --no-shlib-linker-use-install-name
 --force-disable-tracing
+--no-ssdb
 -I../library
 -I../mdbcomp
 -I../browser
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.95
diff -u -r1.95 Mmakefile
--- compiler/Mmakefile	5 Oct 2007 04:23:20 -0000	1.95
+++ compiler/Mmakefile	19 Oct 2007 07:11:16 -0000
@@ -34,7 +34,8 @@
 
 MERCURY_MAIN_MODULES = top_level mlds_to_gcc
 
-VPATH = $(LIBRARY_DIR) $(MDBCOMP_DIR) $(BROWSER_DIR) $(SSDB_DIR) $(ANALYSIS_DIR)
+VPATH = $(LIBRARY_DIR) $(MDBCOMP_DIR) $(BROWSER_DIR) $(SSDB_DIR) \
+	$(ANALYSIS_DIR)
 
 #-----------------------------------------------------------------------------#
 
@@ -62,7 +63,7 @@
 MCFLAGS	     += --flags COMP_FLAGS $(CONFIG_OVERRIDE)
 MLOBJS       := ../main.$O ../analysis/lib$(ANALYSIS_LIB_NAME).$A \
 		../trace/lib$(EVENTSPEC_LIB_NAME).$A \
-		../ssdb/lib$(SSDB_LIB_NAME).$A $(MLOBJS)
+		$(MLOBJS)
 ALL_MLLIBS    = $(MLLIBS) $(EXTRA_MLLIBS) $(GCC_BACKEND_LIBS)
 MLFLAGS      += --no-main --shared
 C2INITARGS   += $(ANALYSIS_DIR)/$(ANALYSIS_LIB_NAME).init
@@ -245,6 +246,7 @@
 $(MC_PROG): $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
 $(MC_PROG): $(MDBCOMP_DIR)/lib$(MDBCOMP_LIB_NAME).$A
 $(MC_PROG): $(BROWSER_DIR)/lib$(BROWSER_LIB_NAME).$A
+$(MC_PROG): $(SSDB_DIR)/lib$(SSDB_LIB_NAME).$A
 $(MC_PROG): $(TRACE_DIR)/lib$(TRACE_LIB_NAME).$A
 $(MC_PROG): $(TRACE_DIR)/lib$(EVENTSPEC_LIB_NAME).$A
 $(MC_PROG): $(ANALYSIS_DIR)/lib$(ANALYSIS_LIB_NAME).$A
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.121
diff -u -r1.121 compile_target_code.m
--- compiler/compile_target_code.m	10 Oct 2007 07:18:12 -0000	1.121
+++ compiler/compile_target_code.m	19 Oct 2007 07:11:17 -0000
@@ -566,6 +566,14 @@
         DeclDebug = no,
         DeclDebugOpt = ""
     ),
+    globals.io_lookup_bool_option(source_to_source_debug, SourceDebug, !IO),
+    (
+        SourceDebug = yes,
+        SourceDebugOpt = "-DMR_SS_DEBUG "
+    ;
+        SourceDebug = no,
+        SourceDebugOpt = ""
+    ),
     globals.io_lookup_bool_option(exec_trace, ExecTrace, !IO),
     (
         ExecTrace = yes,
@@ -772,7 +780,9 @@
         PIC_Reg_Opt, 
         TagsOpt, NumTagBitsOpt, 
         ExtendOpt,
-        Target_DebugOpt, LL_DebugOpt, DeclDebugOpt, ExecTraceOpt,
+        Target_DebugOpt, LL_DebugOpt, DeclDebugOpt,
+        SourceDebugOpt,
+        ExecTraceOpt,
         UseTrailOpt, 
         MinimalModelOpt, 
         SinglePrecFloatOpt,
@@ -1195,16 +1205,21 @@
         StdTraceInitFileNames = [
             ToGradeInit("mer_browser.init"),
             ToGradeInit("mer_mdbcomp.init")
+        ],
+        SourceDebugInitFileNames = [
+            ToGradeInit("mer_ssdb.init")
         ]
     ;
         MaybeStdLibDir = no,
         StdInitFileNames = [],
-        StdTraceInitFileNames = []
+        StdTraceInitFileNames = [],
+        SourceDebugInitFileNames = []
     ),
 
     globals.io_lookup_string_option(mkinit_command, MkInit, !IO),
     make_init_target_file(ErrorStream, MkInit, ModuleName, ModuleNames, ".c",
-        StdInitFileNames, StdTraceInitFileNames, "", MaybeInitTargetFile, !IO),
+        StdInitFileNames, StdTraceInitFileNames, SourceDebugInitFileNames,
+        "", MaybeInitTargetFile, !IO),
 
     get_object_code_type(executable, PIC, !IO),
     maybe_pic_object_file_extension(PIC, ObjExt, !IO),
@@ -1231,10 +1246,14 @@
         MaybeStdLibDir = yes(StdLibDir),
         StdInitFileNames = [
             StdLibDir / "modules" / GradeDir / "mer_std.init"
+        ],
+        SourceDebugInitFileNames = [
+            StdLibDir / "modules" / GradeDir / "mer_ssdb.init"
         ]
     ;
         MaybeStdLibDir = no,
-        StdInitFileNames = []
+        StdInitFileNames = [],
+        SourceDebugInitFileNames = []
     ),
     % Tracing is not supported in Erlang backend.
     StdTraceInitFileNames = [],
@@ -1245,9 +1264,9 @@
     ModuleNameOption = " -m " ++ quote_arg(ModuleNameStr),
 
     globals.io_lookup_string_option(mkinit_erl_command, MkInitErl, !IO),
-    make_init_target_file(ErrorStream, MkInitErl, ModuleName, ModuleNames, ".erl",
-        StdInitFileNames, StdTraceInitFileNames, ModuleNameOption,
-        MaybeInitTargetFile, !IO),
+    make_init_target_file(ErrorStream, MkInitErl, ModuleName, ModuleNames,
+        ".erl", StdInitFileNames, StdTraceInitFileNames,
+        SourceDebugInitFileNames, ModuleNameOption, MaybeInitTargetFile, !IO),
 
     module_name_to_file_name(ModuleName, "_init.beam", yes,
         InitObjFileName, !IO),
@@ -1260,12 +1279,12 @@
 
 :- pred make_init_target_file(io.output_stream::in, string::in,
     module_name::in, list(module_name)::in, string::in,
-    list(file_name)::in, list(file_name)::in, string::in,
-    maybe(file_name)::out, io::di, io::uo) is det.
+    list(file_name)::in, list(file_name)::in, list(file_name)::in,
+    string::in, maybe(file_name)::out, io::di, io::uo) is det.
 
 make_init_target_file(ErrorStream, MkInit, ModuleName, ModuleNames, TargetExt,
-        StdInitFileNames, StdTraceInitFileNames, ModuleNameOption,
-        MaybeInitTargetFile, !IO) :-
+        StdInitFileNames, StdTraceInitFileNames, SourceDebugInitFileNames,
+        ModuleNameOption, MaybeInitTargetFile, !IO) :-
     globals.io_lookup_bool_option(verbose, Verbose, !IO),
     globals.io_lookup_bool_option(statistics, Stats, !IO),
     maybe_write_string(Verbose, "% Creating initialization file...\n", !IO),
@@ -1294,11 +1313,21 @@
     globals.io_get_trace_level(TraceLevel, !IO),
     ( given_trace_level_is_none(TraceLevel) = no ->
         TraceOpt = "-t",
-        InitFileNamesList = InitFileNamesList1 ++ TraceInitFileNamesList
+        InitFileNamesList2 = InitFileNamesList1 ++ TraceInitFileNamesList
     ;
         TraceOpt = "",
-        InitFileNamesList = InitFileNamesList1
+        InitFileNamesList2 = InitFileNamesList1
+    ),
+
+    globals.io_lookup_bool_option(source_to_source_debug, SourceDebug, !IO),
+    (
+        SourceDebug = yes,
+        InitFileNamesList = InitFileNamesList2 ++ SourceDebugInitFileNames
+    ;
+        SourceDebug = no,
+        InitFileNamesList = InitFileNamesList2
     ),
+
     join_quoted_string_list(InitFileNamesList, "", "", " ", InitFileNames),
 
     globals.io_lookup_accumulating_option(runtime_flags, RuntimeFlagsList,
@@ -1828,20 +1857,41 @@
             [TraceLib, EventSpecLib, BrowserLib, MdbCompLib])
     ),
 
+    % Source-to-source debugging libraries.
+    globals.io_lookup_bool_option(source_to_source_debug, SourceDebug, !IO),
+    (
+        SourceDebug = yes,
+        StaticSourceDebugLibs =
+            quote_arg(StdLibDir/"lib"/GradeDir/
+                ("libmer_ssdb" ++ LibExt)),
+        make_link_lib(TargetType, "mer_mdbcomp", SharedSourceDebugLibs, !IO)
+    ;
+        SourceDebug = no,
+        StaticSourceDebugLibs = "",
+        SharedSourceDebugLibs = ""
+    ),
+
     globals.io_lookup_string_option(mercury_linkage, MercuryLinkage, !IO),
     ( MercuryLinkage = "static" ->
-        StdLibs = string.join_list(" ",
-            [StaticTraceLibs,
+        StdLibs = string.join_list(" ", [
+            StaticTraceLibs,
+            StaticSourceDebugLibs,
             quote_arg(StdLibDir/"lib"/GradeDir/
                 ("libmer_std" ++ LibExt)),
             quote_arg(StdLibDir/"lib"/GradeDir/
                 ("libmer_rt" ++ LibExt)),
-            StaticGCLibs])
+            StaticGCLibs
+        ])
     ; MercuryLinkage = "shared" ->
         make_link_lib(TargetType, "mer_std", StdLib, !IO),
         make_link_lib(TargetType, "mer_rt", RuntimeLib, !IO),
-        StdLibs = string.join_list(" ",
-            [SharedTraceLibs, StdLib, RuntimeLib, SharedGCLibs])
+        StdLibs = string.join_list(" ", [
+            SharedTraceLibs,
+            SharedSourceDebugLibs,
+            StdLib,
+            RuntimeLib,
+            SharedGCLibs
+        ])
     ;
         unexpected(this_file, "unknown linkage " ++ MercuryLinkage)
     ).
@@ -2439,6 +2489,9 @@
             StdLibDir / "modules" / GradeDir / "mer_browser.init",
             StdLibDir / "modules" / GradeDir / "mer_mdbcomp.init" |
             TraceInitFiles0
+        ],
+        SourceDebugInitFiles = [
+            StdLibDir / "modules" / GradeDir / "mer_ssdb.init"
         ]
     ;
         % Supporting `--no-mercury-standard-library-directory' is necessary
@@ -2446,15 +2499,24 @@
         % the lmc script.
         MaybeStdLibDir = no,
         InitFiles1 = InitFiles0,
-        TraceInitFiles = TraceInitFiles0
+        TraceInitFiles = TraceInitFiles0,
+        SourceDebugInitFiles = []
     ),
     globals.get_trace_level(Globals, TraceLevel),
     ( given_trace_level_is_none(TraceLevel) = no ->
         TraceOpt = "-t",
-        InitFiles = InitFiles1 ++ TraceInitFiles
+        InitFiles2 = InitFiles1 ++ TraceInitFiles
     ;
         TraceOpt = "",
-        InitFiles = InitFiles1
+        InitFiles2 = InitFiles1
+    ),
+    globals.lookup_bool_option(Globals, source_to_source_debug, SourceDebug),
+    (
+        SourceDebug = yes,
+        InitFiles = InitFiles2 ++ SourceDebugInitFiles
+    ;
+        SourceDebug = no,
+        InitFiles = InitFiles2
     ),
     join_string_list(InitFiles, "", "", " ", InitFilesList),
     globals.lookup_accumulating_option(Globals, runtime_flags,
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.309
diff -u -r1.309 handle_options.m
--- compiler/handle_options.m	10 Oct 2007 07:18:12 -0000	1.309
+++ compiler/handle_options.m	19 Oct 2007 07:11:17 -0000
@@ -2495,6 +2495,8 @@
     [exec_trace - bool(yes), decl_debug - bool(yes)], no, yes).
 grade_component_table("debug", comp_trace,
     [exec_trace - bool(yes), decl_debug - bool(no)], no, yes).
+grade_component_table("ssdebug", comp_trace,
+    [source_to_source_debug - bool(yes)], no, yes).
 
     % Low (target) level debugging components.
 grade_component_table("ll_debug", comp_lowlevel,
Index: compiler/notes/overall_design.html
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/notes/overall_design.html,v
retrieving revision 1.7
diff -u -r1.7 overall_design.html
--- compiler/notes/overall_design.html	31 Mar 2005 00:51:56 -0000	1.7
+++ compiler/notes/overall_design.html	19 Oct 2007 07:11:18 -0000
@@ -52,6 +52,7 @@
 <li> browser: the part of the Mercury debugger that is written in Mercury
 <li> mdbcomp: the library that defines the Mercury data structures
 generated by the compiler for the debugger
+<li> ssdb: support code for the source-to-source debugger (written in Mercury)
 <li> slice: tools for manipulating slices and dices (written in Mercury)
 <li> profiler: the Mercury profiler (written in Mercury)
 <li> deep_profiler: the Mercury deep profiler (written in Mercury)
@@ -155,6 +156,7 @@
 <li> the object of the auto-generated init file (generated by util/mkinit.c)
 <li> the main program object files (e.g. compiler/*.o or profiler/*.o)
 <li> trace library (trace/libmer_trace.a)
+<li> ssdb library (ssdb/libmer_ssdb.a)
 <li> browser library (browser/libmer_browser.a)
 <li> mdbcomp library (mdbcomp/libmer_mdbcomp.a)
 <li> standard library (library/libmer_std.a)
Index: library/LIB_FLAGS.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/LIB_FLAGS.in,v
retrieving revision 1.2
diff -u -r1.2 LIB_FLAGS.in
--- library/LIB_FLAGS.in	16 Dec 2005 05:49:39 -0000	1.2
+++ library/LIB_FLAGS.in	19 Oct 2007 07:11:18 -0000
@@ -7,6 +7,7 @@
 --generate-mmc-deps
 --no-shlib-linker-use-install-name
 --trace minimum
+--no-ssdb
 --c-include-directory ../boehm_gc
 --c-include-directory ../boehm_gc/include
 --c-include-directory ../runtime
Index: mdbcomp/MDBCOMP_FLAGS.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/MDBCOMP_FLAGS.in,v
retrieving revision 1.2
diff -u -r1.2 MDBCOMP_FLAGS.in
--- mdbcomp/MDBCOMP_FLAGS.in	20 Jul 2007 01:22:04 -0000	1.2
+++ mdbcomp/MDBCOMP_FLAGS.in	19 Oct 2007 07:11:18 -0000
@@ -3,6 +3,7 @@
 --halt-at-warn
 --no-warn-inferred-erroneous
 --no-mercury-stdlib-dir
+--no-ssdb
 --no-shlib-linker-use-install-name
 -I../library
 --c-include-directory ../boehm_gc
Index: profiler/.mgnuc_copts
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/.mgnuc_copts,v
retrieving revision 1.1
diff -u -r1.1 .mgnuc_copts
--- profiler/.mgnuc_copts	20 May 2005 06:15:16 -0000	1.1
+++ profiler/.mgnuc_copts	19 Oct 2007 07:11:18 -0000
@@ -7,4 +7,6 @@
 -I../mdbcomp/Mercury/mihs
 -I../browser
 -I../browser/Mercury/mihs
+-I../ssdb
+-I../ssdb/Mercury/mihs
 -I../trace
Index: profiler/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/Mmakefile,v
retrieving revision 1.28
diff -u -r1.28 Mmakefile
--- profiler/Mmakefile	20 Jul 2007 01:22:05 -0000	1.28
+++ profiler/Mmakefile	19 Oct 2007 07:11:18 -0000
@@ -17,6 +17,8 @@
 MAIN_TARGET=all
 MERCURY_MAIN_MODULES=mercury_profile
 
+# VPATH = $(LIBRARY_DIR) $(SSDB_DIR)
+
 #-----------------------------------------------------------------------------#
 
 MLFLAGS += --shared
Index: profiler/PROF_FLAGS.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/profiler/PROF_FLAGS.in,v
retrieving revision 1.2
diff -u -r1.2 PROF_FLAGS.in
--- profiler/PROF_FLAGS.in	12 Jan 2006 07:07:31 -0000	1.2
+++ profiler/PROF_FLAGS.in	19 Oct 2007 07:11:18 -0000
@@ -6,6 +6,7 @@
 -I../library
 -I../browser
 -I../mdbcomp
+-I../ssdb
 --c-include-directory ../boehm_gc
 --c-include-directory ../boehm_gc/include
 --c-include-directory ../runtime
@@ -15,5 +16,7 @@
 --c-include-directory ../mdbcomp/Mercury/mihs
 --c-include-directory ../browser
 --c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../ssdb
+--c-include-directory ../ssdb/Mercury/mihs
 --c-include-directory ../trace
 --config-file ../scripts/Mercury.config.bootstrap
Index: runtime/mercury_conf_param.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.102
diff -u -r1.102 mercury_conf_param.h
--- runtime/mercury_conf_param.h	11 Oct 2007 11:45:21 -0000	1.102
+++ runtime/mercury_conf_param.h	19 Oct 2007 07:11:19 -0000
@@ -179,6 +179,11 @@
 **
 **	Setting MR_DECL_DEBUG requires MR_EXEC_TRACE to be set also.
 **
+** MR_SS_DEBUG
+**	Enable source-to-source debugging on all Mercury procedures.
+**	This effect is achieved by including MR_SS_DEBUG in the mangled
+**	grade (see mercury_grade.h).
+**
 ** MR_TRACE_COUNT_DEBUG
 ** 	Enables runtime checking of the invariants involving the implementation
 ** 	of the --trace-count runtime option.
Index: runtime/mercury_grade.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_grade.h,v
retrieving revision 1.74
diff -u -r1.74 mercury_grade.h
--- runtime/mercury_grade.h	10 Oct 2007 07:18:15 -0000	1.74
+++ runtime/mercury_grade.h	19 Oct 2007 07:11:19 -0000
@@ -381,8 +381,13 @@
     #define MR_GRADE_PART_14		MR_PASTE3(MR_GRADE_PART_13, _debug, MR_GRADE_EXEC_TRACE_VERSION_NO)
     #define MR_GRADE_OPT_PART_14	MR_GRADE_OPT_PART_13 ".debug"
     #else
-      #define MR_GRADE_PART_14		MR_GRADE_PART_13
-      #define MR_GRADE_OPT_PART_14	MR_GRADE_OPT_PART_13
+      #if defined(MR_SS_DEBUG)
+	#define MR_GRADE_PART_14	MR_PASTE3(MR_GRADE_PART_13, _ssdebug, MR_GRADE_EXEC_TRACE_VERSION_NO)
+	#define MR_GRADE_OPT_PART_14	MR_GRADE_OPT_PART_13 ".ssdebug"
+      #else
+	#define MR_GRADE_PART_14	MR_GRADE_PART_13
+	#define MR_GRADE_OPT_PART_14	MR_GRADE_OPT_PART_13
+      #endif
     #endif
 #endif
 
Index: scripts/c2init.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/c2init.in,v
retrieving revision 1.49
diff -u -r1.49 c2init.in
--- scripts/c2init.in	30 Nov 2006 12:45:48 -0000	1.49
+++ scripts/c2init.in	19 Oct 2007 07:11:19 -0000
@@ -45,7 +45,7 @@
 #	tools/binary
 #	tools/binary_step
 #	tools/linear
-#	tools/lmc
+#	tools/lmc.in
 #	tools/lml
 
 RT_LIB_NAME=mer_rt
@@ -54,6 +54,7 @@
 EVENTSPEC_LIB_NAME=mer_eventspec
 BROWSER_LIB_NAME=mer_browser
 MDBCOMP_LIB_NAME=mer_mdbcomp
+SSDB_LIB_NAME=mer_ssdb
 ANALYSIS_LIB_NAME=mer_analysis
 
 MKINIT=${MERCURY_MKINIT=mkinit}
@@ -85,17 +86,29 @@
 	MERCURY_TRACE_LIB_MODS="\
 		$mercury_stdlib_dir/modules/$GRADE/$BROWSER_LIB_NAME.init \
 		$mercury_stdlib_dir/modules/$GRADE/$MDBCOMP_LIB_NAME.init"
+	MERCURY_SSDB_LIB_MODS="\
+		$mercury_stdlib_dir/modules/$GRADE/$SSDB_LIB_NAME.init"
 fi
 MERCURY_TRACE_LIB_MODS="$MERCURY_TRACE_LIB_MODS $trace_init_files"
 
 case "$trace_opt" in
 	-t)
 		init_opt="-i"
-		MERCURY_ALL_LIB_MODS="$MERCURY_MOD_LIB_MODS\
+		MERCURY_ALL_LIB_MODS0="$MERCURY_MOD_LIB_MODS\
 			$MERCURY_TRACE_LIB_MODS"
 		;;
 	*)
-		MERCURY_ALL_LIB_MODS="$MERCURY_MOD_LIB_MODS"
+		MERCURY_ALL_LIB_MODS0="$MERCURY_MOD_LIB_MODS"
+		;;
+esac
+
+case $ss_debug in
+	true)
+		MERCURY_ALL_LIB_MODS="$MERCURY_ALL_LIB_MODS0\
+			$MERCURY_SSDB_LIB_MODS"
+		;;
+	false)
+		MERCURY_ALL_LIB_MODS="$MERCURY_ALL_LIB_MODS0"
 		;;
 esac
 
Index: scripts/canonical_grade.sh-subr
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/canonical_grade.sh-subr,v
retrieving revision 1.20
diff -u -r1.20 canonical_grade.sh-subr
--- scripts/canonical_grade.sh-subr	10 Oct 2007 07:18:15 -0000	1.20
+++ scripts/canonical_grade.sh-subr	19 Oct 2007 07:11:19 -0000
@@ -143,14 +143,15 @@
 # 	false)	;;
 # esac
 
-case $debug,$decl_debug in
-	true,true)	GRADE="$GRADE.decldebug" ;;
-	true,false)	GRADE="$GRADE.debug" ;;
-	false,false)	;;
-	*)		progname=`basename $0`
-			echo "$progname: error: invalid combination of debugging options." 1>&2
-			exit 1
-			;;
+case $debug,$decl_debug,$ss_debug in
+	true,true,false)	GRADE="$GRADE.decldebug" ;;
+	true,false,false)	GRADE="$GRADE.debug" ;;
+	false,false,true)	GRADE="$GRADE.ssdebug" ;;
+	false,false,false)	;;
+	*)			progname=`basename $0`
+				echo "$progname: error: invalid combination of debugging options." 1>&2
+				exit 1
+				;;
 esac
 
 case $ll_debug in
Index: scripts/init_grade_options.sh-subr
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/init_grade_options.sh-subr,v
retrieving revision 1.31
diff -u -r1.31 init_grade_options.sh-subr
--- scripts/init_grade_options.sh-subr	10 Oct 2007 07:18:16 -0000	1.31
+++ scripts/init_grade_options.sh-subr	19 Oct 2007 07:11:19 -0000
@@ -48,6 +48,7 @@
 	--no-stack-trace
 	--debug
 	--decl-debug
+	--ss-debug
 	--low-level-debug
 	--extend-stacks-when-needed
 	--stack-segments
@@ -85,6 +86,7 @@
 pic_reg=false
 debug=false
 decl_debug=false
+ss_debug=false
 ll_debug=false
 extend_stacks=false
 stack_segments=false
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.122
diff -u -r1.122 mgnuc.in
--- scripts/mgnuc.in	10 Oct 2007 07:18:16 -0000	1.122
+++ scripts/mgnuc.in	19 Oct 2007 07:11:19 -0000
@@ -389,6 +389,11 @@
     false)          DECL_DEBUG_OPTS="" ;;
 esac
 
+case $ss_debug in
+    true)           SS_DEBUG_OPTS="-DMR_SS_DEBUG" ;;
+    false)          SS_DEBUG_OPTS="" ;;
+esac
+
 case $ll_debug in
     true)           LL_DEBUG_OPTS="-DMR_LL_DEBUG $DEBUG_OPT -O0" ;;
     false)          LL_DEBUG_OPTS="" ;;
@@ -604,6 +609,7 @@
     $STACK_TRACE_OPTS\
     $TRACE_OPTS\
     $DECL_DEBUG_OPTS\
+    $SS_DEBUG_OPTS\
     $LL_DEBUG_OPTS\
     $EXTEND_STACKS_OPTS\
     $STACK_SEGMENTS_OPTS\
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.118
diff -u -r1.118 ml.in
--- scripts/ml.in	24 Nov 2006 03:48:21 -0000	1.118
+++ scripts/ml.in	19 Oct 2007 07:11:19 -0000
@@ -49,7 +49,7 @@
 LDFLAGS_FOR_TRACE="@LDFLAGS_FOR_TRACE@"
 LD_LIBFLAGS_FOR_THREADS="@LD_LIBFLAGS_FOR_THREADS@"
 THREAD_LIBS="@THREAD_LIBS@"
-TRACE_LIBS_SYSTEM="@TRACE_LIBS_SYSTEM@"
+TRACE_BASE_LIBS_SYSTEM="@TRACE_LIBS_SYSTEM@"
 
 TMPDIR=${TMPDIR=/tmp}
 MATH_LIB=${MERCURY_MATH_LIB="@MATH_LIB@"}
@@ -96,6 +96,7 @@
 RT_LIB_NAME=mer_rt
 STD_LIB_NAME=mer_std
 TRACE_LIB_NAME=mer_trace
+SSDB_LIB_NAME=mer_ssdb
 EVENTSPEC_LIB_NAME=mer_eventspec
 BROWSER_LIB_NAME=mer_browser
 MDBCOMP_LIB_NAME=mer_mdbcomp
@@ -107,6 +108,17 @@
 	false)	;;
 esac
 
+trace_base=false
+case $trace in
+	true)	trace_base=true ;;
+	false)	;;
+esac
+
+case $ss_debug in
+	true)	trace_base=true ;;
+	false)	;;
+esac
+
 case "$mercury_stdlib_dir" in
     "")	LIBDIR= ;;
     *)	LIBDIR=$mercury_stdlib_dir/lib ;;
@@ -222,13 +234,11 @@
 		;;
 esac
 
-case $trace in
-	true)	TRACE_LIBS="-l$TRACE_LIB_NAME -l$EVENTSPEC_LIB_NAME \
+case $trace_base in
+	true)	TRACE_BASE_LIBS="-l$EVENTSPEC_LIB_NAME \
 		   -l$BROWSER_LIB_NAME -l$MDBCOMP_LIB_NAME"
-		TRACE_LIBS_SYSTEM="$TRACE_LIBS_SYSTEM $READLINE_LIBRARIES"
-		TRACE_STATIC_LIBS="\
-		  `$FIX_PATH_FOR_LINKER \
-		   $LIBDIR/$GRADE/lib$TRACE_LIB_NAME. at LIB_SUFFIX@` \
+ 		TRACE_BASE_LIBS_SYSTEM="$TRACE_LIBS_SYSTEM $READLINE_LIBRARIES"
+ 		TRACE_BASE_STATIC_LIBS="\
 		  `$FIX_PATH_FOR_LINKER \
 		   $LIBDIR/$GRADE/lib$EVENTSPEC_LIB_NAME. at LIB_SUFFIX@` \
 		  `$FIX_PATH_FOR_LINKER \
@@ -236,12 +246,37 @@
 		  `$FIX_PATH_FOR_LINKER \
 		   $LIBDIR/$GRADE/lib$MDBCOMP_LIB_NAME. at LIB_SUFFIX@`"
 		;;
+	false)	TRACE_BASE_LIBS=
+		TRACE_BASE_LIBS_SYSTEM=
+		TRACE_BASE_STATIC_LIBS=
+		;;
+esac
+
+case $trace in
+	true)	TRACE_LIBS="-l$TRACE_LIB_NAME $TRACE_BASE_LIBS"
+		TRACE_LIBS_SYSTEM="$TRACE_BASE_LIBS_SYSTEM"
+		TRACE_STATIC_LIBS="\
+		  `$FIX_PATH_FOR_LINKER \
+		   $LIBDIR/$GRADE/lib$TRACE_LIB_NAME. at LIB_SUFFIX@` \
+		   $TRACE_BASE_STATIC_LIBS"
+		;;
 	false)	TRACE_LIBS=
 		TRACE_LIBS_SYSTEM=
 		TRACE_STATIC_LIBS=
 		;;
 esac
-		
+
+case $ss_debug in
+	true)	SSDB_LIBS="-l$SSDB_LIB_NAME"
+		SSDB_STATIC_LIBS="\
+		  `$FIX_PATH_FOR_LINKER \
+		   $LIBDIR/$GRADE/lib$SSDB_LIB_NAME. at LIB_SUFFIX@`"
+		;;
+	false)	SSDB_LIBS=
+		SSDB_STATIC_LIBS=
+		;;
+esac
+
 case $strip in
 	true)	STRIP_OPTS="-s" ;;
 	false)  STRIP_OPTS="" ;;
@@ -342,18 +377,20 @@
 
 case $mercury_libs in
 	shared)
-		MERCURY_LIBS=${MERCURY_LIBS="$TRACE_LIBS -l$STD_LIB_NAME -l$RT_LIB_NAME $LIBGC"}
+		MERCURY_LIBS=${MERCURY_LIBS="$SSDB_LIBS $TRACE_LIBS \
+			-l$STD_LIB_NAME -l$RT_LIB_NAME $LIBGC"}
 		LIBS=${LIBS="$MERCURY_LIBS $TRACE_LIBS_SYSTEM $STDLIBS"}
 		merc_shlib_dirs="$merc_shlib_dirs $LIBDIR/$GRADE"
 		merc_shlib_dirs="$merc_shlib_dirs $LIBDIR"
 		;;
 	static)
-		MERCURY_LIBS=${MERCURY_LIBS="$TRACE_STATIC_LIBS
-		`$FIX_PATH_FOR_LINKER \
-		  $LIBDIR/$GRADE/lib$STD_LIB_NAME. at LIB_SUFFIX@` \
-		`$FIX_PATH_FOR_LINKER \
-		  $LIBDIR/$GRADE/lib$RT_LIB_NAME. at LIB_SUFFIX@` \
-		$LIBGC_STATIC"}
+		MERCURY_LIBS=${MERCURY_LIBS="$SSDB_STATIC_LIBS \
+			$TRACE_STATIC_LIBS \
+			`$FIX_PATH_FOR_LINKER \
+			  $LIBDIR/$GRADE/lib$STD_LIB_NAME. at LIB_SUFFIX@` \
+			`$FIX_PATH_FOR_LINKER \
+			  $LIBDIR/$GRADE/lib$RT_LIB_NAME. at LIB_SUFFIX@` \
+			$LIBGC_STATIC"}
 		LIBS=${LIBS="$MERCURY_LIBS $TRACE_LIBS_SYSTEM $STDLIBS"}
 		merc_shlib_dirs=""
 		;;
Index: scripts/parse_grade_options.sh-subr
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/parse_grade_options.sh-subr,v
retrieving revision 1.38
diff -u -r1.38 parse_grade_options.sh-subr
--- scripts/parse_grade_options.sh-subr	10 Oct 2007 07:18:16 -0000	1.38
+++ scripts/parse_grade_options.sh-subr	19 Oct 2007 07:11:19 -0000
@@ -185,6 +185,11 @@
     --no-decl-debug)
         decl_debug=false ;;
 
+    --ss-debug)
+        ss_debug=true ;;
+    --no-ss-debug)
+        ss_debug=false ;;
+
     --low-level-debug)
         ll_debug= true ;;
     --no-low-level-debug)
@@ -248,6 +253,7 @@
         pic_reg=false
         debug=false
         decl_debug=false
+        ss_debug=false
         ll_debug=false
         extend_stacks=false
         stack_segments=false
@@ -493,6 +499,10 @@
                     decl_debug=true
                     ;;
 
+                ssdebug)
+                    ss_debug=true
+                    ;;
+
                 ll_debug)
                     ll_debug=true
                     ;;
Index: slice/.mgnuc_copts
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/.mgnuc_copts,v
retrieving revision 1.3
diff -u -r1.3 .mgnuc_copts
--- slice/.mgnuc_copts	3 Oct 2006 13:26:17 -0000	1.3
+++ slice/.mgnuc_copts	19 Oct 2007 07:11:19 -0000
@@ -7,4 +7,6 @@
 -I../mdbcomp/Mercury/mihs
 -I../browser
 -I../browser/Mercury/mihs
+-I../ssdb
+-I../ssdb/Mercury/mihs
 -I../trace
Index: slice/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/Mmakefile,v
retrieving revision 1.13
diff -u -r1.13 Mmakefile
--- slice/Mmakefile	12 Sep 2007 06:21:18 -0000	1.13
+++ slice/Mmakefile	19 Oct 2007 07:11:19 -0000
@@ -42,7 +42,7 @@
 INT3S	= $(patsubst %,%.int3s,$(MERCURY_MAIN_MODULES))
 CHECKS	= $(patsubst %,%.check,$(MERCURY_MAIN_MODULES))
 
-VPATH = $(LIBRARY_DIR)
+VPATH = $(LIBRARY_DIR) $(SSDB_DIR)
 
 #-----------------------------------------------------------------------------#
 
Index: slice/SLICE_FLAGS.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/SLICE_FLAGS.in,v
retrieving revision 1.6
diff -u -r1.6 SLICE_FLAGS.in
--- slice/SLICE_FLAGS.in	6 Jun 2007 07:12:54 -0000	1.6
+++ slice/SLICE_FLAGS.in	19 Oct 2007 07:11:19 -0000
@@ -5,6 +5,7 @@
 --no-mercury-stdlib-dir
 -I../library
 -I../browser
+-I../ssdb
 --c-include-directory ../boehm_gc
 --c-include-directory ../boehm_gc/include
 --c-include-directory ../runtime
@@ -12,6 +13,8 @@
 --c-include-directory ../library/Mercury/mihs
 --c-include-directory ../browser
 --c-include-directory ../browser/Mercury/mihs
+--c-include-directory ../ssdb
+--c-include-directory ../ssdb/Mercury/mihs
 --c-include-directory ../trace
 --config-file ../scripts/Mercury.config.bootstrap
 --force-disable-tracing
Index: tools/binary
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/binary,v
retrieving revision 1.27
diff -u -r1.27 binary
--- tools/binary	10 Jan 2007 04:16:26 -0000	1.27
+++ tools/binary	19 Oct 2007 07:11:19 -0000
@@ -286,6 +286,7 @@
 fi
 ln -s $root/boehm_gc .
 ln -s $root/browser .
+ln -s $root/ssdb .
 ln -s $root/trace .
 ln -s $root/robdd .
 ln -s $root/doc .
@@ -403,6 +404,7 @@
     cd $root/stage3
     ln -s $root/boehm_gc .
     ln -s $root/browser .
+    ln -s $root/ssdb .
     ln -s $root/trace .
     ln -s $root/doc .
     ln -s $root/scripts .
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.200
diff -u -r1.200 bootcheck
--- tools/bootcheck	3 Oct 2007 12:11:59 -0000	1.200
+++ tools/bootcheck	19 Oct 2007 07:11:20 -0000
@@ -144,7 +144,7 @@
     --no-sym-links
         Use this option on systems which don't support symbolic links.
     --disable-debug-libs
-        Make the trace and browser libraries empty. This can be useful
+        Make the trace, browser, ssdb libraries empty. This can be useful
         when trying to track down the reason why they are being linked
         into the compiler in the first place.
     --keep-deep-data
@@ -977,6 +977,8 @@
         then
             /bin/rm $stage2dir/browser/lib$BROWSER_LIB_NAME.a
             ar cr $stage2dir/browser/lib$BROWSER_LIB_NAME.a
+            /bin/rm $stage2dir/ssdb/lib$ssdb_LIB_NAME.a
+            ar cr $stage2dir/ssdb/lib$ssdb_LIB_NAME.a
             /bin/rm $stage2dir/trace/lib$TRACE_LIB_NAME.a
             ar cr $stage2dir/trace/lib$TRACE_LIB_NAME.a
         fi
Index: tools/linear
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/linear,v
retrieving revision 1.8
diff -u -r1.8 linear
--- tools/linear	27 Oct 2003 06:00:47 -0000	1.8
+++ tools/linear	19 Oct 2007 07:11:20 -0000
@@ -175,6 +175,7 @@
 fi
 ln -s $root/boehm_gc .
 ln -s $root/browser .
+ln -s $root/ssdb .
 ln -s $root/trace .
 ln -s $root/doc .
 ln -s $root/scripts .
Index: tools/lmc.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/lmc.in,v
retrieving revision 1.10
diff -u -r1.10 lmc.in
--- tools/lmc.in	3 Jan 2007 05:17:19 -0000	1.10
+++ tools/lmc.in	19 Oct 2007 07:11:20 -0000
@@ -93,10 +93,25 @@
 	echo "$WORKSPACE/boehm_gc does not have a gc library"
 fi
 
-LIB_FLAGS="--link-object $WORKSPACE/trace/libmer_trace.$O --link-object
-$WORKSPACE/trace/libmer_eventspec.$O --link-object $WORKSPACE/browser/libmer_browser.$O --link-object $WORKSPACE/mdbcomp/libmer_mdbcomp.$O --link-object $WORKSPACE/library/libmer_std.$O --link-object $WORKSPACE/runtime/libmer_rt.$O --link-object $gclib -lm @TRACE_LIBS_SYSTEM@ @READLINE_LIBRARIES@"
-
-INIT_FLAGS="--trace-init-file $WORKSPACE/browser/mer_browser.init --trace-init-file $WORKSPACE/mdbcomp/mer_mdbcomp.init --init-file $WORKSPACE/library/mer_std.init --init-file $WORKSPACE/runtime/mer_rt.init"
+LIB_FLAGS="\
+	--link-object $WORKSPACE/trace/libmer_trace.$O \
+	--link-object $WORKSPACE/trace/libmer_eventspec.$O \
+	--link-object $WORKSPACE/ssdb/libmer_ssdb.$O \
+	--link-object $WORKSPACE/browser/libmer_browser.$O \
+	--link-object $WORKSPACE/mdbcomp/libmer_mdbcomp.$O \
+	--link-object $WORKSPACE/library/libmer_std.$O \
+	--link-object $WORKSPACE/runtime/libmer_rt.$O \
+	--link-object $gclib \
+	-lm @TRACE_LIBS_SYSTEM@ @READLINE_LIBRARIES@"
+
+# XXX browser.init and mdbcomp.init might need to be included even if tracing
+# is disabled if ssdb uses code from the browser or mdbcomp libraries
+INIT_FLAGS="\
+	--init-file $WORKSPACE/ssdb/mer_ssdb.init \
+	--trace-init-file $WORKSPACE/browser/mer_browser.init \
+	--trace-init-file $WORKSPACE/mdbcomp/mer_mdbcomp.init \
+	--init-file $WORKSPACE/library/mer_std.init \
+	--init-file $WORKSPACE/runtime/mer_rt.init"
 
 LINK_FLAGS=""
 
Index: tools/lml
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/lml,v
retrieving revision 1.3
diff -u -r1.3 lml
--- tools/lml	28 Jan 2005 07:12:02 -0000	1.3
+++ tools/lml	19 Oct 2007 07:11:20 -0000
@@ -34,7 +34,14 @@
 	echo "$WORKSPACE/boehm_gc does not have a gc library"
 fi
 
-MERCURY_LIBS="$WORKSPACE/trace/libmer_trace.a $WORKSPACE/browser/libmer_browser.a $WORKSPACE/mdbcomp/libmer_mdbcomp.a $WORKSPACE/library/libmer_std.a $WORKSPACE/runtime/libmer_rt.a $gclib -lm"
+MERCURY_LIBS="\
+	$WORKSPACE/trace/libmer_trace.a \
+	$WORKSPACE/ssdb/libmer_ssdb.a \
+	$WORKSPACE/browser/libmer_browser.a \
+	$WORKSPACE/mdbcomp/libmer_mdbcomp.a \
+	$WORKSPACE/library/libmer_std.a \
+	$WORKSPACE/runtime/libmer_rt.a \
+	$gclib -lm"
 export MERCURY_LIBS
 
 PATH="$WORKSPACE/scripts:$WORKSPACE/util:$PATH"

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list