OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS 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 # Script to upload all debug symbols required for crash reporting | 6 # Script to upload all debug symbols required for crash reporting |
7 # purposes. This script need only be used to upload release builds | 7 # purposes. This script need only be used to upload release builds |
8 # symbols or to debug crashes on non-release builds (in which case try | 8 # symbols or to debug crashes on non-release builds (in which case try |
9 # to only upload the symbols for those executables involved). | 9 # to only upload the symbols for those executables involved). |
10 # | 10 # |
11 # NOTE: This script must be run from the chromeos build chroot environment. | 11 # NOTE: This script must be run from the chromeos build chroot environment. |
12 # | 12 # |
13 | 13 |
14 # Load common constants. This should be the first executable line. | 14 # Load common constants. This should be the first executable line. |
15 # The path to common.sh should be relative to your script's location. | 15 # The path to common.sh should be relative to your script's location. |
16 . "$(dirname "$0")/common.sh" | 16 . "$(dirname "$0")/common.sh" |
17 | 17 |
18 # Script must be run inside the chroot | 18 # Script must be run inside the chroot |
19 restart_in_chroot_if_needed $* | 19 restart_in_chroot_if_needed $* |
20 | 20 |
21 get_default_board | 21 get_default_board |
22 | 22 |
23 # Flags | 23 # Flags |
24 DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for." | 24 DEFINE_string board "$DEFAULT_BOARD" "The board to build packages for." |
25 DEFINE_boolean official_build $FLAGS_FALSE "Point to official symbol server." | 25 DEFINE_string breakpad_root "" "Root directory for breakpad symbols." |
26 DEFINE_boolean regenerate $FLAGS_TRUE "Regenerate all symbols." | 26 DEFINE_boolean official_build ${FLAGS_FALSE} "Point to official symbol server." |
27 DEFINE_boolean regenerate ${FLAGS_FALSE} "Regenerate all symbols." | |
27 DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." | 28 DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." |
28 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts." | 29 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts." |
29 | 30 |
30 SYM_UPLOAD="sym_upload" | 31 SYM_UPLOAD="sym_upload" |
31 | 32 |
32 ANY_ERRORS=0 | 33 ANY_ERRORS=0 |
33 | 34 |
34 ERR_FILE=$(mktemp "/tmp/err.XXXX") | 35 ERR_FILE=$(mktemp "/tmp/err.XXXX") |
35 | 36 |
36 function cleanup() { | 37 function cleanup() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 | 93 |
93 local upload_url="" | 94 local upload_url="" |
94 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]; then | 95 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]; then |
95 upload_url="http://clients2.google.com/cr/symbol" | 96 upload_url="http://clients2.google.com/cr/symbol" |
96 else | 97 else |
97 upload_url="http://clients2.google.com/cr/staging_symbol" | 98 upload_url="http://clients2.google.com/cr/staging_symbol" |
98 warn "This is an unofficial build, uploading to staging server." | 99 warn "This is an unofficial build, uploading to staging server." |
99 fi | 100 fi |
100 info "Uploading symbols to ${upload_url} from ${SYSROOT}." | 101 info "Uploading symbols to ${upload_url} from ${SYSROOT}." |
101 | 102 |
102 MINIDUMP_SYMBOLS_ROOT="${SYSROOT}/usr/lib/debug/breakpad" | 103 DEFAULT_BREAKPAD_ROOT="${SYSROOT}/usr/lib/debug/breakpad" |
104 if [ -z "${FLAGS_breakpad_root}" ]; then | |
105 FLAGS_breakpad_root="${DEFAULT_BREAKPAD_ROOT}" | |
106 else | |
107 if [ ${FLAGS_regenerate} -eq ${FLAGS_TRUE} ]; then | |
108 warn "Assuming --noregenerate when --breakpad_root is specified" | |
109 FLAGS_regenerate=${FLAGS_FALSE} | |
110 fi | |
111 fi | |
103 | 112 |
104 if [ -z "${FLAGS_ARGV}" ]; then | 113 if [ -z "${FLAGS_ARGV}" ]; then |
105 really_upload || exit 1 | |
106 if [ ${FLAGS_regenerate} -eq ${FLAGS_TRUE} ]; then | 114 if [ ${FLAGS_regenerate} -eq ${FLAGS_TRUE} ]; then |
107 sudo rm -rf "${MINIDUMP_SYMBOLS_ROOT}" | 115 really_upload || exit 1 |
petkov
2010/08/24 22:58:18
So you're asking the question only if regenerating
| |
108 info "Generating all minidump symbol files." | 116 info "Clearing ${DEFAULT_BREAKPAD_ROOT}" |
117 sudo rm -rf "${DEFAULT_BREAKPAD_ROOT}" | |
118 info "Generating all breakpad symbol files." | |
109 local verbosity="" | 119 local verbosity="" |
110 local generate_script="$(dirname $0)/cros_generate_breakpad_symbols" | 120 local generate_script="$(dirname $0)/cros_generate_breakpad_symbols" |
111 [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ] && verbosity="--verbose" | 121 [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ] && verbosity="--verbose" |
112 if ! "${generate_script}" --board=${FLAGS_board} ${verbosity}; then | 122 if ! "${generate_script}" --board=${FLAGS_board} ${verbosity}; then |
113 error "Some errors while generating symbols; uploading anyway" | 123 error "Some errors while generating symbols; uploading anyway" |
114 ANY_ERRORS=1 | 124 ANY_ERRORS=1 |
115 fi | 125 fi |
116 fi | 126 fi |
117 | 127 |
118 info "Uploading all minidump symbol files." | 128 info "Uploading all breakpad symbol files." |
119 for sym_file in $(find "${MINIDUMP_SYMBOLS_ROOT}" -name \*.sym); do | 129 for sym_file in $(find "${FLAGS_breakpad_root}" -name \*.sym); do |
120 ! upload_file "${sym_file}" "${upload_url}" | 130 ! upload_file "${sym_file}" "${upload_url}" |
121 done | 131 done |
122 else | 132 else |
123 error "Unexpected args ${FLAGS_ARGV}" | 133 error "Unexpected args ${FLAGS_ARGV}" |
124 fi | 134 fi |
125 | 135 |
126 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" | 136 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" |
127 return 0 | 137 return 0 |
128 } | 138 } |
129 | 139 |
130 main "$@" | 140 main "$@" |
OLD | NEW |