public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-dwz-multifile: replace cc-with-{dwz,index} with cc-with-tweaks this allows running with the index or dwz or both
@ 2012-06-01 20:06 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2012-06-01 20:06 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-dwz-multifile has been updated
       via  4aaf94e66616d14f4cf94060f943f94a67e3a023 (commit)
      from  672cdd999e229e46a31520e9897af0303314cc1d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 4aaf94e66616d14f4cf94060f943f94a67e3a023
Author: Tom Tromey <tromey@redhat.com>
Date:   Fri Jun 1 13:58:42 2012 -0600

    replace cc-with-{dwz,index} with cc-with-tweaks
    this allows running with the index or dwz or both

-----------------------------------------------------------------------

Summary of changes:
 gdb/cc-with-dwz.sh                          |   81 ---------------------------
 gdb/{cc-with-index.sh => cc-with-tweaks.sh} |   75 +++++++++++++++++++------
 2 files changed, 58 insertions(+), 98 deletions(-)
 delete mode 100755 gdb/cc-with-dwz.sh
 rename gdb/{cc-with-index.sh => cc-with-tweaks.sh} (60%)
 mode change 100644 => 100755

First 500 lines of diff:
diff --git a/gdb/cc-with-dwz.sh b/gdb/cc-with-dwz.sh
deleted file mode 100755
index f72eaef..0000000
--- a/gdb/cc-with-dwz.sh
+++ /dev/null
@@ -1,81 +0,0 @@
-#! /bin/sh
-# Wrapper around gcc to run 'dwz' when running the testsuite.
-
-# Copyright (C) 2010-2012 Free Software Foundation, Inc.
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# This program requires dwz in addition to gcc.
-#
-# Example usage:
-#
-# bash$ cd $objdir/gdb/testsuite
-# bash$ runtest \
-#   CC_FOR_TARGET="/bin/sh $srcdir/cc-with-dwz.sh gcc" \
-#   CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-dwz.sh g++"
-#
-
-myname=cc-with-dwz.sh
-
-DWZ=${DWZ:-dwz}
-
-have_link=unknown
-next_is_output_file=no
-output_file=a.out
-
-for arg in "$@"
-do
-    if [ "$next_is_output_file" = "yes" ]
-    then
-	output_file="$arg"
-	next_is_output_file=no
-	continue
-    fi
-
-    # Poor man's gcc argument parser.
-    # We don't need to handle all arguments, we just need to know if we're
-    # doing a link and what the output file is.
-    # It's not perfect, but it seems to work well enough for the task at hand.
-    case "$arg" in
-    "-c") have_link=no ;;
-    "-E") have_link=no ;;
-    "-S") have_link=no ;;
-    "-o") next_is_output_file=yes ;;
-    esac
-done
-
-if [ "$next_is_output_file" = "yes" ]
-then
-    echo "$myname: Unable to find output file" >&2
-    exit 1
-fi
-
-if [ "$have_link" = "no" ]
-then
-    "$@"
-    exit $?
-fi
-
-"$@"
-rc=$?
-[ $rc != 0 ] && exit $rc
-if [ ! -f "$output_file" ]
-then
-    echo "$myname: Internal error: $output_file missing." >&2
-    exit 1
-fi
-
-cp $output_file ${output_file}.23
-$DWZ -m $(pwd)/${output_file}.dwz "$output_file" ${output_file}.23 > /dev/null 2>&1
-
-exit 0
diff --git a/gdb/cc-with-index.sh b/gdb/cc-with-tweaks.sh
old mode 100644
new mode 100755
similarity index 60%
rename from gdb/cc-with-index.sh
rename to gdb/cc-with-tweaks.sh
index 22eefaa..bd23c7d
--- a/gdb/cc-with-index.sh
+++ b/gdb/cc-with-tweaks.sh
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Wrapper around gcc to add the .gdb_index section when running the testsuite.
+# Wrapper around gcc to tweak the output in various ways when running
+# the testsuite.
 
 # Copyright (C) 2010-2012 Free Software Foundation, Inc.
 # This program is free software; you can redistribute it and/or modify
