From ff7ab3f1dc919264320bbb8094b3cd8519210070 Mon Sep 17 00:00:00 2001 From: "elias.bachaalany" Date: Wed, 5 May 2010 13:05:53 +0000 Subject: [PATCH] idc.py: added SendDbgCommand() --- python/idc.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/python/idc.py b/python/idc.py index 80f5d44..9d7983a 100644 --- a/python/idc.py +++ b/python/idc.py @@ -6659,8 +6659,18 @@ def GetDebuggerEvent(wfne, timeout): return idaapi.wait_for_next_event(wfne, timeout) -def ResumeProcess(): return GetDebuggerEvent(WFNE_CONT|WFNE_NOWAIT, 0) +def ResumeProcess(): + return GetDebuggerEvent(WFNE_CONT|WFNE_NOWAIT, 0) +def SendDbgCommand(cmd): + """Sends a command to the debugger module and returns the output string. + An exception will be raised if the debugger is not running or the current debugger does not export + the 'SendDbgCommand' IDC command. + """ + s = Eval('SendDbgCommand("%s");' % cmd) + if s.startswith("IDC_FAILURE"): + raise Exception, "Debugger command is available only when the debugger is active!" + return s # wfne flag is combination of the following: WFNE_ANY = 0x0001 # return the first event (even if it doesn't suspend the process)