diff options
Diffstat (limited to 'src/format')
-rw-r--r-- | src/format/dex/method.c | 5 | ||||
-rw-r--r-- | src/format/format.c | 24 |
2 files changed, 13 insertions, 16 deletions
diff --git a/src/format/dex/method.c b/src/format/dex/method.c index cca03a7..233ecb1 100644 --- a/src/format/dex/method.c +++ b/src/format/dex/method.c @@ -147,9 +147,14 @@ GDexMethod *g_dex_method_new(const GDexFormat *format, const encoded_method *see result->info = *seed; result->body = item; + printf(" ==== %s ====\n", g_binary_routine_get_name(routine)); + //printf(" method idx :: %d\n", seed->method_idx_diff); //printf(" code size :: %d\n", item.insns_size); + printf(" code regs :: %d\n", item.registers_size); + printf(" code ins :: %d\n", item.ins_size); + printf(" code outs :: %d\n", item.outs_size); //printf(" method idx :: %lld\n", *last); diff --git a/src/format/format.c b/src/format/format.c index 1a52e1e..930d8db 100644 --- a/src/format/format.c +++ b/src/format/format.c @@ -288,6 +288,7 @@ GDecInstruction *g_binary_format_decompile_routine(const GBinFormat *format, GBi vmpa_t max; /* Première adresse à écarter */ GDecContext *ctx; /* Contexte de décompilation */ GArchInstruction *iter; /* Boucle de parcours */ + GDecInstruction *first; /* Première décompilation */ GDecInstruction *dinstr; /* Nouvelle décompilation */ result = NULL; @@ -296,10 +297,6 @@ GDecInstruction *g_binary_format_decompile_routine(const GBinFormat *format, GBi max = g_binary_routine_get_address(routine) + g_binary_routine_get_size(routine); - printf("max :: 0x%08llx\n", max); - - //max = 0x00000a98ll; /* FIXME !!!! */ - ctx = g_dec_context_new(); g_object_set_data(G_OBJECT(ctx), "format", format); g_dec_context_set_max_address(ctx, max); @@ -308,25 +305,20 @@ GDecInstruction *g_binary_format_decompile_routine(const GBinFormat *format, GBi iter != NULL; iter = g_arch_instruction_get_next_iter(instr, iter, max)) { + g_arch_instruction_decompile(iter, ctx); + } + first = g_dec_context_get_decomp_instrs(ctx); - printf("DECOMP isntr :: %p\n", iter); - - - dinstr = g_arch_instruction_decompile(iter, ctx); - if (dinstr == NULL) continue; - - printf(" -> done :: %p\n", dinstr); - + for (dinstr = first; + dinstr != NULL; + dinstr = g_dec_instruction_get_next_iter(first, dinstr)) + { if (result == NULL) result = g_expr_block_new(dinstr); else g_expr_block_add_item(G_EXPR_BLOCK(result), dinstr); } - - - - g_binary_routine_set_decomp_instructions(routine, result); return result; |