diff options
Diffstat (limited to 'plugins/dalvik/link.c')
-rw-r--r-- | plugins/dalvik/link.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/plugins/dalvik/link.c b/plugins/dalvik/link.c index 8e34485..3b5d43e 100644 --- a/plugins/dalvik/link.c +++ b/plugins/dalvik/link.c @@ -374,3 +374,72 @@ void handle_dalvik_packed_switch_links(GArchInstruction *instr, GArchProcessor * } } + + +/****************************************************************************** +* * +* Paramètres : instr = instruction ARMv7 à traiter. * +* proc = représentation de l'architecture utilisée. * +* context = contexte associé à la phase de désassemblage. * +* format = acès aux données du binaire d'origine. * +* * +* Description : Etablit une référence entre appelant et appelé. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void handle_links_between_caller_and_callee(GArchInstruction *instr, GArchProcessor *proc, GProcContext *context, GExeFormat *format) +{ + GArchOperand *op; /* Opérande numérique en place */ + uint32_t index; /* Indice dans la table Dex */ + GDexMethod *method; /* Méthode ciblée ici */ + GBinRoutine *routine; /* Routine liée à la méthode */ + const mrange_t *range; /* Zone d'occupation */ + GArchInstruction *target; /* Ligne visée par la référence*/ + + g_arch_instruction_lock_operands(instr); + + assert(_g_arch_instruction_count_operands(instr) == 2); + + op = _g_arch_instruction_get_operand(instr, 1); + + g_arch_instruction_unlock_operands(instr); + + assert(G_IS_DALVIK_POOL_OPERAND(op)); + + assert(g_dalvik_pool_operand_get_pool_type(G_DALVIK_POOL_OPERAND(op)) == DPT_METHOD); + + index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(op)); + + method = get_method_from_dex_pool(G_DEX_FORMAT(format), index); + + if (method != NULL) + { + routine = g_dex_method_get_routine(method); + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); + + if (range->addr.physical > 0) + { + target = g_arch_processor_find_instr_by_address(proc, get_mrange_addr(range)); + + if (target != NULL) + { + g_arch_instruction_link_with(instr, target, ILT_REF); + + g_object_unref(G_OBJECT(target)); + + } + + } + + g_object_unref(G_OBJECT(routine)); + g_object_unref(G_OBJECT(method)); + + } + + g_object_unref(G_OBJECT(op)); + +} |