Bug 1920445 - Improve scraping Microsoft system symbols when the file name and debug name differ r=afranchuk

Differential Revision: https://phabricator.services.mozilla.com/D223120
This commit is contained in:
Gabriele Svelto 2024-09-25 07:04:13 +00:00
parent 1a8c3384a8
commit 11cb620819

View File

@ -26,30 +26,34 @@ cd ..
# Find the missing modules entries, in the crash modules list, and extract the
# code id and debug filename, we'll store them in a file to process them later.
find "${CRASHES_DIR}" -name "index.html*" -exec jq ".json_dump.modules[] | select(.missing_symbols == true) | .code_id,.filename" {} \; | tr -d '"' | while read line; do
find "${CRASHES_DIR}" -name "index.html*" -exec jq -r ".json_dump.modules[] | select(.missing_symbols == true) | .code_id,.filename,.debug_file" {} \; | while read line; do
if [ -z "${code_id}" ]; then
code_id="${line}"
else
elif [ -z "${filename}" ]; then
filename="${line}"
printf "${filename},${code_id}\n" >> debuginfo.list
else
debug_file="${line}"
printf "${filename},${code_id},${debug_file}\n" >> debuginfo.list
code_id=""
filename=""
debug_file=""
fi
done
# Dump every missing module we found, some will not be available.
sort -u debuginfo.list | while read line; do
filename=$(echo "${line}" | cut -d',' -f1)
code_id=$(echo "${line}" | cut -d',' -f2)
printf "Attempting to dump file ${filename} with id ${code_id}\n"
# Dump symbols using the first parameter as the filename and the second
# parameter as the code ID. Exit the script if we encounter an unexpected
# failure when invoking dump_syms. Return the exit code captured from dump_syms
dump_symbols() {
local filename="${1}"
local code_id="${2}"
# dump_syms may fail, but we don't always want to stop the script if it
# does, so we capture the return value and use the output to decide whether
# we want to move on or not.
"${DUMP_SYMS}" "${filename}" --code-id "${code_id}" --inlines --check-cfi \
--store "${SYMBOL_STORE}" --symbol-server "${SYMBOL_SERVER_URLS}" \
--verbose error 2>dump_syms.errors && rv=0 || rv=$?
--store "${SYMBOL_STORE}" --symbol-server "${SYMBOL_SERVER_URLS}" \
--verbose error 2>dump_syms.errors && rv=0 || rv=$?
if [ ${rv} -ne 0 ]; then
errors=$(cat dump_syms.errors)
@ -60,6 +64,29 @@ sort -u debuginfo.list | while read line; do
exit 1
fi
fi
return ${rv}
}
# Dump every missing module we found, some will not be available.
sort -u debuginfo.list | while read line; do
filename=$(echo "${line}" | cut -d',' -f1)
code_id=$(echo "${line}" | cut -d',' -f2)
debug_file=$(echo "${line}" | cut -d',' -f3)
alt_filename=$(echo "${debug_file}" | rev | cut -d'\' -f1 | cut -d'.' -f2- | rev)
alt_filename="${alt_filename}.dll"
set +e
printf "Attempting to dump file ${filename} with id ${code_id}\n"
dump_symbols "${filename}" "${code_id}"
if [ $? -ne 0 ] && [ -n "${debug_file}" ] && \
[ "${filename}" != "${alt_filename}" ]; then
# Try again but using the debug file name
printf "Attempting to dump alternative file ${alt_filename} with id ${code_id}\n"
dump_symbols "${alt_filename}" "${code_id}"
fi
set -e
done
# Create the symbols archive only if we actually dumped something.