2020-05-28 21:29:11 -04:00
|
|
|
"""Simple script that translates "Backtrace:" lines from the ESP output to files
|
|
|
|
and line numbers.
|
|
|
|
|
|
|
|
Run with: python3 tools/decode_backtrace.py <board>
|
|
|
|
|
|
|
|
Enter the backtrace line at the "? " prompt. CTRL-C to exit the script.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
board = sys.argv[1]
|
|
|
|
print(board)
|
|
|
|
|
|
|
|
while True:
|
|
|
|
addresses = input("? ")
|
|
|
|
if addresses.startswith("Backtrace:"):
|
2021-03-15 09:57:36 -04:00
|
|
|
addresses = addresses[len("Backtrace:") :]
|
2020-05-28 21:29:11 -04:00
|
|
|
addresses = addresses.strip().split()
|
|
|
|
addresses = [address.split(":")[0] for address in addresses]
|
2021-03-15 09:57:36 -04:00
|
|
|
subprocess.run(
|
2022-07-12 17:28:33 -04:00
|
|
|
["xtensa-esp32s2-elf-addr2line", "-aipfe", "build-{}/firmware.elf".format(board)]
|
|
|
|
+ addresses
|
2021-03-15 09:57:36 -04:00
|
|
|
)
|