Files
TheRock/compiler/amd-llvm/compiler-rt/lib/gwp_asan/scripts/symbolize.sh
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

56 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# The lines that we're looking to symbolize look like this:
#0 ./a.out(_foo+0x3e6) [0x55a52e64c696]
# ... which come from the backtrace_symbols() symbolisation function used by
# default in Scudo's implementation of GWP-ASan.
while read -r line; do
# Check that this line needs symbolization.
should_symbolize="$(echo $line |\
grep -E '^[ ]*\#.*\(.*\+0x[0-9a-f]+\) \[0x[0-9a-f]+\]$')"
if [ -z "$should_symbolize" ]; then
echo "$line"
continue
fi
# Carve up the input line into sections.
binary_name="$(echo $line | grep -oE ' .*\(' | rev | cut -c2- | rev |\
cut -c2-)"
function_name="$(echo $line | grep -oE '\([^+]*' | cut -c2-)"
function_offset="$(echo $line | grep -oE '\(.*\)' | grep -oE '\+.*\)' |\
cut -c2- | rev | cut -c2- | rev)"
frame_number="$(echo $line | grep -oE '\#[0-9]+ ')"
if [ -z "$function_name" ]; then
# If the offset is binary-relative, just resolve that.
symbolized="$(echo $function_offset | addr2line -ie $binary_name)"
else
# Otherwise, the offset is function-relative. Get the address of the
# function, and add it to the offset, then symbolize.
function_addr="0x$(echo $function_offset |\
nm --defined-only $binary_name 2> /dev/null |\
grep -E " $function_name$" | cut -d' ' -f1)"
# Check that we could get the function address from nm.
if [ -z "$function_addr" ]; then
echo "$line"
continue
fi
# Add the function address and offset to get the offset into the binary.
binary_offset="$(printf "0x%X" "$((function_addr+function_offset))")"
symbolized="$(echo $binary_offset | addr2line -ie $binary_name)"
fi
# Check that it symbolized properly. If it didn't, output the old line.
echo $symbolized | grep -E ".*\?.*:" > /dev/null
if [ "$?" -eq "0" ]; then
echo "$line"
continue
else
echo "${frame_number}${symbolized}"
fi
done 2> >(grep -v "addr2line: DWARF error: could not find variable specification")