| 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 dryrun ${FLAGS_FALSE} "Run without actually uploading." | 25 DEFINE_boolean dryrun ${FLAGS_FALSE} "Run without actually uploading." |
| 26 DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." | 26 DEFINE_boolean verbose ${FLAGS_FALSE} "Be verbose." |
| 27 DEFINE_boolean official_build $FLAGS_FALSE "Point to official symbol server." |
| 27 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts." | 28 DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts." |
| 28 | 29 |
| 29 DUMP_SYMS="dump_syms.i386" | 30 DUMP_SYMS="dump_syms.i386" |
| 30 SYM_UPLOAD="sym_upload.i386" | 31 SYM_UPLOAD="sym_upload.i386" |
| 31 | 32 |
| 32 CUMULATIVE_SIZE=0 | 33 CUMULATIVE_SIZE=0 |
| 33 ANY_ERRORS=0 | 34 ANY_ERRORS=0 |
| 34 | 35 |
| 35 SYM_FILE=$(mktemp "/tmp/sym.XXXX") | 36 SYM_FILE=$(mktemp "/tmp/sym.XXXX") |
| 36 ERR_FILE=$(mktemp "/tmp/err.XXXX") | 37 ERR_FILE=$(mktemp "/tmp/err.XXXX") |
| 37 | 38 |
| 38 function cleanup() { | 39 function cleanup() { |
| 39 rm -f "${SYM_FILE}" "${ERR_FILE}" | 40 rm -f "${SYM_FILE}" "${ERR_FILE}" |
| 40 } | 41 } |
| 41 | 42 |
| 42 function is_official() { | |
| 43 if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then | |
| 44 return 0 | |
| 45 else | |
| 46 return 1 | |
| 47 fi | |
| 48 } | |
| 49 | |
| 50 # Given path to a debug file, return its text file | 43 # Given path to a debug file, return its text file |
| 51 function get_text_for_debug { | 44 function get_text_for_debug { |
| 52 local debug_file=$1 | 45 local debug_file=$1 |
| 53 local text_dir=$(dirname ${debug_file#$DEBUG_ROOT}) | 46 local text_dir=$(dirname ${debug_file#$DEBUG_ROOT}) |
| 54 local text_path=${SYSROOT}${text_dir}/$(basename "${debug_file}" .debug) | 47 local text_path=${SYSROOT}${text_dir}/$(basename "${debug_file}" .debug) |
| 55 echo ${text_path} | 48 echo ${text_path} |
| 56 } | 49 } |
| 57 | 50 |
| 58 # Given path to a text file, return its debug file | 51 # Given path to a text file, return its debug file |
| 59 function get_debug_for_text { | 52 function get_debug_for_text { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 eval set -- "${FLAGS_ARGV}" | 179 eval set -- "${FLAGS_ARGV}" |
| 187 | 180 |
| 188 set -e | 181 set -e |
| 189 | 182 |
| 190 [ -n "$FLAGS_board" ] || die "--board is required." | 183 [ -n "$FLAGS_board" ] || die "--board is required." |
| 191 | 184 |
| 192 SYSROOT="/build/${FLAGS_board}" | 185 SYSROOT="/build/${FLAGS_board}" |
| 193 | 186 |
| 194 local upload_url="" | 187 local upload_url="" |
| 195 if [ ${FLAGS_dryrun} -eq ${FLAGS_FALSE} ]; then | 188 if [ ${FLAGS_dryrun} -eq ${FLAGS_FALSE} ]; then |
| 196 if is_official; then | 189 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]; then |
| 197 upload_url="http://clients2.google.com/cr/symbol" | 190 upload_url="http://clients2.google.com/cr/symbol" |
| 198 else | 191 else |
| 199 upload_url="http://clients2.google.com/cr/staging_symbol" | 192 upload_url="http://clients2.google.com/cr/staging_symbol" |
| 200 warn "This is an unofficial build, uploading to staging server." | 193 warn "This is an unofficial build, uploading to staging server." |
| 201 fi | 194 fi |
| 202 info "Uploading symbols to ${upload_url} from ${SYSROOT}." | 195 info "Uploading symbols to ${upload_url} from ${SYSROOT}." |
| 203 else | 196 else |
| 204 warn "Will not upload symbols due to --nodryrun." | 197 warn "Will not upload symbols due to --nodryrun." |
| 205 fi | 198 fi |
| 206 | 199 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 info "Would have uploaded ${CUMULATIVE_SIZE}B of debug information" | 231 info "Would have uploaded ${CUMULATIVE_SIZE}B of debug information" |
| 239 else | 232 else |
| 240 info "Uploaded ${CUMULATIVE_SIZE}B of debug information" | 233 info "Uploaded ${CUMULATIVE_SIZE}B of debug information" |
| 241 fi | 234 fi |
| 242 | 235 |
| 243 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" | 236 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" |
| 244 return 0 | 237 return 0 |
| 245 } | 238 } |
| 246 | 239 |
| 247 main "$@" | 240 main "$@" |
| OLD | NEW |