mirror of
https://github.com/cemu-project/idapython.git
synced 2024-12-27 10:11:53 +01:00
- added ph_get_operand_info()
This commit is contained in:
parent
2327aada40
commit
c29e1ef2da
76
swig/idp.i
76
swig/idp.i
@ -32,7 +32,7 @@
|
||||
%ignore ph;
|
||||
%ignore IDB_Callback;
|
||||
%ignore IDP_Callback;
|
||||
|
||||
%ignore _py_getreg;
|
||||
%ignore free_processor_module;
|
||||
%ignore read_config_file;
|
||||
|
||||
@ -389,6 +389,66 @@ static PyObject *ph_get_regnames()
|
||||
return py_result;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
static const regval_t *idaapi _py_getreg(
|
||||
const char *name,
|
||||
const regval_t *regvals);
|
||||
|
||||
/*
|
||||
#<pydoc>
|
||||
def ph_get_operand_info():
|
||||
"""
|
||||
Returns the operand information given an ea and operand number.
|
||||
|
||||
@param ea: address
|
||||
@param n: operand number
|
||||
|
||||
@return: Returns an idd_opinfo_t as a tuple: (modified, ea, reg_ival, regidx, value_size).
|
||||
Please refer to idd_opinfo_t structure in the SDK.
|
||||
"""
|
||||
pass
|
||||
#</pydoc>
|
||||
*/
|
||||
static PyObject *ph_get_operand_info(
|
||||
ea_t ea,
|
||||
int n)
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( dbg == NULL || n == - 1 )
|
||||
break;
|
||||
|
||||
// Allocate register space
|
||||
thid_t tid = get_current_thread();
|
||||
regvals_t regvalues;
|
||||
regvalues.reserve(dbg->registers_size);
|
||||
|
||||
// Read registers
|
||||
if ( dbg->read_registers(tid, -1, regvalues.begin()) != 1 )
|
||||
break;
|
||||
|
||||
// Call the processor module
|
||||
idd_opinfo_t opinf;
|
||||
if ( ph.notify(ph.get_operand_info,
|
||||
ea,
|
||||
n,
|
||||
tid,
|
||||
_py_getreg,
|
||||
regvalues.begin(),
|
||||
&opinf) != 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
return Py_BuildValue("(i" PY_FMT64 "Kii)",
|
||||
opinf.modified,
|
||||
opinf.ea,
|
||||
opinf.value.ival,
|
||||
opinf.debregidx,
|
||||
opinf.value_size);
|
||||
} while (false);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
#<pydoc>
|
||||
@ -1200,6 +1260,20 @@ int idaapi IDB_Callback(void *ud, int notification_code, va_list va)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static const regval_t *idaapi _py_getreg(
|
||||
const char *name,
|
||||
const regval_t *regvals)
|
||||
{
|
||||
for ( int i=dbg->registers_size - 1; i >= 0; i-- )
|
||||
{
|
||||
if ( stricmp(name, dbg->registers[i].name) == 0 )
|
||||
return ®vals[i];
|
||||
}
|
||||
static regval_t rv;
|
||||
return &rv;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//</code(py_idp)>
|
||||
%}
|
@ -408,6 +408,7 @@ class UI_Hooks(object):
|
||||
(these names can be looked up in ida[tg]ui.cfg)
|
||||
@return: 0-ok, nonzero - a plugin has handled the command
|
||||
"""
|
||||
pass
|
||||
|
||||
def postprocess(self):
|
||||
"""
|
||||
@ -727,15 +728,15 @@ int idaapi UI_Callback(void *ud, int notification_code, va_list va)
|
||||
{
|
||||
switch (notification_code)
|
||||
{
|
||||
case ui_preprocess:
|
||||
case ui_preprocess:
|
||||
{
|
||||
const char *name = va_arg(va, const char *);
|
||||
return proxy->preprocess(name);
|
||||
}
|
||||
|
||||
case ui_postprocess:
|
||||
proxy->postprocess();
|
||||
break;
|
||||
case ui_postprocess:
|
||||
proxy->postprocess();
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Swig::DirectorException &)
|
||||
|
@ -112,3 +112,4 @@
|
||||
return py_str;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user