[m-rev.] for review: ssdb compiler scaffolding

Peter Ross pro at missioncriticalit.com
Wed Oct 3 21:45:29 AEST 2007


On Wed, Oct 03, 2007 at 05:49:46PM +1000, Zoltan Somogyi wrote:
> On 03-Oct-2007, Peter Ross <pro at missioncriticalit.com> wrote:
> > ssdb/Mercury.options:
> > ssdb/Mmakefile:
> > ssdb/SSDB_FLAGS.in:
> > 	Build system for ssdb directory.
> 
> You will also need .mgnuc_opts and .mgnuc_copts files.
> 

I also needed to fix the bootcheck script.


===================================================================



Estimated hours taken: 4
Branches: main

Initial checkin which is all the scaffolding needed to
support the new source to source mercury debugger (ssdb).

The main addition in this change is the ssdb directory,
which will contain the mer_ssdb library.

Mmake.workspace:
Mmakefile:
configure.in:
	Handle the new ssdb directory.

compiler/options.m:
	Add the --ssdb and --source-to-source-debug options.

compiler/mercury_compile.m:
	Add the ssdb pass (it does nothing at the moment).

compiler/modules.m:
	Implicitly import ssdb_builtin when compiling with --ssdb.
	
mdbcomp/prim_data.m:
	Handle the ssdb module.

ssdb/Mercury.options:
ssdb/Mmakefile:
ssdb/SSDB_FLAGS.in:
ssdb/.mgnuc_copts:
ssdb/.mgnuc_opts:
ssdb/RESERVED_MACRO_NAMES:
	Build system for ssdb directory.

ssdb/mer_ssdb.m:
ssdb/ssdb.m:
	The operations which are needed by the source to source
	debugger.
	
tools/bootcheck:
	Changes to the bootcheck script to handle the new ssdb module.

diff -u Mmakefile Mmakefile
--- Mmakefile	3 Oct 2007 05:17:01 -0000
+++ Mmakefile	3 Oct 2007 11:39:31 -0000
@@ -109,7 +109,7 @@
 
 .PHONY: dep_ssdb
 dep_ssdb: \
-	ssdb/$(deps_subdir)$(BROWSER_LIB_NAME).dep
+	ssdb/$(deps_subdir)$(SSDB_LIB_NAME).dep
 
 ssdb/$(deps_subdir)$(SSDB_LIB_NAME).dep:
 	+cd ssdb && $(SUBDIR_MMAKE) $(SSDB_LIB_NAME).depend
