Skip to content
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

Esp8266ExceptionDecoder compatibility fixes #211

Merged
merged 2 commits into from
May 21, 2020
Merged
Changes from all commits
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
15 changes: 8 additions & 7 deletions monitor/filter_exception_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ class Esp8266ExceptionDecoder(
ADDR_MAX = 0x40300000

STATE_DEFAULT = 0
STATE_READ_EXCEPTION = 1
STATE_IN_STACK = 2
STATE_IN_STACK = 1

EXCEPTION_MARKER = "Exception ("

Expand Down Expand Up @@ -157,6 +156,9 @@ def rx(self, text):
self.buffer = ""
last = idx + 1

if line[-1] == "\r":
line = line[:-1]

extra = self.process_line(line)
self.previous_line = line
if extra is not None:
Expand All @@ -177,19 +179,18 @@ def is_addr_ok(self, hex_addr):

def process_line(self, line): # pylint: disable=too-many-return-statements
if self.state == self.STATE_DEFAULT:
extra = None
if self.previous_line.startswith(self.EXCEPTION_MARKER):
two_lines = (
self.previous_line[len(self.EXCEPTION_MARKER) :] + "\n" + line
)
match = self.exception_re.match(two_lines)
if match is not None:
self.advance_state()
return self.process_exception_match(match)
return None
elif self.state == self.STATE_READ_EXCEPTION:
extra = self.process_exception_match(match)

if line == ">>>stack>>>":
self.advance_state()
return None
return extra
elif self.state == self.STATE_IN_STACK:
if line == "<<<stack<<<":
self.state = self.STATE_DEFAULT
Expand Down