From 80896bc1d97b24123805c28d4d33dfd36ea98a5a Mon Sep 17 00:00:00 2001 From: "elias.bachaalany" Date: Fri, 17 Sep 2010 12:06:30 +0000 Subject: [PATCH] Minor modifications: - function documentation update - removed some white spaces --- examples/debughook.py | 22 +++++++++++++--------- python/idc.py | 14 +++++++------- swig/bytes.i | 2 +- swig/nalt.i | 6 +++--- swig/typeinf.i | 4 ++-- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/examples/debughook.py b/examples/debughook.py index 5fc26e8..338396b 100644 --- a/examples/debughook.py +++ b/examples/debughook.py @@ -15,15 +15,19 @@ class MyDbgHook(DBG_Hooks): """ Own debug hook class that implementd the callback functions """ def dbg_process_start(self, pid, tid, ea, name, base, size): - print "Process started, pid=%d tid=%d name=%s" % (pid, tid, name) + print("Process started, pid=%d tid=%d name=%s" % (pid, tid, name)) return 0 def dbg_process_exit(self, pid, tid, ea, code): - print "Process exited pid=%d tid=%d ea=0x%x code=%d" % (pid, tid, ea, code) + print("Process exited pid=%d tid=%d ea=0x%x code=%d" % (pid, tid, ea, code)) return 0 def dbg_library_unload(self, pid, tid, ea, info): - print "Library unloaded: pid=%d tid=%d ea=0x%x info=%s" % (pid, tid, ea, info) + print("Library unloaded: pid=%d tid=%d ea=0x%x info=%s" % (pid, tid, ea, info)) + return 0 + + def dbg_process_detach(self, pid, tid, ea): + print("Process detached, pid=%d tid=%d ea=0x%x" % (pid, tid, ea)) return 0 def dbg_library_load(self, pid, tid, ea, name, base, size): @@ -42,8 +46,8 @@ class MyDbgHook(DBG_Hooks): print "Process suspended" def dbg_exception(self, pid, tid, ea, exc_code, exc_can_cont, exc_ea, exc_info): - print "Exception: pid=%d tid=%d ea=0x%x exc_code=0x%x can_continue=%d exc_ea=0x%x exc_info=%s" % ( - pid, tid, ea, exc_code & idaapi.BADADDR, exc_can_cont, exc_ea, exc_info) + print("Exception: pid=%d tid=%d ea=0x%x exc_code=0x%x can_continue=%d exc_ea=0x%x exc_info=%s" % ( + pid, tid, ea, exc_code & idaapi.BADADDR, exc_can_cont, exc_ea, exc_info)) # return values: # -1 - to display an exception warning dialog # if the process is suspended. @@ -52,11 +56,11 @@ class MyDbgHook(DBG_Hooks): return 0 def dbg_trace(self, tid, ea): - print tid, ea + print("Trace tid=%d ea=0x%x" % (tid, ea)) return 0 def dbg_step_into(self): - print "Step into" + print("Step into") return self.dbg_step_over() # def dbg_run_to(self, tid): @@ -65,7 +69,7 @@ class MyDbgHook(DBG_Hooks): def dbg_step_over(self): eip = GetRegValue("EIP") - print "0x%x %s" % (eip, GetDisasm(eip)) + print("0x%x %s" % (eip, GetDisasm(eip))) self.steps += 1 if self.steps >= 5: @@ -77,7 +81,7 @@ class MyDbgHook(DBG_Hooks): # Remove an existing debug hook try: if debughook: - print "Removing previous hook ..." + print("Removing previous hook ...") debughook.unhook() except: pass diff --git a/python/idc.py b/python/idc.py index 203c70a..7ced6e5 100644 --- a/python/idc.py +++ b/python/idc.py @@ -1683,11 +1683,11 @@ def IdbByte(ea): def GetManyBytes(ea, size, use_dbg = False): """ Return the specified number of bytes of the program - + @param ea: linear address - + @param size: size of buffer in normal 8-bit bytes - + @param use_dbg: if True, use debugger memory, otherwise just the database @return: None on failure @@ -2894,7 +2894,7 @@ def AskStr(defval, prompt): in the dialog box. @param prompt: the prompt to display in the dialog box - @return: the entered string or 0. + @return: the entered string or None. """ return idaapi.askstr(0, defval, prompt) @@ -2907,7 +2907,7 @@ def AskFile(forsave, mask, prompt): @param mask: the input file mask as "*.*" or the default file name. @param prompt: the prompt to display in the dialog box - @return: the selected file or 0. + @return: the selected file or None. """ return idaapi.askfile_c(forsave, mask, prompt) @@ -2959,7 +2959,7 @@ def AskIdent(defval, prompt): the dialog box. @param prompt: the prompt to display in the dialog box - @return: the entered identifier or 0. + @return: the entered identifier or None. """ return idaapi.askident(defval, prompt) @@ -6622,7 +6622,7 @@ def GetModuleName(base): @param base: the base address of the module - @return: required info or 0 + @return: required info or None """ for module in _get_modules(): if module.base == base: diff --git a/swig/bytes.i b/swig/bytes.i index ca7fd05..f3936a3 100644 --- a/swig/bytes.i +++ b/swig/bytes.i @@ -605,7 +605,7 @@ static ea_t py_prevthat(ea_t ea, ea_t minea, PyObject *callable) //------------------------------------------------------------------------ /* # -def get_many_bytes(ea): +def get_many_bytes(ea, size): """ Get the specified number of bytes of the program into the buffer. @param ea: program address diff --git a/swig/nalt.i b/swig/nalt.i index 6f5c23a..c8600b6 100644 --- a/swig/nalt.i +++ b/swig/nalt.i @@ -129,7 +129,7 @@ def create_switch_xrefs(insn_ea, si): will call it for switch tables Note: Custom switch information are not supported yet. - + @param insn_ea: address of the 'indirect jump' instruction @param si: switch information @@ -157,7 +157,7 @@ idaman bool ida_export py_create_switch_xrefs( def create_switch_table(insn_ea, si): """ Create switch table from the switch information - + @param insn_ea: address of the 'indirect jump' instruction @param si: switch information @@ -173,7 +173,7 @@ idaman bool ida_export py_create_switch_table( switch_info_ex_t *swi = switch_info_ex_t_get_clink(py_swi); if ( swi == NULL ) return false; - + create_switch_table(insn_ea, swi); return true; } diff --git a/swig/typeinf.i b/swig/typeinf.i index 358edae..10b6da3 100644 --- a/swig/typeinf.i +++ b/swig/typeinf.i @@ -380,13 +380,13 @@ PyObject *py_pack_object_to_idb( //------------------------------------------------------------------------- /* # -def pack_object_to_bv(obj, ti, tp, fields, ea, pio_flags = 0): +def pack_object_to_bv(obj, ti, tp, fields, base_ea, pio_flags = 0): """ Packs a typed object to a string @param ti: Type info. 'idaapi.cvar.idati' can be passed. @param tp: type string @param fields: type fields - @param ea: ea to be used while packing + @param base_ea: base ea used to relocate the pointers in the packed object @param pio_flags: flags used while unpacking @return: tuple(0, err_code) on failure