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 generate minidump symbols in the format required by | 6 # Script to generate minidump symbols in the format required by |
7 # minidump_stackwalk to dump stack information. | 7 # minidump_stackwalk to dump stack information. |
8 # | 8 # |
9 # NOTE: This script must be run from the chromeos build chroot environment. | 9 # NOTE: This script must be run from the chromeos build chroot environment. |
10 # | 10 # |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 fi | 70 fi |
71 return 0 | 71 return 0 |
72 } | 72 } |
73 | 73 |
74 # Dump given debug and text file. Returns 1 if any errors, even | 74 # Dump given debug and text file. Returns 1 if any errors, even |
75 # if they can be ignored, but only sets ANY_ERRORS if the error should not | 75 # if they can be ignored, but only sets ANY_ERRORS if the error should not |
76 # be ignored (and we should not proceed to upload). | 76 # be ignored (and we should not proceed to upload). |
77 function dump_file() { | 77 function dump_file() { |
78 local debug_file="$1" | 78 local debug_file="$1" |
79 local text_file="$2" | 79 local text_file="$2" |
| 80 local debug_directory="$(dirname "${debug_file}")" |
80 # 64b ELF files may be installed on the target in PERL directories | 81 # 64b ELF files may be installed on the target in PERL directories |
81 verify_not_64b_elf "${debug_file}" || return 1 | 82 verify_not_64b_elf "${debug_file}" || return 1 |
82 verify_not_64b_elf "${text_file}" || return 1 | 83 verify_not_64b_elf "${text_file}" || return 1 |
83 # Dump symbols as root in order to read all files. | 84 # Dump symbols as root in order to read all files. |
84 if ! sudo "${DUMP_SYMS}" "${debug_file}" "${text_file}" > "${SYM_FILE}" \ | 85 if ! sudo "${DUMP_SYMS}" "${text_file}" "${debug_directory}" > "${SYM_FILE}" \ |
85 2> "${ERR_FILE}"; then | 86 2> "${ERR_FILE}"; then |
86 # A lot of files (like kernel files) contain no debug information, do | 87 # A lot of files (like kernel files) contain no debug information, do |
87 # not consider such occurrences as errors. | 88 # not consider such occurrences as errors. |
88 if grep -q "file contains no debugging information" "${ERR_FILE}"; then | 89 if grep -q "file contains no debugging information" "${ERR_FILE}"; then |
89 warn "No symbols found for ${text_file}" | 90 warn "No symbols found for ${text_file}" |
90 return 1 | 91 return 1 |
91 fi | 92 fi |
92 error "Unable to dump symbols for ${text_file}:" | 93 error "Unable to dump symbols for ${text_file}:" |
93 cat "${ERR_FILE}" | 94 cat "${ERR_FILE}" |
94 ANY_ERRORS=1 | 95 ANY_ERRORS=1 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 done | 198 done |
198 fi | 199 fi |
199 | 200 |
200 info "Generated ${CUMULATIVE_SIZE}B of debug information" | 201 info "Generated ${CUMULATIVE_SIZE}B of debug information" |
201 | 202 |
202 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" | 203 [ ${ANY_ERRORS} -ne 0 ] && die "Encountered problems" |
203 return 0 | 204 return 0 |
204 } | 205 } |
205 | 206 |
206 main "$@" | 207 main "$@" |
OLD | NEW |