summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/arch/instriter.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/arch/instriter.c')
-rw-r--r--plugins/pychrysa/arch/instriter.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/pychrysa/arch/instriter.c b/plugins/pychrysa/arch/instriter.c
index 6882cab..244a825 100644
--- a/plugins/pychrysa/arch/instriter.c
+++ b/plugins/pychrysa/arch/instriter.c
@@ -41,6 +41,7 @@ typedef struct _PyInstrIterator
PyObject_HEAD; /* A laisser en premier */
instr_iter_t *native; /* Version native de l'objet */
+ bool first_time; /* Premier élément retourné ? */
} PyInstrIterator;
@@ -97,7 +98,14 @@ static PyObject *py_instr_iterator_next(PyInstrIterator *self)
PyObject *result; /* Résultat à retourner */
GArchInstruction *next; /* Instruction suivante */
- next = get_instruction_iterator_next(self->native);
+ if (self->first_time)
+ {
+ next = get_instruction_iterator_current(self->native);
+ self->first_time = false;
+ }
+
+ else
+ next = get_instruction_iterator_next(self->native);
if (next != NULL)
{
@@ -149,6 +157,7 @@ static int py_instr_iterator_init(PyInstrIterator *self, PyObject *args, PyObjec
proc = G_ARCH_PROCESSOR(pygobject_get(proc_obj));
self->native = create_instruction_iterator(proc, index);
+ self->first_time = true;
result = 0;