exception in action of a breakpoint will cause crash
The traceback is like: debug.loop() File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\debug.py", line 1178, in loop self.next() File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\debug.py", line 1140, in next self.dispatch() File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\debug.py", line 992, in dispatch return EventDispatcher.dispatch(self, event) File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\event.py", line 1978, in dispatch bCallHandler = pre_handler(event) File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\breakpoint.py", line 3477, in _notify_breakpoint bCallHandler = bp.run_action(event) File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\breakpoint.py", line 367, in run_action msg = msg % (action, traceback.format_exc(e)) File "C:\Users\William SHI\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 183, in format_exc return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain)) File "C:\Users\William SHI\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 135, in format_exception te = TracebackException(type(value), value, tb, limit=limit, compact=True) File "C:\Users\William SHI\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 502, in init self.stack = StackSummary.extract( File "C:\Users\William SHI\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 357, in extract if limit >= 0: TypeError: '>=' not supported between instances of 'AssertionError' and 'int'
And I think this is caused by: traceback.format_exc(e) in the: def run_action(self, event): """ Run the action callback for this breakpoint.
:param event: Event that triggered this breakpoint.
:type event: :class:`~winappdbg.event.Event`
"""
action = self.get_action()
if action is not None:
try:
return bool(action(event))
except Exception as e:
msg = "Breakpoint action callback %r raised an exception: %s"
msg = msg % (action, traceback.format_exc(e))
warnings.warn(msg, BreakpointCallbackWarning)
return False
return True
of the breakpoint.py.
That's odd, the exception is inside format_exc(). Can you try again, but temporarily replace the warning with an actual exception, so we can see the original traceback?
Let's also try removing the "as e" part in the "except" statement and just calling format_exc() with no arguments. This should automatically pull the traceback from the last exception without having to directly pass it the Exception instance.