2019-01-08 15:04:34 +04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
import re
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
print('Paste backtrace here, and then input EOF(Ctrl-D or Ctrl-Z) to get annotated backtrace.')
|
|
|
|
lines = sys.stdin.readlines()
|
|
|
|
addrline = sys.argv[1]
|
|
|
|
arch = sys.argv[2]
|
2019-03-29 09:14:08 +04:00
|
|
|
mode = sys.argv[3]
|
2019-01-08 15:04:34 +04:00
|
|
|
print('--------------------------------------')
|
|
|
|
for line in lines:
|
2019-04-16 20:26:30 +04:00
|
|
|
match = re.search('#([0-9]+) PC: (0x[0-9A-F]+) FP: (0x[0-9A-F]+)', line)
|
2019-01-08 15:04:34 +04:00
|
|
|
if match:
|
|
|
|
addr = match.group(2)
|
2019-03-29 09:14:08 +04:00
|
|
|
process = subprocess.run([addrline, '-e', 'target/{0}/{1}/rcore'.format(arch, mode), '-f', '-C', addr], capture_output=True)
|
2019-01-08 15:04:34 +04:00
|
|
|
res = process.stdout.decode('utf-8')
|
2020-01-29 06:59:39 +04:00
|
|
|
stderr = process.stderr.decode('utf-8')
|
|
|
|
if stderr:
|
|
|
|
print(stderr)
|
2019-04-16 20:26:30 +04:00
|
|
|
print('#{0} PC: {1} FP: {3} {2}'.format(match.group(1), match.group(2), res.strip(), match.group(3)))
|
2019-01-08 15:04:34 +04:00
|
|
|
else:
|
|
|
|
print(line, end='')
|