From bc4c1d2866b896f6234d19111993fae4a9f47d74 Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Mon, 18 May 2020 14:43:01 -0700 Subject: Parse "cannot insert breakpoint" message. (#279) Also use sys.exit instead of exit, per new pylint's suggestion. --- debug/testlib.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'debug/testlib.py') diff --git a/debug/testlib.py b/debug/testlib.py index 36f1f17..bd83d56 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -263,7 +263,7 @@ class Openocd: self.config_file = find_file(config) if self.config_file is None: print("Unable to read file", config) - exit(1) + sys.exit(1) cmd += ["-f", self.config_file] if debug: @@ -379,6 +379,11 @@ class CannotAccess(Exception): Exception.__init__(self) self.address = address +class CannotInsertBreakpoint(Exception): + def __init__(self, number): + Exception.__init__(self) + self.number = number + class CouldNotFetch(Exception): def __init__(self, regname, explanation): Exception.__init__(self) @@ -412,6 +417,8 @@ def tokenize(text): lambda m: CouldNotFetch(m.group(1), m.group(2))), (r"Cannot access memory at address (0x[0-9a-f]+)", lambda m: CannotAccess(int(m.group(1), 0))), + (r"Cannot insert breakpoint (\d+).", + lambda m: CannotInsertBreakpoint(int(m.group(1)))), (r'No symbol "(\w+)" in current context.', lambda m: NoSymbol(m.group(1))), (r'"([^"]*)"', lambda m: m.group(1)), -- cgit v1.1