diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2010-11-11 01:22:43 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2010-11-11 01:22:43 (GMT) |
commit | b33a52031c0d44a79604bc8d9036c30bffd020cb (patch) | |
tree | c825e3330684ca57f7c423328cd116b2d6ec0f6a /src/arch/instruction.c | |
parent | 828124e38d266e382bb1477ef51c9fac8e81c591 (diff) |
Built some expressions for the decompilation tree.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@190 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/instruction.c')
-rw-r--r-- | src/arch/instruction.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/arch/instruction.c b/src/arch/instruction.c index b642219..dd43e14 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -306,9 +306,9 @@ size_t g_arch_instruction_count_operands(const GArchInstruction *instr) * * ******************************************************************************/ -const GArchOperand *g_arch_instruction_get_operand(GArchInstruction *instr, size_t index) +GArchOperand *g_arch_instruction_get_operand(const GArchInstruction *instr, size_t index) { - const GArchOperand *result; /* Opérande à retourner */ + GArchOperand *result; /* Opérande à retourner */ if (index >= instr->operands_count) result = NULL; else result = instr->operands[index]; @@ -463,6 +463,33 @@ bool g_arch_instruction_is_return(const GArchInstruction *instr) } +/****************************************************************************** +* * +* Paramètres : instr = instruction d'origine à convertir. * +* ctx = contexte de la phase de décompilation. * +* * +* Description : Décompile une instruction de façon générique. * +* * +* Retour : Instruction mise en place ou NULL. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GDecInstruction *g_arch_instruction_decompile(const GArchInstruction *instr, GDecContext *ctx) +{ + GDecInstruction *result; /* Instruction à retourner */ + + if (instr->decomp != NULL) + result = instr->decomp(instr, ctx); + + else + result = NULL; + + return result; + +} + /* ---------------------------------------------------------------------------------- */ /* TRAITEMENT DES INSTRUCTIONS PAR ENSEMBLE */ |