mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
PrintBP now accept a pre-format fonction to forge new format parameters
This commit is contained in:
@@ -160,9 +160,14 @@ class FunctionBP(FunctionCallBP, FunctionParamDumpBP):
|
||||
"""
|
||||
|
||||
class PrintBP(Breakpoint):
|
||||
def __init__(self, addr, format):
|
||||
def __init__(self, addr, format, func=None):
|
||||
super(PrintBP, self).__init__(addr)
|
||||
self.format = format
|
||||
self.func = func
|
||||
|
||||
def trigger(self, dbg, exc):
|
||||
print(self.format.format(dbg=dbg, exc=exc, ctx=dbg.current_thread.context))
|
||||
thread = dbg.current_thread
|
||||
format_dict = {"dbg": dbg, "exc": exc, "proc": dbg.current_process, "thread": thread, "ctx": thread.context}
|
||||
if self.func:
|
||||
format_dict.update(self.func(**format_dict))
|
||||
print(self.format.format(**format_dict))
|
||||
@@ -930,6 +930,7 @@ class Debugger(object):
|
||||
The default behaviour is to return ``DBG_CONTINUE`` for the known exception code
|
||||
and ``DBG_EXCEPTION_NOT_HANDLED`` else
|
||||
"""
|
||||
dbgprint("Exception: {0} at ".format(exception.ExceptionRecord.ExceptionCode, exception.ExceptionRecord.ExceptionAddress), "DBG")
|
||||
if not exception.ExceptionRecord.ExceptionCode in winexception.exception_name_by_value:
|
||||
return DBG_EXCEPTION_NOT_HANDLED
|
||||
return DBG_CONTINUE
|
||||
|
||||
Reference in New Issue
Block a user