diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /media/webrtc/trunk/build/gdb-add-index | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'media/webrtc/trunk/build/gdb-add-index')
-rwxr-xr-x | media/webrtc/trunk/build/gdb-add-index | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/media/webrtc/trunk/build/gdb-add-index b/media/webrtc/trunk/build/gdb-add-index new file mode 100755 index 000000000..497553221 --- /dev/null +++ b/media/webrtc/trunk/build/gdb-add-index @@ -0,0 +1,47 @@ +#!/bin/bash +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Saves the gdb index for a given binary and its shared library dependencies. + +set -e + +if [[ ! $# == 1 ]]; then + echo "Usage: $0 path-to-binary" + exit 1 +fi + +FILENAME="$1" +if [[ ! -f "$FILENAME" ]]; then + echo "Path $FILENAME does not exist." + exit 1 +fi + +# We're good to go! Create temp directory for index files. +DIRECTORY=$(mktemp -d) +echo "Made temp directory $DIRECTORY." + +# Always remove directory on exit. +trap "{ echo -n Removing temp directory $DIRECTORY...; + rm -rf $DIRECTORY; echo done; }" EXIT + +# Grab all the chromium shared library files. +so_files=$(ldd "$FILENAME" 2>/dev/null \ + | grep $(dirname "$FILENAME") \ + | sed "s/.*[ \t]\(.*\) (.*/\1/") + +# Add index to binary and the shared library dependencies. +for file in "$FILENAME" $so_files; do + basename=$(basename "$file") + echo -n "Adding index to $basename..." + readelf_out=$(readelf -S "$file") + if [[ $readelf_out =~ "gdb_index" ]]; then + echo "already contains index. Skipped." + else + gdb -batch "$file" -ex "save gdb-index $DIRECTORY" -ex "quit" + objcopy --add-section .gdb_index="$DIRECTORY"/$basename.gdb-index \ + --set-section-flags .gdb_index=readonly "$file" "$file" + echo "done." + fi +done |