aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-01-09 00:45:08 +0000
committerAndrew Cagney <cagney@redhat.com>2003-01-09 00:45:08 +0000
commitc9a1dc08aaf6cb16b9d07fcee5420c3c73b9dd72 (patch)
tree8c86c0dec287aec31115beb4e176593f916e87c6
parent2003-01-08 Andrew Cagney <cagney@redhat.com> (diff)
downloadbinutils-gdb-c9a1dc08aaf6cb16b9d07fcee5420c3c73b9dd72.tar.gz
binutils-gdb-c9a1dc08aaf6cb16b9d07fcee5420c3c73b9dd72.tar.bz2
binutils-gdb-c9a1dc08aaf6cb16b9d07fcee5420c3c73b9dd72.zip
2003-01-08 Andrew Cagney <ac131313@redhat.com>
* gdb_mbuild.sh: Add --keep option. When specified, keep the build directories. Save edited gdb output in Mbuild.log. If a build fails, remove any final GDB executable.
-rw-r--r--gdb/ChangeLog6
-rwxr-xr-xgdb/gdb_mbuild.sh30
2 files changed, 29 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6e4ed54f2ff..b123f4a9904 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -5,6 +5,12 @@
2003-01-08 Andrew Cagney <ac131313@redhat.com>
+ * gdb_mbuild.sh: Add --keep option. When specified, keep the
+ build directories. Save edited gdb output in Mbuild.log. If a
+ build fails, remove any final GDB executable.
+
+2003-01-08 Andrew Cagney <ac131313@redhat.com>
+
* gdb_mbuild.sh: Edit the output of `maint print architecture'
replacing hex constants with function names and stripping leading
file name directory prefixes.
diff --git a/gdb/gdb_mbuild.sh b/gdb/gdb_mbuild.sh
index 49d18cfbd26..a108de0bc41 100755
--- a/gdb/gdb_mbuild.sh
+++ b/gdb/gdb_mbuild.sh
@@ -29,6 +29,7 @@ Usage: gdb_mbuild.sh [ <options> ... ] <srcdir> <builddir>
-j <makejobs> Run <makejobs> in parallel. Passed to make.
On a single cpu machine, 2 is recommended.
-k Keep going. Do not stop after the first build fails.
+ --keep Keep builds. Do not remove each build when finished.
-e <regexp> Regular expression for selecting the targets to build.
-f Force rebuild. Even rebuild previously built directories.
-v Be more (and more, and more) verbose.
@@ -53,6 +54,7 @@ keepgoing=
force=false
targexp=""
verbose=0
+keep=false
while test $# -gt 0
do
case "$1" in
@@ -72,6 +74,9 @@ do
# Should we soldier on after the first build fails?
keepgoing=-k
;;
+ --keep )
+ keep=true
+ ;;
-e )
# A regular expression for selecting targets
shift
@@ -261,8 +266,13 @@ do
if test ! -x gdb/gdb -a ! -x gdb/gdb.exe
then
+ # Iff the build fails remove the final build target so that
+ # the follow-on code knows things failed. Stops the follow-on
+ # code thinking that a failed rebuild succedded (executable
+ # left around from previous build).
echo ... ${make} ${keepgoing} ${makejobs} ${target}
- ${make} ${keepgoing} ${makejobs} all-gdb 2>&1 | log 1 Build.log
+ ( ${make} ${keepgoing} ${makejobs} all-gdb || rm -f gdb/gdb gdb/gdb.exe
+ ) 2>&1 | log 1 Build.log
fi
fail "compile failed" ! -x gdb/gdb -a ! -x gdb/gdb.exe
@@ -284,7 +294,6 @@ EOF
# Create a sed script that cleans up the output from GDB.
rm -f mbuild.sed
touch mbuild.sed || exit 1
-
# Rules to replace <0xNNNN> with the corresponding function's
# name.
sed -n -e '/<0x0*>/d' -e 's/^.*<0x\([0-9a-f]*\)>.*$/0x\1/p' Gdb.log \
@@ -295,18 +304,25 @@ EOF
test ${verbose} -gt 0 && echo "${addr} ${func}" 1>&2
echo "s/<${addr}>/<${func}>/g"
done >> mbuild.sed
-
# Rules to strip the leading paths off of file names.
echo 's/"\/.*\/gdb\//"gdb\//g' >> mbuild.sed
+ # Run the script
+ sed -f mbuild.sed Gdb.log > Mbuild.log
# Replace the build directory with a file as semaphore that stops
# a rebuild. (should the logs be saved?)
cd ${builddir}
- rm -f ${target}.tmp
- sed -f ${target}/mbuild.sed ${target}/Gdb.log > ${target}.tmp
- rm -rf ${target}
- mv ${target}.tmp ${target}
+
+ if ${keep}
+ then
+ :
+ else
+ rm -f ${target}.tmp
+ mv ${target}/Mbuild.log ${target}.tmp
+ rm -rf ${target}
+ mv ${target}.tmp ${target}
+ fi
# Success!
echo ... ${target} built