- wrapped get_debug_names() (check ex_debug_names.py)

This commit is contained in:
elias.bachaalany 2009-09-17 11:46:35 +00:00
parent 38b7c484f3
commit 3ea31d70c7
3 changed files with 38 additions and 0 deletions

View File

@ -72,6 +72,7 @@ BINDIST_MANIFEST = [
"examples/structure.py", "examples/structure.py",
"examples/ex_gdl_qflow_chart.py", "examples/ex_gdl_qflow_chart.py",
"examples/ex_strings.py", "examples/ex_strings.py",
"examples/ex_debug_names.py"
] ]
# List files for the source distribution (appended to binary list) # List files for the source distribution (appended to binary list)

View File

@ -0,0 +1,15 @@
import idaapi
def main():
if not idaapi.is_debugger_on():
print "Please run the process first!"
return
if idaapi.get_process_state() != -1:
print "Please suspend the debugger first!"
return
dn = idaapi.get_debug_names(idaapi.cvar.inf.minEA, idaapi.cvar.inf.maxEA)
for i in dn:
print "%08x: %s" % (i, dn[i])
main()

View File

@ -11,6 +11,7 @@
%ignore get_struct_operand; %ignore get_struct_operand;
%ignore set_debug_names; %ignore set_debug_names;
%ignore get_debug_name; %ignore get_debug_name;
%ignore get_debug_names;
%ignore nameVa; %ignore nameVa;
// Unexported & kernel-only // Unexported & kernel-only
@ -30,5 +31,26 @@
%ignore is_exit_name; %ignore is_exit_name;
%ignore dummy_name_ea; %ignore dummy_name_ea;
%rename (get_debug_names) py_get_debug_names;
%inline %{
PyObject *py_get_debug_names(ea_t ea1, ea_t ea2)
{
// Get debug names
ea_name_vec_t names;
get_debug_names(ea1, ea2, names);
PyObject *dict = Py_BuildValue("{}");
if (dict == NULL)
return NULL;
for (ea_name_vec_t::iterator it=names.begin();it!=names.end();++it)
{
PyDict_SetItem(dict,
PyInt_FromSize_t(it->ea),
PyString_FromString(it->name.c_str()));
}
return dict;
}
%}
%include "name.hpp" %include "name.hpp"