summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/arch/processor.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/arch/processor.c')
-rw-r--r--plugins/pychrysa/arch/processor.c44
1 files changed, 12 insertions, 32 deletions
diff --git a/plugins/pychrysa/arch/processor.c b/plugins/pychrysa/arch/processor.c
index 291d788..3ef56e4 100644
--- a/plugins/pychrysa/arch/processor.c
+++ b/plugins/pychrysa/arch/processor.c
@@ -34,6 +34,7 @@
#include <arch/processor.h>
+#include "instriter.h"
#include "instruction.h"
#include "vmpa.h"
#include "../helpers.h"
@@ -62,7 +63,7 @@
/* Fournit les instructions désassemblées pour une architecture. */
-static PyObject *py_arch_processor_get_disass_instrs(PyObject *, void *);
+static PyObject *py_arch_processor_get_instrs(PyObject *, void *);
/* Recherche une instruction d'après son adresse. */
static PyObject *py_arch_processor_find_instr_by_addr(PyObject *, PyObject *);
@@ -75,8 +76,6 @@ static PyObject *py_arch_processor_get_next_instr(PyObject *, PyObject *);
-
-
/* ---------------------------------------------------------------------------------- */
/* MANIPULATIONS DES INSTRUCTIONS DESASSEMBLEES */
/* ---------------------------------------------------------------------------------- */
@@ -95,22 +94,19 @@ static PyObject *py_arch_processor_get_next_instr(PyObject *, PyObject *);
* *
******************************************************************************/
-static PyObject *py_arch_processor_get_disass_instrs(PyObject *self, void *closure)
+static PyObject *py_arch_processor_get_instrs(PyObject *self, void *closure)
{
PyObject *result; /* Instance Python à retourner */
- GArchProcessor *proc; /* Architecture visée */
- GArchInstruction *instrs; /* Série d'instructions liées */
+ PyTypeObject *iterator_type; /* Type Python de l'itérateur */
+ PyObject *args; /* Liste des arguments d'appel */
- proc = G_ARCH_PROCESSOR(pygobject_get(self));
- instrs = g_arch_processor_get_disassembled_instructions(proc);
+ iterator_type = get_python_instr_iterator_type();
- if (instrs != NULL)
- result = pygobject_new(G_OBJECT(instrs));
- else
- {
- result = Py_None;
- Py_INCREF(result);
- }
+ args = Py_BuildValue("On", self, 0);
+
+ result = PyObject_CallObject((PyObject *)iterator_type, args);
+
+ Py_DECREF(args);
return result;
@@ -293,22 +289,6 @@ static PyObject *py_arch_processor_get_next_instr(PyObject *self, PyObject *args
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/******************************************************************************
* *
* Paramètres : - *
@@ -344,7 +324,7 @@ PyTypeObject *get_python_arch_processor_type(void)
static PyGetSetDef py_arch_processor_getseters[] = {
{
- "disass_instrs", py_arch_processor_get_disass_instrs, py_arch_processor_set_disass_instrs,
+ "instrs", py_arch_processor_get_instrs, py_arch_processor_set_disass_instrs,
"Give access to the disassembled instructions run by the current processor.", NULL
},
{ NULL }