From 3a34bbb6d412722391d1507626c14b2a209a3d90 Mon Sep 17 00:00:00 2001 From: "Matt." Date: Tue, 5 Nov 2024 16:26:00 -0300 Subject: [PATCH] Add better handling for exceptions originating in execution controllers under LLDB (#2488) --- pwndbg/dbg/lldb/repl/__init__.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pwndbg/dbg/lldb/repl/__init__.py b/pwndbg/dbg/lldb/repl/__init__.py index 66ad62a20..322231d64 100644 --- a/pwndbg/dbg/lldb/repl/__init__.py +++ b/pwndbg/dbg/lldb/repl/__init__.py @@ -351,14 +351,29 @@ def run(startup: List[str] | None = None, debug: bool = False) -> None: # At this point, the last command might've queued up some execution # control procedures for us to chew on. Run them now. + coroutine_fail_warn = False for process, coroutine in dbg.controllers: assert driver.has_process() assert driver.process.GetUniqueID() == process.process.GetUniqueID() - driver.run_coroutine(coroutine) + try: + driver.run_coroutine(coroutine) + except Exception: + # We treat exceptions coming from the execution controllers the + # same way we treat exceptions coming from commands. + pwndbg.exception.handle() + coroutine_fail_warn = True dbg.controllers.clear() + if coroutine_fail_warn: + print( + message.warn( + "Exceptions occurred execution controller processing. Debugging will likely be unreliable going forward." + ) + ) + break + def make_pty() -> Tuple[str, int]: """