#!/usr/bin/env bash # Turns crash addresses into functions and source lines, using the archived ELF of the build that # crashed (.pio/elves/, kept by scripts/version.py). # Usage: scripts/decode_backtrace.sh
... set -euo pipefail source "$(dirname "$0")/_docker.sh" [ $# -ge 2 ] || { echo "Usage: scripts/decode_backtrace.sh
..." >&2; exit 1; } ELF="$(ls -t "$ROOT"/.pio/elves/*"$1"*.elf 2>/dev/null | head -1 || true)" [ -n "$ELF" ] || { echo "No archived ELF matches '$1' in .pio/elves/" >&2; exit 1; } echo "using ${ELF#$ROOT/}" >&2 DOCKER_EXTRA=() run_in_container /pio/tools/toolchain-xtensa-esp-elf/bin/xtensa-esp32s3-elf-addr2line -pfiaC -e "/work/${ELF#$ROOT/}" "${@:2}"