Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2645)

Unified Diff: build/gdb-add-index

Issue 330333005: Add flag to force clobbering of index in gdb-add-index (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use getopt Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/gdb-add-index
diff --git a/build/gdb-add-index b/build/gdb-add-index
index 0d66d8dac83de4fc0041432a0f514dc422c7c0fc..687e9f5d501b0206b69bb9deaaefc219fff19c4e 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698