diff options
Diffstat (limited to 'src/arch/processor.h')
-rw-r--r-- | src/arch/processor.h | 60 |
1 files changed, 38 insertions, 22 deletions
diff --git a/src/arch/processor.h b/src/arch/processor.h index 02b3533..05ea77a 100644 --- a/src/arch/processor.h +++ b/src/arch/processor.h @@ -29,6 +29,7 @@ #include "context.h" +#include "instriter.h" #include "instruction.h" #include "../common/endianness.h" #include "../format/executable.h" @@ -86,47 +87,62 @@ void g_arch_processor_lock_unlock(GArchProcessor *, bool); /* Fournit la marque de dernière modification des instructions. */ unsigned int g_arch_processor_get_stamp(const GArchProcessor *); +/* Compte le nombre d'instructions représentées. */ +size_t g_arch_processor_count_instructions(const GArchProcessor *); +/* Note les instructions désassemblées avec une architecture. */ +void g_arch_processor_set_disassembled_instructions(GArchProcessor *, GArchInstruction *); -/* ------------------ MANIPULATIONS DES INSTRUCTIONS DESASSEMBLEES ------------------ */ - +/* Fournit une instruction désassemblée pour une architecture. */ +GArchInstruction *g_arch_processor_get_instruction(const GArchProcessor *, size_t); -/* Couverture d'un groupe d'instructions */ -typedef struct _instr_coverage instr_coverage; -/* Note les instructions désassemblées avec une architecture. */ -void g_arch_processor_set_disassembled_instructions(GArchProcessor *, GArchInstruction *); +/* ------------------ MANIPULATIONS DES INSTRUCTIONS DESASSEMBLEES ------------------ */ -/* Fournit les instructions désassemblées pour une architecture. */ -GArchInstruction *g_arch_processor_get_disassembled_instructions(const GArchProcessor *); -/* Fournit une instruction désassemblée pour une architecture. */ -GArchInstruction *g_arch_processor_get_disassembled_instruction(const GArchProcessor *, size_t); +/* Couverture d'un groupe d'instructions */ +typedef struct _instr_coverage instr_coverage; -/* Compte le nombre d'instructions représentées. */ -size_t g_arch_processor_count_disassembled_instructions(const GArchProcessor *); /* Recherche un groupe d'instruction d'après son adresse. */ const instr_coverage *g_arch_processor_find_coverage_by_address(const GArchProcessor *, const vmpa2t *); /* Recherche une instruction d'après son adresse. */ -GArchInstruction *_g_arch_processor_find_instr_by_address(const GArchProcessor *, const vmpa2t *, bool); +GArchInstruction *_g_arch_processor_find_instr_by_address(GArchProcessor *, const vmpa2t *, bool); /* Recherche rapidement une instruction d'après son adresse. */ GArchInstruction *_g_arch_processor_find_covered_instr_by_address(const GArchProcessor *, const instr_coverage *, const vmpa2t *, bool); -#define g_arch_processor_find_instr_by_address(proc, addr) \ +#define g_arch_processor_find_instr_by_address(proc, addr) \ _g_arch_processor_find_instr_by_address(proc, addr, false) -#define g_arch_processor_find_covered_instr_by_address(proc, coverage, addr) \ - _g_arch_processor_find_covered_instr_by_address(proc, coverage, addr, false) - -/* Fournit l'instruction qui en précède une autre. */ -GArchInstruction *g_arch_processor_get_prev_instr(const GArchProcessor *, const GArchInstruction *); - -/* Fournit l'instruction qui en suit une autre. */ -GArchInstruction *g_arch_processor_get_next_instr(const GArchProcessor *, const GArchInstruction *); +#define g_arch_processor_find_covered_instr_by_address(proc, coverage, addr) \ + ({ \ + GArchInstruction *__result; \ + g_arch_processor_lock(proc); \ + __result = _g_arch_processor_find_covered_instr_by_address(proc, coverage, addr, false); \ + g_arch_processor_unlock(proc); \ + __result; \ + }) + +/* Met en place un itérateur d'instruction selon une adresse. */ +instr_iter_t *_g_arch_processor_get_iter_from_address(GArchProcessor *, const vmpa2t *, bool); + +/* Met en place un itérateur d'instruction selon une adresse. */ +instr_iter_t *_g_arch_processor_get_covered_iter_from_address(GArchProcessor *, const instr_coverage *, const vmpa2t *, bool); + +#define g_arch_processor_get_iter_from_address(proc, addr) \ + _g_arch_processor_get_iter_from_address(proc, addr, false) + +#define g_arch_processor_get_covered_iter_from_address(proc, coverage, addr) \ + ({ \ + instr_iter_t *__result; \ + g_arch_processor_lock(proc); \ + __result = _g_arch_processor_get_covered_iter_from_address(proc, coverage, addr, false); \ + g_arch_processor_unlock(proc); \ + __result; \ + }) |