8000 Stack decoder script by mcspr · Pull Request #8661 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Stack decoder script #8661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
last alloc explain, line breaks
  • Loading branch information
mcspr committed Aug 23, 2022
commit c47d7dc4ca692100d3532ce16623f3988fb3b9d8
20 changes: 17 additions & 3 deletions tools/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def addresses_addr2line(addr2line, elf, addresses):
def decode_lines(format_addresses, elf, lines):
STACK_RE = re.compile(r"^[0-9a-f]{8}:\s+([0-9a-f]{8} ?)+ *$")

LAST_ALLOC_RE = re.compile(r"last failed alloc call: ([0-9a-fA-F]{8})\(([0-9]+)\).*")
LAST_ALLOC = "last failed alloc"

CUT_HERE_STRING = "CUT HERE FOR EXCEPTION DECODER"
EXCEPTION_STRING = "Exception ("
EPC_STRING = "epc1="
Expand Down Expand Up @@ -141,17 +144,28 @@ def print_all_addresses(addresses):
elif EXCEPTION_STRING in line:
number = line.strip()[len(EXCEPTION_STRING) : -2]
print(f"Exception ({number}) - {EXCEPTION_CODES[int(number)]}")
# last failed alloc call: <ADDR>(<NUMBER>)[@<maybe file loc>]
elif LAST_ALLOC in line:
values = LAST_ALLOC_RE.match(line)
if values:
addr, size = values.groups()
output = "\n".join(format_addresses(elf, [addr]))
print()
print(f"Allocation of {size} bytes failed: {output}")
# postmortem guards our actual stack dump values with these
elif ">>>stack>>>" in line:
in_stack = True
elif "<<<stack<<<" in line:
break
# ignore
elif "<<<stack<<<" in line:
continue
elif CUT_HERE_STRING in line:
continue
else:
print(line.strip())
line = line.strip()
if line:
print(line)

print()
print_all_addresses(stack_addresses)


Expand Down
0