cros_generate_breakpad_symbols: try dumping w/out cfi info when falling back
The dump_syms prog can be buggy and crash when given a really large debug
file. If that happens, automatically fall back to stripping out some of
the extended information so that we still at least get symbols.
BUG=chromium:266064
TEST=ran `./cros_generate_breakpad_symbols` on a Chrome that is causing dump_syms to crash and watched retry
TEST=`cbuildbot daisy-release` dumps chrome symbols
Change-Id: I1cba5d515e28d668b114298a99d290df25d18601
Previous-Reviewed-on: https://gerrit.chromium.org/gerrit/66097
(cherry picked from commit da0bd1eb7e69b4955f09e4ee8b3c89e12dec355f)
Reviewed-on: https://gerrit.chromium.org/gerrit/66218
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Matt Tennant <mtennant@chromium.org>
diff --git a/cros_generate_breakpad_symbols b/cros_generate_breakpad_symbols
index 444adff..3f9940f 100755
--- a/cros_generate_breakpad_symbols
+++ b/cros_generate_breakpad_symbols
@@ -141,22 +141,31 @@
# Dump symbols as root in order to read all files.
if ! sudo "${dump_syms_prog}" "${text_file}" "${debug_directory}" \
> "${SYM_FILE}" 2> /dev/null; then
- # Try dumping just the main file to get public-only symbols.
- ERR_FILE=$(mktemp -t "breakpad.err.XXXXXX")
- if ! sudo "${dump_syms_prog}" "${text_file}" > "${SYM_FILE}" \
- 2> "${ERR_FILE}"; then
- # A lot of files (like kernel files) contain no debug information, do
- # not consider such occurrences as errors.
- if grep -q "file contains no debugging information" "${ERR_FILE}"; then
- warn "No symbols found for ${text_file}"
- _worker_finished 0
- exit 0
+ # Try dumping w/out extended cfi. Some versions of dump_syms like to
+ # crash. At least we can get the symbols. http://crbug.com/266064
+ debug "Normal dumping failed; retrying with -c -r"
+ if ! sudo "${dump_syms_prog}" -c -r "${text_file}" "${debug_directory}" \
+ > "${SYM_FILE}" 2> /dev/null; then
+ # Try dumping just the main file to get public-only symbols.
+ debug "Normal dumping still failed; retrying w/out debug symbols"
+ ERR_FILE=$(mktemp -t "breakpad.err.XXXXXX")
+ if ! sudo "${dump_syms_prog}" "${text_file}" > "${SYM_FILE}" \
+ 2> "${ERR_FILE}"; then
+ # A lot of files (like kernel files) contain no debug information, do
+ # not consider such occurrences as errors.
+ if grep -q "file contains no debugging information" "${ERR_FILE}"; then
+ warn "No symbols found for ${text_file}"
+ _worker_finished 0
+ exit 0
+ fi
+ error "Unable to dump symbols for ${text_file}:"
+ error "$(<"${ERR_FILE}")"
+ exit 1
+ else
+ warn "File ${text_file} did not have debug info, using linkage symbols"
fi
- error "Unable to dump symbols for ${text_file}:"
- error "$(<"${ERR_FILE}")"
- exit 1
else
- warn "File ${text_file} did not have debug info, using linkage symbols"
+ warn "Dumping ${text_file} w/CFI failed; generated syms w/out it"
fi
fi
local file_id=$(head -1 ${SYM_FILE} | cut -d' ' -f4)