aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-05-10 20:07:02 +0000
committerTom Tromey <tromey@redhat.com>2012-05-10 20:07:02 +0000
commite871fbb936d39edd8558e25169114820f1042ef1 (patch)
treeccb60bf98c92899149447c065189f1a42d755cdc
parentb5b04b5b7ad009488a07a945e28001edaf5809b5 (diff)
downloadgdb-e871fbb936d39edd8558e25169114820f1042ef1.zip
gdb-e871fbb936d39edd8558e25169114820f1042ef1.tar.gz
gdb-e871fbb936d39edd8558e25169114820f1042ef1.tar.bz2
* cc-with-dwz.sh: New file.
-rw-r--r--gdb/ChangeLog4
-rwxr-xr-xgdb/cc-with-dwz.sh80
2 files changed, 84 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d3ec55a..31cf97b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2012-05-10 Tom Tromey <tromey@redhat.com>
+ * cc-with-dwz.sh: New file.
+
+2012-05-10 Tom Tromey <tromey@redhat.com>
+
* symtab.h (struct symtab) <includes, user>: New fields.
* block.h (struct block_iterator) <d, idx, which>: New fields.
* block.c (initialize_block_iterator, find_iterator_symtab)
diff --git a/gdb/cc-with-dwz.sh b/gdb/cc-with-dwz.sh
new file mode 100755
index 0000000..f66deb1
--- /dev/null
+++ b/gdb/cc-with-dwz.sh
@@ -0,0 +1,80 @@
+#! /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
+
+$DWZ "$output_file" > /dev/null 2>&1
+
+exit 0