From: Tom Tromey Date: Wed, 18 Jul 2012 20:04:44 +0000 (+0000) Subject: * cc-with-index.sh, cc-with-dwz.sh: Remove. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=853254db4122cf8838ced13a1b950afc62043538;p=binutils-gdb.git * cc-with-index.sh, cc-with-dwz.sh: Remove. * contrib/cc-with-tweaks.sh: New file. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b593f202274..a0f421e6640 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-07-18 Tom Tromey + + * cc-with-index.sh, cc-with-dwz.sh: Remove. + * contrib/cc-with-tweaks.sh: New file. + 2012-07-18 Tom Tromey * dwarf2read.c (struct dwz_file) : New field. diff --git a/gdb/cc-with-dwz.sh b/gdb/cc-with-dwz.sh deleted file mode 100755 index f66deb1d9d4..00000000000 --- a/gdb/cc-with-dwz.sh +++ /dev/null @@ -1,80 +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 . - -# 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 diff --git a/gdb/cc-with-index.sh b/gdb/cc-with-index.sh deleted file mode 100644 index 644ba346f34..00000000000 --- a/gdb/cc-with-index.sh +++ /dev/null @@ -1,126 +0,0 @@ -#! /bin/sh -# Wrapper around gcc to add the .gdb_index section 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 . - -# This program requires gdb and objcopy in addition to gcc. -# The default values are gdb from the build tree and objcopy from $PATH. -# They may be overridden by setting environment variables GDB and OBJCOPY -# respectively. -# We assume the current directory is either $obj/gdb or $obj/gdb/testsuite. -# -# Example usage: -# -# 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++" -# -# For documentation on index files: info -f gdb.info -n "Index Files" - -myname=cc-with-index.sh - -if [ -z "$GDB" ] -then - if [ -f ./gdb ] - then - GDB="./gdb" - elif [ -f ../gdb ] - then - GDB="../gdb" - elif [ -f ../../gdb ] - then - GDB="../../gdb" - else - echo "$myname: unable to find usable gdb" >&2 - exit 1 - fi -fi - -OBJCOPY=${OBJCOPY:-objcopy} - -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 - -index_file="${output_file}.gdb-index" -if [ -f "$index_file" ] -then - echo "$myname: Index file $index_file exists, won't clobber." >&2 - exit 1 -fi - -output_dir="${output_file%/*}" -[ "$output_dir" = "$output_file" ] && output_dir="." - -"$@" -rc=$? -[ $rc != 0 ] && exit $rc -if [ ! -f "$output_file" ] -then - echo "$myname: Internal error: $output_file missing." >&2 - exit 1 -fi - -$GDB --batch-silent -nx -ex "set auto-load no" -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" - rc=$? -else - rc=0 -fi - -rm -f "$index_file" -exit $rc diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh new file mode 100755 index 00000000000..9270db418ed --- /dev/null +++ b/gdb/contrib/cc-with-tweaks.sh @@ -0,0 +1,162 @@ +#! /bin/sh +# 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 +# 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 . + +# This program requires gdb and objcopy in addition to gcc. +# The default values are gdb from the build tree and objcopy from $PATH. +# They may be overridden by setting environment variables GDB and OBJCOPY +# respectively. +# We assume the current directory is either $obj/gdb or $obj/gdb/testsuite. +# +# Example usage: +# +# bash$ cd $objdir/gdb/testsuite +# bash$ runtest \ +# 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.) + +# 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, no changes are made + +myname=cc-with-tweaks.sh + +if [ -z "$GDB" ] +then + if [ -f ./gdb ] + then + GDB="./gdb" + elif [ -f ../gdb ] + then + GDB="../gdb" + elif [ -f ../../gdb ] + then + GDB="../../gdb" + else + echo "$myname: unable to find usable gdb" >&2 + exit 1 + fi +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 [ $# -gt 0 ]; do + case "$1" in + -z) want_dwz=true ;; + -i) want_index=true ;; + -m) want_multi=true ;; + *) break ;; + esac + shift +done + +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 + +index_file="${output_file}.gdb-index" +if [ "$want_index" = true ] && [ -f "$index_file" ] +then + echo "$myname: Index file $index_file exists, won't clobber." >&2 + exit 1 +fi + +output_dir="${output_file%/*}" +[ "$output_dir" = "$output_file" ] && output_dir="." + +"$@" +rc=$? +[ $rc != 0 ] && exit $rc +if [ ! -f "$output_file" ] +then + echo "$myname: Internal error: $output_file missing." >&2 + exit 1 +fi + +if [ "$want_index" = true ]; then + $GDB --batch-silent -nx -ex "set auto-load no" -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" + rc=$? + else + rc=0 + fi + [ $rc != 0 ] && exit $rc +fi + +if [ "$want_dwz" = true ]; then + $DWZ "$output_file" > /dev/null 2>&1 +elif [ "$want_multi" = true ]; 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" +exit $rc