GNU Binutils with patches for OS216
修订版 | c9a1dc08aaf6cb16b9d07fcee5420c3c73b9dd72 (tree) |
---|---|
时间 | 2003-01-09 09:45:08 |
作者 | Andrew Cagney <cagney@redh...> |
Commiter | Andrew Cagney |
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.
@@ -5,6 +5,12 @@ | ||
5 | 5 | |
6 | 6 | 2003-01-08 Andrew Cagney <ac131313@redhat.com> |
7 | 7 | |
8 | + * gdb_mbuild.sh: Add --keep option. When specified, keep the | |
9 | + build directories. Save edited gdb output in Mbuild.log. If a | |
10 | + build fails, remove any final GDB executable. | |
11 | + | |
12 | +2003-01-08 Andrew Cagney <ac131313@redhat.com> | |
13 | + | |
8 | 14 | * gdb_mbuild.sh: Edit the output of `maint print architecture' |
9 | 15 | replacing hex constants with function names and stripping leading |
10 | 16 | file name directory prefixes. |
@@ -29,6 +29,7 @@ Usage: gdb_mbuild.sh [ <options> ... ] <srcdir> <builddir> | ||
29 | 29 | -j <makejobs> Run <makejobs> in parallel. Passed to make. |
30 | 30 | On a single cpu machine, 2 is recommended. |
31 | 31 | -k Keep going. Do not stop after the first build fails. |
32 | + --keep Keep builds. Do not remove each build when finished. | |
32 | 33 | -e <regexp> Regular expression for selecting the targets to build. |
33 | 34 | -f Force rebuild. Even rebuild previously built directories. |
34 | 35 | -v Be more (and more, and more) verbose. |
@@ -53,6 +54,7 @@ keepgoing= | ||
53 | 54 | force=false |
54 | 55 | targexp="" |
55 | 56 | verbose=0 |
57 | +keep=false | |
56 | 58 | while test $# -gt 0 |
57 | 59 | do |
58 | 60 | case "$1" in |
@@ -72,6 +74,9 @@ do | ||
72 | 74 | # Should we soldier on after the first build fails? |
73 | 75 | keepgoing=-k |
74 | 76 | ;; |
77 | + --keep ) | |
78 | + keep=true | |
79 | + ;; | |
75 | 80 | -e ) |
76 | 81 | # A regular expression for selecting targets |
77 | 82 | shift |
@@ -261,8 +266,13 @@ do | ||
261 | 266 | |
262 | 267 | if test ! -x gdb/gdb -a ! -x gdb/gdb.exe |
263 | 268 | then |
269 | + # Iff the build fails remove the final build target so that | |
270 | + # the follow-on code knows things failed. Stops the follow-on | |
271 | + # code thinking that a failed rebuild succedded (executable | |
272 | + # left around from previous build). | |
264 | 273 | echo ... ${make} ${keepgoing} ${makejobs} ${target} |
265 | - ${make} ${keepgoing} ${makejobs} all-gdb 2>&1 | log 1 Build.log | |
274 | + ( ${make} ${keepgoing} ${makejobs} all-gdb || rm -f gdb/gdb gdb/gdb.exe | |
275 | + ) 2>&1 | log 1 Build.log | |
266 | 276 | fi |
267 | 277 | fail "compile failed" ! -x gdb/gdb -a ! -x gdb/gdb.exe |
268 | 278 |
@@ -284,7 +294,6 @@ EOF | ||
284 | 294 | # Create a sed script that cleans up the output from GDB. |
285 | 295 | rm -f mbuild.sed |
286 | 296 | touch mbuild.sed || exit 1 |
287 | - | |
288 | 297 | # Rules to replace <0xNNNN> with the corresponding function's |
289 | 298 | # name. |
290 | 299 | sed -n -e '/<0x0*>/d' -e 's/^.*<0x\([0-9a-f]*\)>.*$/0x\1/p' Gdb.log \ |
@@ -295,18 +304,25 @@ EOF | ||
295 | 304 | test ${verbose} -gt 0 && echo "${addr} ${func}" 1>&2 |
296 | 305 | echo "s/<${addr}>/<${func}>/g" |
297 | 306 | done >> mbuild.sed |
298 | - | |
299 | 307 | # Rules to strip the leading paths off of file names. |
300 | 308 | echo 's/"\/.*\/gdb\//"gdb\//g' >> mbuild.sed |
309 | + # Run the script | |
310 | + sed -f mbuild.sed Gdb.log > Mbuild.log | |
301 | 311 | |
302 | 312 | # Replace the build directory with a file as semaphore that stops |
303 | 313 | # a rebuild. (should the logs be saved?) |
304 | 314 | |
305 | 315 | cd ${builddir} |
306 | - rm -f ${target}.tmp | |
307 | - sed -f ${target}/mbuild.sed ${target}/Gdb.log > ${target}.tmp | |
308 | - rm -rf ${target} | |
309 | - mv ${target}.tmp ${target} | |
316 | + | |
317 | + if ${keep} | |
318 | + then | |
319 | + : | |
320 | + else | |
321 | + rm -f ${target}.tmp | |
322 | + mv ${target}/Mbuild.log ${target}.tmp | |
323 | + rm -rf ${target} | |
324 | + mv ${target}.tmp ${target} | |
325 | + fi | |
310 | 326 | |
311 | 327 | # Success! |
312 | 328 | echo ... ${target} built |