summaryrefslogtreecommitdiff
path: root/src/arch/instriter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/instriter.c')
-rw-r--r--src/arch/instriter.c81
1 files changed, 79 insertions, 2 deletions
diff --git a/src/arch/instriter.c b/src/arch/instriter.c
index 0f33998..5a534d5 100644
--- a/src/arch/instriter.c
+++ b/src/arch/instriter.c
@@ -99,6 +99,83 @@ void delete_instruction_iterator(instr_iter_t *iter)
* *
* Paramètres : iter = itérateur à manipuler. *
* *
+* Description : Fournit l'instruction courante de l'itérateur. *
+* *
+* Retour : Instruction suivante trouvée, ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *get_instruction_iterator_current(instr_iter_t *iter)
+{
+ GArchInstruction *result; /* Résultat à retourner */
+
+ g_arch_processor_lock(iter->proc);
+
+ if (iter->stamp != g_arch_processor_get_stamp(iter->proc))
+ result = NULL;
+
+ else
+ {
+ if (iter->index < g_arch_processor_count_instructions(iter->proc))
+ result = g_arch_processor_get_instruction(iter->proc, iter->index);
+ else
+ result = NULL;
+
+ }
+
+ g_arch_processor_unlock(iter->proc);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : iter = itérateur à manipuler. *
+* *
+* Description : Fournit l'instruction qui en précède une autre. *
+* *
+* Retour : Instruction suivante trouvée, ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchInstruction *get_instruction_iterator_prev(instr_iter_t *iter)
+{
+ GArchInstruction *result; /* Résultat à retourner */
+
+ g_arch_processor_lock(iter->proc);
+
+ if (iter->stamp != g_arch_processor_get_stamp(iter->proc))
+ result = NULL;
+
+ else
+ {
+ if (iter->index > 0)
+ result = g_arch_processor_get_instruction(iter->proc, iter->index);
+ else
+ result = NULL;
+
+ if (result != NULL)
+ iter->index--;
+
+ }
+
+ g_arch_processor_unlock(iter->proc);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : iter = itérateur à manipuler. *
+* *
* Description : Fournit l'instruction qui en suit une autre. *
* *
* Retour : Instruction suivante trouvée, ou NULL. *
@@ -118,8 +195,8 @@ GArchInstruction *get_instruction_iterator_next(instr_iter_t *iter)
else
{
- if (iter->index < g_arch_processor_count_disassembled_instructions(iter->proc))
- result = g_arch_processor_get_disassembled_instruction(iter->proc, iter->index);
+ if (iter->index < g_arch_processor_count_instructions(iter->proc))
+ result = g_arch_processor_get_instruction(iter->proc, iter->index);
else
result = NULL;