diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-12-15 13:40:28 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-12-15 13:40:28 (GMT) |
commit | 124c8410dbfcad59d66b850c50c96ec73a607ab7 (patch) | |
tree | b7127c66abfccd11b9126741e2809a893ee44143 /src/analysis/disass/instructions.c | |
parent | db1a6171007a6641a4659392c9bcc05670396643 (diff) |
Defined proper accesses to instructions loaded by a processor.
Diffstat (limited to 'src/analysis/disass/instructions.c')
-rw-r--r-- | src/analysis/disass/instructions.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/analysis/disass/instructions.c b/src/analysis/disass/instructions.c index 799d196..d83536d 100644 --- a/src/analysis/disass/instructions.c +++ b/src/analysis/disass/instructions.c @@ -251,10 +251,16 @@ void g_instructions_study_do_link_operation(GInstructionsStudy *study, size_t in { GArchInstruction *instr; /* Instruction en traitement */ - instr = g_arch_processor_get_disassembled_instruction(study->proc, index); + g_arch_processor_lock(study->proc); + + instr = g_arch_processor_get_instruction(study->proc, index); + + g_arch_processor_unlock(study->proc); g_arch_instruction_call_hook(instr, IPH_LINK, study->proc, study->ctx, study->format); + g_object_unref(G_OBJECT(instr)); + } @@ -275,10 +281,16 @@ void g_instructions_study_do_post_operation(GInstructionsStudy *study, size_t in { GArchInstruction *instr; /* Instruction en traitement */ - instr = g_arch_processor_get_disassembled_instruction(study->proc, index); + g_arch_processor_lock(study->proc); + + instr = g_arch_processor_get_instruction(study->proc, index); + + g_arch_processor_unlock(study->proc); g_arch_instruction_call_hook(instr, IPH_POST, study->proc, study->ctx, study->format); + g_object_unref(G_OBJECT(instr)); + } @@ -300,16 +312,28 @@ void g_instructions_study_establish_links(GInstructionsStudy *study, size_t inde GArchInstruction *instr; /* Instruction en traitement */ GArchInstruction *prev; /* Instruction précédente */ - instr = g_arch_processor_get_disassembled_instruction(study->proc, index); + g_arch_processor_lock(study->proc); + + instr = g_arch_processor_get_instruction(study->proc, index); + + g_arch_processor_unlock(study->proc); if (index > 0) { - prev = g_arch_processor_get_disassembled_instruction(study->proc, index - 1); + g_arch_processor_lock(study->proc); + + prev = g_arch_processor_get_instruction(study->proc, index - 1); + + g_arch_processor_unlock(study->proc); establish_natural_link(instr, prev); + g_object_unref(G_OBJECT(prev)); + } establish_links_for_instruction(instr, G_BIN_FORMAT(study->format), study->proc); + g_object_unref(G_OBJECT(instr)); + } |