diff options
-rw-r--r-- | plugins/androhelpers/params.c | 6 | ||||
-rw-r--r-- | plugins/androhelpers/switch.c | 6 | ||||
-rw-r--r-- | plugins/androhelpers/try_n_catch.c | 17 | ||||
-rw-r--r-- | plugins/dalvik/context.c | 8 | ||||
-rw-r--r-- | plugins/stackvars/stackvars.c | 7 | ||||
-rw-r--r-- | src/analysis/decomp/decompiler.c | 6 | ||||
-rw-r--r-- | src/analysis/decomp/il.c | 4 | ||||
-rw-r--r-- | src/analysis/routine.h | 21 |
8 files changed, 37 insertions, 38 deletions
diff --git a/plugins/androhelpers/params.c b/plugins/androhelpers/params.c index 26f4265..0c20c8d 100644 --- a/plugins/androhelpers/params.c +++ b/plugins/androhelpers/params.c @@ -131,6 +131,7 @@ static void process_args_operand(const GDexMethod *method, const GDalvikArgsOper static void visit_all_method_operands(const GDexMethod *method, GArchInstruction *instrs) { GBinRoutine *routine; /* Abstraction de la méthode */ + const mrange_t *range; /* Emplacement du symbole */ vmpa_t start; /* Début de la zone couverte */ vmpa_t end; /* Fin de la zone couverte */ GArchInstruction *iter; /* Boucle de parcours #1 */ @@ -139,9 +140,10 @@ static void visit_all_method_operands(const GDexMethod *method, GArchInstruction GArchOperand *operand; /* Operande à manipuler */ routine = g_dex_method_get_routine(method); + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); - start = g_binary_routine_get_address(routine); - end = start + g_binary_routine_get_size(routine); + start = get_mrange_addr(range)->virtual; + end = start + get_mrange_length(range); g_object_unref(G_OBJECT(routine)); diff --git a/plugins/androhelpers/switch.c b/plugins/androhelpers/switch.c index 2ef6277..57e3830 100644 --- a/plugins/androhelpers/switch.c +++ b/plugins/androhelpers/switch.c @@ -333,6 +333,7 @@ static void mark_all_switch_cases(const GArchInstruction *instr, const dex_switc static void look_for_switch_instructions(const GDexMethod *method, GArchInstruction *instrs, const GLoadedBinary *binary, const GDexFormat *format, bool link) { GBinRoutine *routine; /* Abstraction de la méthode */ + const mrange_t *range; /* Emplacement du symbole */ vmpa_t start; /* Début de la zone couverte */ vmpa_t end; /* Fin de la zone couverte */ GArchInstruction *iter; /* Boucle de parcours */ @@ -340,9 +341,10 @@ static void look_for_switch_instructions(const GDexMethod *method, GArchInstruct dex_switch dswitch; /* Infos d'aiguillage */ routine = g_dex_method_get_routine(method); + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); - start = g_binary_routine_get_address(routine); - end = start + g_binary_routine_get_size(routine); + start = get_mrange_addr(range)->virtual; + end = start + get_mrange_length(range); g_object_unref(G_OBJECT(routine)); diff --git a/plugins/androhelpers/try_n_catch.c b/plugins/androhelpers/try_n_catch.c index 1fa3971..811f8c5 100644 --- a/plugins/androhelpers/try_n_catch.c +++ b/plugins/androhelpers/try_n_catch.c @@ -80,13 +80,14 @@ static bool check_covered_area(const try_item *try, const GBinRoutine *routine) off_t length; /* Taille de la zone de code */ vmpa_t covered_start; /* Début de la zone couverte */ vmpa_t covered_end; /* Fin de la zone couverte */ - - length = g_binary_routine_get_size(routine); + const mrange_t *range; /* Emplacement du symbole */ covered_start = try->start_addr * sizeof(uint16_t); covered_end = covered_start + try->insn_count * sizeof(uint16_t); - return (covered_end <= length); + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); + + return (covered_end <= get_mrange_length(range)); } @@ -109,6 +110,7 @@ static bool check_covered_area(const try_item *try, const GBinRoutine *routine) static void attach_caught_code(const GLoadedBinary *binary, const GBinRoutine *routine, const try_item *try, const caught_exception *handlers, size_t count) { + const mrange_t *range; /* Emplacement du symbole */ vmpa_t start; /* Début de la zone couverte */ vmpa_t end; /* Fin de la zone couverte */ GArchProcessor *proc; /* Processeur de l'architecture*/ @@ -119,7 +121,9 @@ static void attach_caught_code(const GLoadedBinary *binary, const GBinRoutine *r GArchInstruction *iter; /* Boucle de parcours #1 */ size_t i; /* Boucle de parcours #2 */ - start = g_binary_routine_get_address(routine); + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); + + start = get_mrange_addr(range)->virtual; start += try->start_addr * sizeof(uint16_t); end = start + try->insn_count * sizeof(uint16_t); @@ -236,6 +240,7 @@ static void mark_exception_handlers(const GLoadedBinary *binary, uleb128_t size, static caught_exception **build_all_destinations_list(const GLoadedBinary *binary, const GBinRoutine *routine, const encoded_catch_handler_list *hlist, size_t **count) { + const mrange_t *range; /* Emplacement du symbole */ caught_exception **result; /* Liste de listes à retourner */ vmpa_t start; /* Début du code de la routine */ GDexFormat *format; /* Format du binaire chargé */ @@ -248,7 +253,9 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar caught_exception *excep; /* Raccourci confortable */ GDataType *type; /* Type de l'exception */ - start = g_binary_routine_get_address(routine); + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); + + start = get_mrange_addr(range)->virtual; format = G_DEX_FORMAT(g_loaded_binary_get_format(binary)); diff --git a/plugins/dalvik/context.c b/plugins/dalvik/context.c index 752e831..70cbee5 100644 --- a/plugins/dalvik/context.c +++ b/plugins/dalvik/context.c @@ -664,14 +664,16 @@ static void g_dalvik_context_spread_allocated_shared_reg(GDalvikDContext *ctx, G { GDexFormat *format; /* Recherche de méthode */ GBinRoutine *routine; /* Objet des recherches */ + const mrange_t *range; /* Emplacement du symbole */ GDexMethod *method; /* Méthode décompilée */ uint16_t index; /* Identifiant du registre */ DexVariableIndex info; /* Nature du registre */ format = G_DEX_FORMAT(G_DEC_CONTEXT(ctx)->format); routine = G_DEC_CONTEXT(ctx)->routine; + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); - method = g_dex_format_find_method_by_address(format, g_binary_routine_get_address(routine)); + method = g_dex_format_find_method_by_address(format, get_mrange_addr(range)); index = g_dalvik_register_get_index(reg); info = g_dex_method_get_variable(method, index); @@ -703,6 +705,7 @@ static GDecInstruction *g_dalvik_dcontext_convert_register(GDalvikDContext *ctx, GDecInstruction *result; /* Instance à retourner */ GDexFormat *format; /* Recherche de méthode */ GBinRoutine *routine; /* Objet des recherches */ + const mrange_t *range; /* Emplacement du symbole */ GDexMethod *method; /* Méthode décompilée */ const GDalvikRegister *reg; /* Registre Dalvik représenté */ uint16_t index; /* Identifiant du registre */ @@ -712,8 +715,9 @@ static GDecInstruction *g_dalvik_dcontext_convert_register(GDalvikDContext *ctx, format = G_DEX_FORMAT(G_DEC_CONTEXT(ctx)->format); routine = G_DEC_CONTEXT(ctx)->routine; + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); - method = g_dex_format_find_method_by_address(format, g_binary_routine_get_address(routine)); + method = g_dex_format_find_method_by_address(format, get_mrange_addr(range)); reg = g_dalvik_register_operand_get(operand); diff --git a/plugins/stackvars/stackvars.c b/plugins/stackvars/stackvars.c index 87ecf05..b440348 100644 --- a/plugins/stackvars/stackvars.c +++ b/plugins/stackvars/stackvars.c @@ -139,6 +139,7 @@ G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *binary, PluginActio static bool replace_stack_vars_in_routine(GBinRoutine *routine, GRenderingLine *lines) { bool result; /* Bilan à retourner */ + const mrange_t *range; /* Emplacement du symbole */ vmpa_t start; /* Adresse de début de routine */ vmpa_t end; /* Adresse de fin de routine */ GRenderingLine *iter; /* Boucle de parcours */ @@ -146,8 +147,10 @@ static bool replace_stack_vars_in_routine(GBinRoutine *routine, GRenderingLine * result = false; - start = g_binary_routine_get_address(routine); - end = start + g_binary_routine_get_size(routine); + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); + + start = get_mrange_addr(range)->virtual; + end = start + get_mrange_length(range); for (iter = g_rendering_line_find_by_address(lines, NULL, start); iter != NULL && get_rendering_line_address(iter) < end; diff --git a/src/analysis/decomp/decompiler.c b/src/analysis/decomp/decompiler.c index 432e924..03d2b70 100644 --- a/src/analysis/decomp/decompiler.c +++ b/src/analysis/decomp/decompiler.c @@ -169,8 +169,8 @@ static void prepare_all_routines_for_decomp(const GLoadedBinary *binary, const c /* instrs = g_binary_routine_get_instructions(routines[i]); - max = g_binary_routine_get_address(routines[i]) - + g_binary_routine_get_size(routines[i]); + max = g_XXX_binary_routine_get_address(routines[i]) + + g_XXX_binary_routine_get_size(routines[i]); */ //printf("\n##### DECOMPILE '%s' #####\n", g_binary_routine_to_string(routines[i])); @@ -179,7 +179,7 @@ static void prepare_all_routines_for_decomp(const GLoadedBinary *binary, const c /* dinstrs = build_decompiled_block(instrs, - g_binary_routine_get_address(routines[i]), + g_XXX_binary_routine_get_address(routines[i]), max, VMPA_MAX, context); */ diff --git a/src/analysis/decomp/il.c b/src/analysis/decomp/il.c index c125412..5827c4b 100644 --- a/src/analysis/decomp/il.c +++ b/src/analysis/decomp/il.c @@ -485,13 +485,15 @@ GDecInstruction *decompiled_routine_instructions(GBinRoutine *routine, GExeForma GDecInstruction *result; /* Instructions à retourner */ GDecContext *context; /* Contexte pour la décompil. */ GInstrBlock *blocks; /* Blocs basiques de routine */ + const mrange_t *range; /* Emplacement du symbole */ context = g_arch_processor_get_decomp_context(proc); g_dec_context_set_info(context, routine, format); blocks = g_binary_routine_get_basic_blocks(routine); - setup_awaited_regs_allocation(blocks, g_binary_routine_get_address(routine)); + range = g_binary_symbol_get_range(G_BIN_SYMBOL(routine)); + setup_awaited_regs_allocation(blocks, get_mrange_addr(range)->physical); result = decompiled_basic_block(blocks, context); diff --git a/src/analysis/routine.h b/src/analysis/routine.h index 7a836cf..e364c93 100644 --- a/src/analysis/routine.h +++ b/src/analysis/routine.h @@ -82,27 +82,6 @@ GBinRoutine *g_binary_routine_new(void); /* Crée une représentation de routine construisant une instance. */ GBinRoutine *g_binary_routine_new_constructor(GDataType *); -/* Définit la couverture physique / en mémoire d'une routine. */ -void g_binary_routine_set_range(GBinRoutine *, const mrange_t *); - -/* Fournit la couverture physique / en mémoire d'une routine. */ -const mrange_t *g_binary_routine_get_range(const GBinRoutine *); - - - -/* Fournit la position physique / en mémoire d'une routine. */ -//const vmpa2t *g_binary_routine_get_address(const GBinRoutine *); -#define g_binary_routine_get_address(r) 0 - -/* Définit la taille du code d'une routine. */ -void g_binary_routine_set_size(GBinRoutine *, off_t); - -/* Fournit la taille du code associé à une routine. */ -//off_t g_binary_routine_get_size(const GBinRoutine *); -#define g_binary_routine_get_size(r) 0 - - - /* Définit le type d'une routine. */ void g_binary_routine_set_type(GBinRoutine *, RoutineType); |