PrintBP now accept a pre-format fonction to forge new format parameters

This commit is contained in:
Clement Rouault
2017-05-24 17:45:27 +02:00
parent 3c21d8c59c
commit a89854a045
2 changed files with 8 additions and 2 deletions
+7 -2
View File
@@ -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))
+1
View File
@@ -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