diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-11-28 09:43:50 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-11-28 09:43:50 (GMT) |
commit | f95598b68b98f6eda701f8f02bc09cb13f65fc72 (patch) | |
tree | eefee33963448a1ce53a7eb80dacabbcdce8fc21 /src/arch/dalvik/decomp/invoke.c | |
parent | fbb4b6f53d2189ba9f61c1fd149534d8aef82dcd (diff) |
Followed the excution flow to decompile instructions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@293 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/dalvik/decomp/invoke.c')
-rw-r--r-- | src/arch/dalvik/decomp/invoke.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/arch/dalvik/decomp/invoke.c b/src/arch/dalvik/decomp/invoke.c index c3650b4..6f863be 100644 --- a/src/arch/dalvik/decomp/invoke.c +++ b/src/arch/dalvik/decomp/invoke.c @@ -144,6 +144,66 @@ GDecInstruction *dalvik_decomp_instr_invoke_direct(const GArchInstruction *instr * Paramètres : instr = instruction d'origine à convertir. * * ctx = contexte de la phase de décompilation. * * * +* Description : Décompile une instruction de type 'invoke-static'. * +* * +* Retour : Instruction mise en place ou NULL. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GDecInstruction *dalvik_decomp_instr_invoke_static(const GArchInstruction *instr, GDecContext *ctx) +{ + GDecInstruction *result; /* Instruction à retourner */ + size_t count; /* Quantité d'opérandes */ + GArchOperand *operand; /* Opérande de l'instruction */ + uint32_t index; /* Indice de l'élément visé */ + GDexFormat *format; /* Accès aux constantes */ + GBinRoutine *routine; /* Routine visée par l'appel */ + GDecInstruction *call; /* Représentation de l'appel */ + size_t i; /* Boucle de parcours #2 */ + GArchOperand *arg; /* Argument brut de l'appel */ + GDecInstruction *reg; /* Argument converti */ + + result = NULL; + + /* Récupération de la méthode */ + + count = g_arch_instruction_count_operands(instr); + operand = g_arch_instruction_get_operand(instr, count - 1); + + index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(operand)); + + format = G_DEX_FORMAT(g_object_get_data(G_OBJECT(ctx), "format")); + routine = get_routine_from_dex_pool(format, index); + if (routine == NULL) return NULL; + + call = g_routine_call_new(routine); + + /* Ajout des arguments */ + + operand = g_arch_instruction_get_operand(instr, 0); + count = g_dalvik_args_count(G_DALVIK_ARGS_OPERAND(operand)); + + for (i = 0; i < count; i++) + { + arg = g_dalvik_args_operand_get(G_DALVIK_ARGS_OPERAND(operand), i); + reg = g_dec_context_convert_register(ctx, arg, false); + + g_routine_call_add_arg(G_ROUTINE_CALL(call), reg); + + } + + return call; + +} + + +/****************************************************************************** +* * +* Paramètres : instr = instruction d'origine à convertir. * +* ctx = contexte de la phase de décompilation. * +* * * Description : Décompile une instruction de type 'invoke-virtual'. * * * * Retour : Instruction mise en place ou NULL. * |