Minor modifications:

- function documentation update
- removed some white spaces
This commit is contained in:
elias.bachaalany 2010-09-17 12:06:30 +00:00
parent 36c814331a
commit 80896bc1d9
5 changed files with 26 additions and 22 deletions

View File

@ -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

View File

@ -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:

View File

@ -605,7 +605,7 @@ static ea_t py_prevthat(ea_t ea, ea_t minea, PyObject *callable)
//------------------------------------------------------------------------
/*
#<pydoc>
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

View File

@ -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;
}

View File

@ -380,13 +380,13 @@ PyObject *py_pack_object_to_idb(
//-------------------------------------------------------------------------
/*
#<pydoc>
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