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

Side by Side Diff: build/gdb-add-index

Issue 10913264: Make gdb-add-index better respect relative paths and bind mounts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 # 5 #
6 # Saves the gdb index for a given binary and its shared library dependencies. 6 # Saves the gdb index for a given binary and its shared library dependencies.
7 7
8 set -e 8 set -e
9 9
10 if [[ ! $# == 1 ]]; then 10 if [[ ! $# == 1 ]]; then
(...skipping 10 matching lines...) Expand all
21 # We're good to go! Create temp directory for index files. 21 # We're good to go! Create temp directory for index files.
22 DIRECTORY=$(mktemp -d) 22 DIRECTORY=$(mktemp -d)
23 echo "Made temp directory $DIRECTORY." 23 echo "Made temp directory $DIRECTORY."
24 24
25 # Always remove directory on exit. 25 # Always remove directory on exit.
26 trap "{ echo -n Removing temp directory $DIRECTORY...; 26 trap "{ echo -n Removing temp directory $DIRECTORY...;
27 rm -rf $DIRECTORY; echo done; }" EXIT 27 rm -rf $DIRECTORY; echo done; }" EXIT
28 28
29 # Grab all the chromium shared library files. 29 # Grab all the chromium shared library files.
30 so_files=$(ldd "$FILENAME" 2>/dev/null \ 30 so_files=$(ldd "$FILENAME" 2>/dev/null \
31 | grep $(pwd) \ 31 | grep $(dirname "$FILENAME") \
32 | sed "s/.*[ \t]\(.*\) (.*/\1/") 32 | sed "s/.*[ \t]\(.*\) (.*/\1/")
33 33
34 # Add index to binary and the shared library dependencies. 34 # Add index to binary and the shared library dependencies.
35 for file in "$FILENAME" $so_files; do 35 for file in "$FILENAME" $so_files; do
36 basename=$(basename "$file") 36 basename=$(basename "$file")
37 echo -n "Adding index to $basename..." 37 echo -n "Adding index to $basename..."
38 readelf_out=$(readelf -S "$file") 38 readelf_out=$(readelf -S "$file")
39 if [[ $readelf_out =~ "gdb_index" ]]; then 39 if [[ $readelf_out =~ "gdb_index" ]]; then
40 echo "already contains index. Skipped." 40 echo "already contains index. Skipped."
41 else 41 else
42 gdb -batch "$file" -ex "save gdb-index $DIRECTORY" -ex "quit" 42 gdb -batch "$file" -ex "save gdb-index $DIRECTORY" -ex "quit"
43 objcopy --add-section .gdb_index="$DIRECTORY"/$basename.gdb-index \ 43 objcopy --add-section .gdb_index="$DIRECTORY"/$basename.gdb-index \
44 --set-section-flags .gdb_index=readonly "$file" "$file" 44 --set-section-flags .gdb_index=readonly "$file" "$file"
45 echo "done." 45 echo "done."
46 fi 46 fi
47 done 47 done
OLDNEW
« 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