diff -u ssdb/mer_ssdb.m ssdb/mer_ssdb.m
--- ssdb/mer_ssdb.m	3 Oct 2007 05:17:07 -0000
+++ ssdb/mer_ssdb.m	3 Oct 2007 11:39:51 -0000
@@ -18 +18 @@
-:- import_module ssdb_builtin.
+:- import_module ssdb.
reverted:
--- ssdb/ssdb_builtin.m	3 Oct 2007 05:17:07 -0000
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,64 +0,0 @@
-%---------------------------------------------------------------------------%
-% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
-%---------------------------------------------------------------------------%
-% Copyright (C) 2007 The University of Melbourne.
-% This file may only be copied under the terms of the GNU Library General
-% Public License - see the file COPYING.LIB in the Mercury distribution.
-%---------------------------------------------------------------------------%
-%
-% File: ssdb_builtin.m.
-% Author: oannet.
-%
-% This module is automatically imported into every module that is compiled
-% using --source-to-source-debug.
-%
-% It provides the primitives which are needed by this source-to-source
-% transformation to allow debugging.
-%
-%----------------------------------------------------------------------------%
-%----------------------------------------------------------------------------%
-
-:- module ssdb_builtin.
-:- interface.
-
-
-:- type ssdb_event_type
-    --->    ssdb_call
-    ;       ssdb_exit
-    ;       ssdb_redo
-    ;       ssdb_fail
-    .
-
-    %
-    % This routine is called at each event that occurs
-    %
-:- impure pred handle_event(ssdb_event_type::in) is det.
-
-%----------------------------------------------------------------------------%
-%----------------------------------------------------------------------------%
-
-:- implementation.
-
-:- import_module io.
-
-:- import_module bool.
-:- import_module int.
-:- import_module list.
-:- import_module string.
-
-%----------------------------------------------------------------------------%
-
-    %
-    % For the moment we just write the event out.
-    % Later this will be extended.
-    %
-handle_event(Event) :-
-    promise_impure (
-    trace [io(!IO)] (
-        io.write(Event, !IO),
-        io.nl(!IO)
-    )
-    ).
-
-%----------------------------------------------------------------------------%
-%----------------------------------------------------------------------------%
only in patch2:
unchanged:
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ssdb/.mgnuc_copts	3 Oct 2007 11:39:50 -0000
@@ -0,0 +1,11 @@
+-I../boehm_gc
+-I../boehm_gc/include
+-I../runtime
+-I../library
+-I../library/Mercury/mihs
+-I../mdbcomp
+-I../mdbcomp/Mercury/mihs
+-I../browser
+-I../browser/Mercury/mihs
+-I../ssdb
+-I../ssdb/Mercury/mihs
only in patch2:
unchanged:
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ssdb/.mgnuc_opts	3 Oct 2007 11:39:50 -0000
@@ -0,0 +1 @@
+--no-mercury-stdlib-dir
only in patch2:
unchanged:
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ssdb/RESERVED_MACRO_NAMES	3 Oct 2007 11:39:51 -0000
@@ -0,0 +1,69 @@
+#-----------------------------------------------------------------------------#
+# Copyright (C) 2000-2004, 2006 The University of Melbourne.
+# This file may only be copied under the terms of the GNU General
+# Public License - see the file COPYING in the Mercury distribution.
+#-----------------------------------------------------------------------------#
+#
+# RESERVED_MACRO_NAMES
+#
+# This file lists the macro names, other than the ones starting with a
+# certain set of allowed prefixes that are defined by the Mercury header files.
+# The Mmakefile target `check_headers' automatically checks that no other
+# macro names are defined. This is done to keep our headers namespace-clean,
+# i.e. ensure that we don't invade the user's namespace.
+#
+# This file is used as the argument to `fgrep -f'.
+# Lines starting with `#' will not match anything in the input,
+# and can thus be used as comments.
+# Other lines are treated as strings to match against.
+#
+#-----------------------------------------------------------------------------#
+# This is documented in the Mercury language reference manual
+# and defined by mercury_types.h.
+SUCCESS_INDICATOR
+#-----------------------------------------------------------------------------#
+# pid_t is only defined in mercury_conf.h if it is not present
+# in the system headers. I don't think there is a nice way to
+# prefix this without requiring a later version of autoconf (e.g. 2.52).
+pid_t
+#-----------------------------------------------------------------------------#
+# These are defined by boehm_gc/gc.h.
+__GC
+_GC_H
+HIDE_POINTER
+LINUX_THREADS
+REVEAL_POINTER
+#-----------------------------------------------------------------------------#
+# These are defined by boehm_gc/include/gc_pthread_redirects.h
+dlopen
+pthread_create
+pthread_detach
+pthread_join
+pthread_sigmask
+#-----------------------------------------------------------------------------#
+# This is defined by mps_gc/code/mercury_mps.h,
+# which uses this macro for its header guard.
+# Normally it would be better to use uppercase for header guard macro names,
+# but that would be inconsistent with the coding style used in mps_gc/code.
+mercury_mps_h
+#-----------------------------------------------------------------------------#
+# This is defined by the mgnuc script in some grades.
+# It is used for configuring the Boehm collector.
+# XXX it should have a GC_ prefix.
+NO_SIGNALS
+#-----------------------------------------------------------------------------#
+# These are defined automatically by GCC -- gcc optionally passes
+# them on the command line when calling cc1, depending on the
+# exact options which gcc was invoked with.  These are not
+# namespace pollution, since they are in the _[A-Z]* namespace
+# which is reserved for the C implementation, and they are being
+# defined by the C implementation.
+_GNU_SOURCE
+__EXTENSIONS__
+__OPTIMIZE__
+__STRICT_ANSI__
+#-----------------------------------------------------------------------------#
+# These are defined in when threads are enabled.
+_REENTRANT
+_THREAD_SAFE
+#-----------------------------------------------------------------------------#
only in patch2:
unchanged:
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ssdb/ssdb.m	3 Oct 2007 11:39:51 -0000
@@ -0,0 +1,64 @@
+%---------------------------------------------------------------------------%
+% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
+%---------------------------------------------------------------------------%
+% Copyright (C) 2007 The University of Melbourne.
+% This file may only be copied under the terms of the GNU Library General
+% Public License - see the file COPYING.LIB in the Mercury distribution.
+%---------------------------------------------------------------------------%
+%
+% File: ssdb.m.
+% Author: oannet.
+%
+% This module is automatically imported into every module that is compiled
+% using --source-to-source-debug.
+%
+% It provides the primitives which are needed by this source-to-source
+% transformation to allow debugging.
+%
+%----------------------------------------------------------------------------%
+%----------------------------------------------------------------------------%
+
+:- module ssdb.
+:- interface.
+
+
+:- type ssdb_event_type
+    --->    ssdb_call
+    ;       ssdb_exit
+    ;       ssdb_redo
+    ;       ssdb_fail
+    .
+
+    %
+    % This routine is called at each event that occurs
+    %
+:- impure pred handle_event(ssdb_event_type::in) is det.
+
+%----------------------------------------------------------------------------%
+%----------------------------------------------------------------------------%
+
+:- implementation.
+
+:- import_module io.
+
+:- import_module bool.
+:- import_module int.
+:- import_module list.
+:- import_module string.
+
+%----------------------------------------------------------------------------%
+
+    %
+    % For the moment we just write the event out.
+    % Later this will be extended.
+    %
+handle_event(Event) :-
+    promise_impure (
+    trace [io(!IO)] (
+        io.write(Event, !IO),
+        io.nl(!IO)
+    )
+    ).
+
+%----------------------------------------------------------------------------%
+%----------------------------------------------------------------------------%
only in patch2:
unchanged:
--- tools/bootcheck	27 Sep 2007 07:03:41 -0000	1.199
+++ tools/bootcheck	3 Oct 2007 11:39:51 -0000
@@ -85,7 +85,7 @@
         check to have left a working stage 2 directory.
     --no-check-namespace
         Don't build the check_namespace targets in the runtime,
