OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/sh | |
Mark Mentovai
2009/06/12 17:30:10
svn:executable and svn:eol-style?
| |
2 | |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 # | |
7 # Helper script to run dump_syms on Chrome Linux executables and "fixup" the | |
8 # generated sigs (due to changes to the binary from stripping). | |
9 | |
10 set -e | |
11 | |
12 usage() { | |
13 echo "$0 <dump_syms_exe> <binary_with_symbols> <symbols_output>" | |
14 } | |
15 | |
16 | |
17 if [ $# -ne 3 ]; then | |
18 usage | |
19 exit 1 | |
20 fi | |
21 | |
22 SCRIPTDIR="$(readlink -f "$(dirname "$0")")" | |
23 DUMPSYMS="$1" | |
24 INFILE="$2" | |
25 OUTFILE="$3" | |
26 | |
27 STRIPPED=$(mktemp -q -t stripped-XXXXX) | |
28 if [ $? -ne 0 ]; then | |
29 echo "ERROR: Could not create temp stripped '$INFILE'" | |
Mark Mentovai
2009/06/12 17:30:10
echo blah >& 2 (also for usage()?)
| |
30 exit 1 | |
31 fi | |
32 | |
33 # Dump the symbols from the given binary. | |
34 "$DUMPSYMS" "$INFILE" > "$OUTFILE" | |
Mark Mentovai
2009/06/12 17:30:10
In the Mac version of this script, we have an -nt
| |
35 | |
36 # Strip the binary and calculate the signature of that, since that's what ships. | |
37 strip "$INFILE" -o "$STRIPPED" | |
38 NEWSIG=$("$SCRIPTDIR/dump_signature.py" "$STRIPPED") | |
39 rm "$STRIPPED" | |
40 | |
41 # Replace the old signature with the stripped signature in the symbols file. | |
42 INFILE_BASE=$(basename "$INFILE") | |
43 sed -i "1s/[0-9A-F]* $INFILE_BASE/$NEWSIG $INFILE_BASE/" "$OUTFILE" | |
Mark Mentovai
2009/06/12 17:30:10
This is slightly dangerous in the general case bec
| |
44 | |
Mark Mentovai
2009/06/12 17:30:10
nit: blank line at EOF doesn't contribute anything
| |
OLD | NEW |