diff options
Diffstat (limited to 'src/analysis/disass')
-rw-r--r-- | src/analysis/disass/output.c | 27 | ||||
-rw-r--r-- | src/analysis/disass/routines.c | 7 |
2 files changed, 24 insertions, 10 deletions
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 8e74d1c..f9656cf 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -81,6 +81,7 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, GBorderGenerator *border; /* Délimitation de routine */ const vmpa2t *paddr; /* Adresse de portion */ GLineGenerator *generator; /* Générateur de contenu ajouté*/ + SymbolStatus sym_status; /* Visibilité du symbole obtenu*/ const vmpa2t *saddr; /* Adresse de symbole */ int compared; /* Bilan d'une comparaison */ char *errmsg; /* Description d'une erreur */ @@ -210,13 +211,21 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, else { iaddr = get_mrange_addr(g_arch_instruction_get_range(instr)); - saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index])); - /* On écarte les symboles qu'on ne sait pas réintroduire */ - for (compared = cmp_vmpa(iaddr, saddr); - compared > 0; - compared = cmp_vmpa(iaddr, saddr)) + for ( ; sym_index < sym_count; sym_index++) { + sym_status = g_binary_symbol_get_status(symbols[sym_index]); + + if (sym_status == SSS_IMPORTED) + continue; + + saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index])); + + compared = cmp_vmpa(iaddr, saddr); + + if (compared <= 0) + break; + log_variadic_message(LMT_BAD_BINARY, _("Unable to find a proper location for symbol '%s' @ 0x%08x"), g_binary_symbol_get_label(symbols[sym_index]), get_phy_addr(saddr)); @@ -230,13 +239,11 @@ void print_disassembled_instructions(GBufferCache *cache, GCodingLanguage *lang, _missing++; - if (++sym_index == sym_count) - goto no_more_symbol_finally; - - saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index])); - } + if (sym_index == sym_count) + goto no_more_symbol_finally; + if (compared == 0) { /* Coupure pour une nouvelle routine */ diff --git a/src/analysis/disass/routines.c b/src/analysis/disass/routines.c index 01a6e48..63a32cf 100644 --- a/src/analysis/disass/routines.c +++ b/src/analysis/disass/routines.c @@ -233,11 +233,18 @@ static void g_routines_study_process(GRoutinesStudy *study, GtkStatusStack *stat { size_t i; /* Boucle de parcours */ GBinSymbol *symbol; /* Commodité d'accès */ + SymbolStatus sym_status; /* Visibilité du symbole obtenu*/ SymbolType type; /* Type de symbole rencontré */ for (i = study->begin; i < study->end; i++) { symbol = study->symbols[i]; + + sym_status = g_binary_symbol_get_status(symbol); + + if (sym_status == SSS_IMPORTED) + continue; + type = g_binary_symbol_get_target_type(symbol); if (type == STP_ROUTINE || type == STP_ENTRY_POINT) |