@@ -25,12 +26,22 @@
 #
 # bash$ cd $objdir/gdb/testsuite
 # bash$ runtest \
-#   CC_FOR_TARGET="/bin/sh $srcdir/cc-with-index.sh gcc" \
-#   CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-index.sh g++"
+#   CC_FOR_TARGET="/bin/sh $srcdir/cc-with-tweaks.sh ARGS gcc" \
+#   CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-tweaks.sh ARGS g++"
 #
 # For documentation on index files: info -f gdb.info -n "Index Files"
+# For information about 'dwz', see the announcement:
+#     http://gcc.gnu.org/ml/gcc/2012-04/msg00686.html
+# (More documentation is to come.)
 
-myname=cc-with-index.sh
+# ARGS determine what is done.  They can be:
+# -z compress using dwz
+# -m compress using dwz -m
+# -i make an index
+# If nothing is given, -i is assumed.
+# For now, -i and -m are incompatible; if both are given, -m is ignored.
+
+myname=cc-with-tweaks.sh
 
 if [ -z "$GDB" ]
 then
@@ -51,10 +62,30 @@ fi
 
 OBJCOPY=${OBJCOPY:-objcopy}
 
+DWZ=${DWZ:-dwz}
+
 have_link=unknown
 next_is_output_file=no
 output_file=a.out
 
+want_index=false
+want_dwz=false
+want_multi=false
+
+while test $# -gt 0; do
+    case "$1" in
+	-z) want_dwz=true ;;
+	-i) want_index=true ;;
+	-m) want_multi=true ;;
+	*) break ;;
+    esac
+    shift
+done
+
+if test "$want_index" = false && test "$want_dwz" = false && test "$want_multi" = false; then
+    want_index=true
+fi
+
 for arg in "$@"
 do
     if [ "$next_is_output_file" = "yes" ]
@@ -89,7 +120,7 @@ then
 fi
 
 index_file="${output_file}.gdb-index"
-if [ -f "$index_file" ]
+if [ "$want_index" = true ] && [ -f "$index_file" ]
 then
     echo "$myname: Index file $index_file exists, won't clobber." >&2
     exit 1
@@ -107,19 +138,29 @@ then
     exit 1
 fi
 
-$GDB --batch-silent -nx -ex "file $output_file" -ex "save gdb-index $output_dir"
-rc=$?
-[ $rc != 0 ] && exit $rc
-
-# GDB might not always create an index.  Cope.
-if [ -f "$index_file" ]
-then
-    $OBJCOPY --add-section .gdb_index="$index_file" \
-	--set-section-flags .gdb_index=readonly \
-	"$output_file" "$output_file"
+if test "$want_index" = true; then
+    $GDB --batch-silent -nx -ex "file $output_file" -ex "save gdb-index $output_dir"
     rc=$?
-else
-    rc=0
+    [ $rc != 0 ] && exit $rc
+
+    # GDB might not always create an index.  Cope.
+    if [ -f "$index_file" ]
+    then
+	$OBJCOPY --add-section .gdb_index="$index_file" \
+	    --set-section-flags .gdb_index=readonly \
+	    "$output_file" "$output_file"
+	rc=$?
+    else
+	rc=0
+    fi
+    [ $rc != 0 ] && exit $rc
+fi
+
+if test "$want_dwz" = true; then
+    $DWZ "$output_file" > /dev/null 2>&1
+elif test "$want_multi" = true && test "$want_index" = false; then
+    cp $output_file ${output_file}.alt
+    $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null 2>&1
 fi
 
 rm -f "$index_file"


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-01 20:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-01 20:06 [SCM] archer-tromey-dwz-multifile: replace cc-with-{dwz,index} with cc-with-tweaks this allows running with the index or dwz or both tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).