| OLD | NEW |
| 1 #! /bin/sh | 1 #! /bin/sh |
| 2 # Wrapper around gcc to add the .gdb_index section when running the testsuite. | 2 # Wrapper around gcc to add the .gdb_index section when running the testsuite. |
| 3 | 3 |
| 4 # Copyright (C) 2010-2012 Free Software Foundation, Inc. | 4 # Copyright (C) 2010-2012 Free Software Foundation, Inc. |
| 5 # This program is free software; you can redistribute it and/or modify | 5 # This program is free software; you can redistribute it and/or modify |
| 6 # it under the terms of the GNU General Public License as published by | 6 # it under the terms of the GNU General Public License as published by |
| 7 # the Free Software Foundation; either version 3 of the License, or | 7 # the Free Software Foundation; either version 3 of the License, or |
| 8 # (at your option) any later version. | 8 # (at your option) any later version. |
| 9 # | 9 # |
| 10 # This program is distributed in the hope that it will be useful, | 10 # This program is distributed in the hope that it will be useful, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 "$@" | 101 "$@" |
| 102 rc=$? | 102 rc=$? |
| 103 [ $rc != 0 ] && exit $rc | 103 [ $rc != 0 ] && exit $rc |
| 104 if [ ! -f "$output_file" ] | 104 if [ ! -f "$output_file" ] |
| 105 then | 105 then |
| 106 echo "$myname: Internal error: $output_file missing." >&2 | 106 echo "$myname: Internal error: $output_file missing." >&2 |
| 107 exit 1 | 107 exit 1 |
| 108 fi | 108 fi |
| 109 | 109 |
| 110 $GDB --batch-silent -nx -ex "file $output_file" -ex "save gdb-index $output_dir" | 110 $GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save
gdb-index $output_dir" |
| 111 rc=$? | 111 rc=$? |
| 112 [ $rc != 0 ] && exit $rc | 112 [ $rc != 0 ] && exit $rc |
| 113 | 113 |
| 114 # GDB might not always create an index. Cope. | 114 # GDB might not always create an index. Cope. |
| 115 if [ -f "$index_file" ] | 115 if [ -f "$index_file" ] |
| 116 then | 116 then |
| 117 $OBJCOPY --add-section .gdb_index="$index_file" \ | 117 $OBJCOPY --add-section .gdb_index="$index_file" \ |
| 118 --set-section-flags .gdb_index=readonly \ | 118 --set-section-flags .gdb_index=readonly \ |
| 119 "$output_file" "$output_file" | 119 "$output_file" "$output_file" |
| 120 rc=$? | 120 rc=$? |
| 121 else | 121 else |
| 122 rc=0 | 122 rc=0 |
| 123 fi | 123 fi |
| 124 | 124 |
| 125 rm -f "$index_file" | 125 rm -f "$index_file" |
| 126 exit $rc | 126 exit $rc |
| OLD | NEW |