summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-03-11 13:06:06 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-03-11 13:06:06 (GMT)
commit5f64b12f3359e5f2c923fb35d330cec4cb0f4a30 (patch)
treedc84ed05c4f43f240642e4efff50e78e4f35440a /src/analysis/disass
parent3a616243218104788fad9c1a3a9307c7972a461f (diff)
Loaded the ELF header at a proper virtual address.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@488 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/output.c41
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 ? */