diff options
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/arm/v7/post.c | 11 | ||||
-rw-r--r-- | src/arch/dalvik/link.c | 1 | ||||
-rw-r--r-- | src/arch/dalvik/operands/pool.c | 2 | ||||
-rw-r--r-- | src/arch/post.c | 20 | ||||
-rw-r--r-- | src/arch/target.c | 10 |
5 files changed, 18 insertions, 26 deletions
diff --git a/src/arch/arm/v7/post.c b/src/arch/arm/v7/post.c index 4600700..415b278 100644 --- a/src/arch/arm/v7/post.c +++ b/src/arch/arm/v7/post.c @@ -53,7 +53,6 @@ void post_process_ldr_instructions(GArchInstruction *instr, GArchProcessor *proc mrange_t trange; /* Etendue du symbole à créer */ VMPA_BUFFER(loc); /* Espace pour une conversion */ char name[5 + VMPA_MAX_LEN]; /* Etiquette à constituer */ - GBinRoutine *routine; /* Nouvelle routine trouvée */ GBinSymbol *symbol; /* Nouveau symbole construit */ g_arch_instruction_lock_operands(instr); @@ -79,14 +78,8 @@ void post_process_ldr_instructions(GArchInstruction *instr, GArchProcessor *proc vmpa2_virt_to_string(&target, MDS_UNDEFINED, loc, NULL); snprintf(name, sizeof(name), "loc_%s", loc + 2); - routine = g_binary_routine_new(); - g_binary_routine_set_name(routine, strdup(name)); - //routine = try_to_demangle_routine(name); - - g_binary_routine_set_range(routine, &trange); - - symbol = g_binary_symbol_new(STP_CODE_LABEL); - g_binary_symbol_attach_routine(symbol, routine); + symbol = g_binary_symbol_new(&trange, STP_CODE_LABEL); + g_binary_symbol_set_alt_label(symbol, name); g_binary_format_add_symbol(bfmt, symbol); g_target_operand_resolve(&new, bfmt, true, NULL); diff --git a/src/arch/dalvik/link.c b/src/arch/dalvik/link.c index d1404d0..6508b03 100644 --- a/src/arch/dalvik/link.c +++ b/src/arch/dalvik/link.c @@ -35,6 +35,7 @@ #include "pseudo/switch.h" #include "../target.h" +#include "../../analysis/db/items/comment.h" #include "../../common/extstr.h" diff --git a/src/arch/dalvik/operands/pool.c b/src/arch/dalvik/operands/pool.c index a450ffe..fa7ed54 100644 --- a/src/arch/dalvik/operands/pool.c +++ b/src/arch/dalvik/operands/pool.c @@ -340,7 +340,7 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBuff case DPT_STRING: - string = get_string_from_dex_pool(operand->format, operand->index); + string = get_string_from_dex_pool(operand->format, operand->index, NULL); if (string != NULL) { diff --git a/src/arch/post.c b/src/arch/post.c index 1463709..f8864aa 100644 --- a/src/arch/post.c +++ b/src/arch/post.c @@ -29,6 +29,7 @@ #include "processor.h" #include "target.h" +#include "../analysis/routine.h" @@ -79,16 +80,27 @@ void post_process_target_resolution(GArchInstruction *instr, GArchProcessor *pro if (!g_target_operand_resolve(&new, bfmt, true, NULL)) { + init_mrange(&trange, &target, 0); + vmpa2_to_string(&target, MDS_UNDEFINED, loc, NULL); switch (type) { case STP_ROUTINE: snprintf(name, sizeof(name), "sub_%s", loc + 2); + + routine = g_binary_routine_new(); + symbol = G_BIN_SYMBOL(routine); + + g_binary_symbol_set_range(symbol, &trange); + g_binary_routine_set_name(routine, strdup(name)); break; case STP_CODE_LABEL: snprintf(name, sizeof(name), "loc_%s", loc + 2); + + symbol = g_binary_symbol_new(&trange, type); + g_binary_symbol_set_alt_label(symbol, name); break; default: @@ -97,14 +109,6 @@ void post_process_target_resolution(GArchInstruction *instr, GArchProcessor *pro } - routine = g_binary_routine_new(); - g_binary_routine_set_name(routine, strdup(name)); - - init_mrange(&trange, &target, 0); - g_binary_routine_set_range(routine, &trange); - - symbol = g_binary_symbol_new(type); - g_binary_symbol_attach_routine(symbol, routine); g_binary_format_add_symbol(bfmt, symbol); g_target_operand_resolve(&new, bfmt, true, NULL); diff --git a/src/arch/target.c b/src/arch/target.c index a863d69..056ace3 100644 --- a/src/arch/target.c +++ b/src/arch/target.c @@ -34,6 +34,7 @@ #include "operand-int.h" #include "sharing/manager.h" +#include "../analysis/routine.h" #include "../common/extstr.h" #include "../format/format.h" @@ -433,7 +434,6 @@ static char *g_target_operand_build_tooltip(const GTargetOperand *operand, const { char *result; /* Description à retourner */ SymbolType stype; /* Type de symbole identifié */ - GBinRoutine *routine; /* Routine à manipuler */ const mrange_t *srange; /* Emplacement du symbole */ GBufferCache *cache; /* Tampon de désassemblage */ size_t index; /* Indice de ligne à traiter */ @@ -449,13 +449,7 @@ static char *g_target_operand_build_tooltip(const GTargetOperand *operand, const { case STP_ROUTINE: case STP_ENTRY_POINT: - - routine = g_binary_symbol_get_routine(operand->symbol); - - result = g_binary_routine_build_tooltip(routine, binary); - - //g_object_unref(G_OBJECT(routine)); // TODO - + result = g_binary_routine_build_tooltip(G_BIN_ROUTINE(operand->symbol), binary); break; case STP_STRING: |