diff options
Diffstat (limited to 'src/analysis/disass')
-rw-r--r-- | src/analysis/disass/output.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 355d458..f1e8a3b 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -24,10 +24,14 @@ #include "output.h" +#include <i18n.h> + + #include "../../arch/processor.h" #include "../../common/extstr.h" #include "../../decomp/lang/asm.h" #include "../../format/format.h" +#include "../../gui/panels/log.h" @@ -80,6 +84,7 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form const vmpa2t *paddr; /* Adresse de portion */ + int compared; /* Bilan d'une comparaison */ const char *label; /* Etiquette ciblant un symbole*/ @@ -178,16 +183,32 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index])); - printf("OUTPUT [%zu] :: 0x%08x - 0x%08x :: 0x%08x - 0x%08x '%s'\n", + printf("OUTPUT [%zu] :: (instr) 0x%08x - 0x%08x :: (sym) 0x%08x - 0x%08x '%s' (cmp=%d)\n", sym_index, (unsigned int)get_phy_addr(iaddr), (unsigned int)get_virt_addr(iaddr), (unsigned int)get_phy_addr(saddr), (unsigned int)get_virt_addr(saddr), - g_binary_symbol_to_string(symbols[sym_index])); + g_binary_symbol_to_string(symbols[sym_index]), + cmp_vmpa(iaddr, saddr)); - if (cmp_vmpa_by_virt(iaddr, saddr) == 0) + /* On écarte les symboles qu'on ne sait pas réintroduire */ + for (compared = cmp_vmpa(iaddr, saddr); + compared > 0; + compared = cmp_vmpa(iaddr, saddr)) + { + log_variadic_message(LMT_BAD_BINARY, _("Unable to find a proper location for symbol '%s'"), + g_binary_symbol_to_string(symbols[sym_index])); + + if (++sym_index == sym_count) + goto no_more_symbol_finally; + + saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index])); + + } + + if (compared == 0) { /* Etiquette ? */ @@ -209,8 +230,7 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form } - - + no_more_symbol_finally: @@ -221,16 +241,7 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form iaddr = get_mrange_addr(g_arch_instruction_get_range(iter)); saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index])); - /* - if (saddr->virtual == 0x8590) - { - printf("instr = 0x%08x sym = 0x%08x\n", iaddr->virtual, saddr->virtual); - printf("COMP :: %d\n", cmp_vmpa_by_virt(iaddr, saddr)); - if (cmp_vmpa_by_virt(iaddr, saddr) == 0) exit(0); - } - */ - - if (cmp_vmpa_by_virt(iaddr, saddr) == 0) + if (cmp_vmpa(iaddr, saddr) == 0) { /* Point d'entrée ? */ |