summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-01-08 20:03:20 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-01-08 20:03:20 (GMT)
commit746a7cfb0b5f2db859618d2e490eafeb9047958b (patch)
treec82c0f0bcdfda0cb6c913b707f25a38d8fac1179 /plugins
parent991445be8992c9aad1d86f1ce28300c3421e8f2c (diff)
Fixed the behavior of the instruction iterator.
Diffstat (limited to 'plugins')
-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;