summaryrefslogtreecommitdiffstats
path: root/build/gdb-add-index
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-14 08:50:22 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-14 08:50:22 +0000
commit6192e6584307a7c43628bae6e4e8b41ab1487b91 (patch)
treefad5f3cdfdbd077b0cc887229712be48d8b491f3 /build/gdb-add-index
parent0aff0d8a472703e2e90d09336e5e188dd5a3ad5b (diff)
downloadchromium_src-6192e6584307a7c43628bae6e4e8b41ab1487b91.zip
chromium_src-6192e6584307a7c43628bae6e4e8b41ab1487b91.tar.gz
chromium_src-6192e6584307a7c43628bae6e4e8b41ab1487b91.tar.bz2
Add flag to force clobbering of index in gdb-add-index
BUG=374952 Review URL: https://codereview.chromium.org/330333005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/gdb-add-index')
-rwxr-xr-xbuild/gdb-add-index36
1 files changed, 33 insertions, 3 deletions
diff --git a/build/gdb-add-index b/build/gdb-add-index
index 0d66d8d..687e9f5 100755
--- a/build/gdb-add-index
+++ b/build/gdb-add-index
@@ -36,11 +36,20 @@ function on_exit {
function index_one_file {
local file=$1
local basename=$(basename "$file")
+ local should_index="${SHOULD_INDEX}"
local readelf_out=$(readelf -S "$file")
if [[ $readelf_out =~ "gdb_index" ]]; then
- echo "Skipped $basename -- already contains index."
- else
+ if [ "${REMOVE_INDEX}" = 1 ]; then
+ objcopy --remove-section .gdb_index "$file"
+ echo "Removed index from $basename."
+ else
+ echo "Skipped $basename -- already contains index."
+ should_index=0
+ fi
+ fi
+
+ if [ "${should_index}" = 1 ]; then
local start=$(date +"%s%N")
echo "Adding index to $basename..."
@@ -83,8 +92,29 @@ function index_next {
########
### Main body of the script.
+REMOVE_INDEX=0
+SHOULD_INDEX=1
+while getopts ":f:r" opt; do
+ case $opt in
+ f)
+ REMOVE_INDEX=1
+ shift
+ ;;
+ r)
+ REMOVE_INDEX=1
+ SHOULD_INDEX=0
+ shift
+ ;;
+ *)
+ echo "Invalid option: -$OPTARG" >&2
+ ;;
+ esac
+done
+
if [[ ! $# == 1 ]]; then
- echo "Usage: $0 path-to-binary"
+ echo "Usage: $0 [-f] [-r] path-to-binary"
+ echo " -f forces replacement of an existing index."
+ echo " -r removes the index section."
exit 1
fi