-        trace, browser, mdbcomp and library directories.
+        trace, browser, ssdb, mdbcomp and library directories.
     -t-, --no-test-suite
         By default, bootcheck will also run the test quite.
         This option prevents that.
@@ -236,6 +236,7 @@
 STD_LIB_NAME=mer_std
 TRACE_LIB_NAME=mer_trace
 BROWSER_LIB_NAME=mer_browser
+SSDB_LIB_NAME=mer_ssdb
 MDBCOMP_LIB_NAME=mer_mdbcomp
 ANALYSIS_LIB_NAME=mer_analysis
 
@@ -686,6 +687,15 @@
         $LN_S $root/browser/$BROWSER_LIB_NAME.init .
         $LN_S $root/browser/RESERVED_MACRO_NAMES .
         cd $root/$stage2dir
+        mkdir ssdb
+        cd ssdb
+        $LN_S $root/ssdb/*.m .
+        cp $root/ssdb/Mmake* $root/ssdb/Mercury.options .
+        cp $root/ssdb/*_FLAGS.in .
+        cp $root/ssdb/.mgnu* .
+        $LN_S $root/ssdb/$SSDB_LIB_NAME.init .
+        $LN_S $root/ssdb/RESERVED_MACRO_NAMES .
+        cd $root/$stage2dir
         mkdir analysis
         cd analysis
         $LN_S $root/analysis/*.m .
@@ -831,6 +841,11 @@
             /bin/rm -f browser/Mmake.browser.params
             cp $root/Mmake.stage.browser.params browser/Mmake.browser.params
         fi
+        if test -f $root/Mmake.stage.ssdb.params
+        then
+            /bin/rm -f ssdb/Mmake.ssdb.params
+            cp $root/Mmake.stage.ssdb.params ssdb/Mmake.ssdb.params
+        fi
         if test -f $root/Mmake.stage.deep.params
         then
             /bin/rm -f deep_profiler/Mmake.deep.params
@@ -904,7 +919,7 @@
 
         if (cd $stage2dir && \
             $MMAKE $mmake_opts dep_library dep_mdbcomp \
-            dep_browser dep_analysis dep_compiler \
+            dep_browser dep_ssdb dep_analysis dep_compiler \
             dep_profiler dep_deep_profiler)
         then
             echo "building of stage 2 dependencies successful"
@@ -940,6 +955,15 @@
             exit 1
         fi
 
+        if (cd $stage2dir/ssdb && \
+            $MMAKE $mmake_opts $jfactor library)
+        then
+            echo "building of stage 2 ssdb successful"
+        else
+            echo "building of stage 2 ssdb not successful"
+            exit 1
+        fi
+
         if (cd $stage2dir/trace && \
             $MMAKE $mmake_opts $jfactor trace)
         then
@@ -1046,6 +1070,11 @@
             echo '** mmake check_namespace failed in browser!'
             check_namespace_status=1
         }
+        cd $root/$stage2dir/ssdb
+        mmake $mmake_opts check_namespace || {
+            echo '** mmake check_namespace failed in ssdb!'
+            check_namespace_status=1
+        }
         cd $root
     fi
 
@@ -1061,7 +1090,7 @@
     then
         true
     else
-        libdirs="library mdbcomp browser"
+        libdirs="library mdbcomp browser ssdb"
         if $copy_slice
         then
             slicedirs="slice"
@@ -1088,7 +1117,7 @@
             /bin/rm -f *.o *.pic_o
         done
 
-        for cleandir in runtime trace library mdbcomp browser
+        for cleandir in runtime trace library mdbcomp browser ssdb
         do
             cd $root/$stage2dir/$cleandir
             mmake clean_check
@@ -1164,6 +1193,14 @@
     cp $root/browser/.mgnu* .
     $LN_S $root/browser/$BROWSER_LIB_NAME.init .
     cd $root/$stage3dir
+    mkdir ssdb
+    cd ssdb
+    $LN_S $root/ssdb/*.m .
+    cp $root/ssdb/Mmake* $root/ssdb/Mercury.options .
+    cp $root/ssdb/*_FLAGS.in .
+    cp $root/ssdb/.mgnu* .
+    $LN_S $root/ssdb/$SSDB_LIB_NAME.init .
+    cd $root/$stage3dir
     mkdir analysis
     cd analysis
     $LN_S $root/analysis/*.m .
@@ -1222,7 +1259,7 @@
     fi
 
     if (cd $stage3dir && $MMAKE $mmake_opts dep_library dep_mdbcomp \
-        dep_browser_all dep_analysis dep_compiler)
+        dep_browser_all dep_ssdb dep_analysis dep_compiler)
     then
         echo "building of stage 3 dependencies successful"
     else
@@ -1302,6 +1339,25 @@
         fi
     fi
 
+    if (cd $stage3dir/ssdb &&
+        $MMAKE $mmake_opts $jfactor all-ints &&
+        $MMAKE $mmake_opts $jfactor ${target_ext}s)
+    then
+        echo "building of stage 3 ssdb successful"
+    else
+        echo "building of stage 3 ssdb initially not successful"
+        df .
+        # try again, in case the failure cause was transient
+        if (cd $stage3dir/ssdb && \
+            $MMAKE $mmake_opts $jfactor ${target_ext}s)
+        then
+            echo "building of stage 3 ssdb successful"
+        else
+            echo "building of stage 3 ssdb not successful"
+            exit 1
+        fi
+    fi
+
     if (cd $stage3dir/analysis &&
         $MMAKE $mmake_opts $jfactor all-ints &&
         $MMAKE $mmake_opts $jfactor ${target_ext}s)
@@ -1355,7 +1411,7 @@
         exec > "$outfile"   # redirect stdout to $outfile
     fi
 
-    for dir in library mdbcomp browser analysis compiler; do
+    for dir in library mdbcomp browser ssdb analysis compiler; do
         # `mmake cs' in the compiler directory doesn't build
         # `top_level_init.c', so we only compare the `.c'
         # files present in the stage 3 directory.
@@ -1415,6 +1471,7 @@
                     gzip $root/$stage2dir/library/*.c
                     gzip $root/$stage2dir/mdbcomp/*.c
                     gzip $root/$stage2dir/browser/*.c
+                    gzip $root/$stage2dir/ssdb/*.c
                     gzip $root/$stage2dir/compiler/*.c
                     ;;
             esac
--------------------------------------------------------------------------
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