diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-09-17 21:36:49 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-09-17 21:36:49 (GMT) |
commit | 65768127dea4c2760fe07cf843da7b4ad9e67da5 (patch) | |
tree | d0023eb7f378a4118fd074f3f61d5eae02e0882b /src/analysis/disass | |
parent | af083f8bd6da340214ae392451dde5782fb79039 (diff) |
Introduced memory ranges.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@406 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/disass')
-rw-r--r-- | src/analysis/disass/fetch.c | 16 | ||||
-rw-r--r-- | src/analysis/disass/limit.c | 2 | ||||
-rw-r--r-- | src/analysis/disass/output.c | 14 |
3 files changed, 26 insertions, 6 deletions
diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c index 55ea1d4..763b37a 100644 --- a/src/analysis/disass/fetch.c +++ b/src/analysis/disass/fetch.c @@ -70,6 +70,7 @@ GArchInstruction *load_raw_binary(const GLoadedBinary *binary, const vmpa2t *bas off_t old_phy; /* Ancienne position physique */ GArchInstruction *instr; /* Instruction décodée */ off_t new_phy; /* Nouvelle position physique */ + mrange_t range; /* Couverture de l'instruction */ result = NULL; @@ -90,8 +91,10 @@ GArchInstruction *load_raw_binary(const GLoadedBinary *binary, const vmpa2t *bas if (instr == NULL) break; new_phy = get_phy_addr(&pos); + init_mrange(&range, &prev, new_phy - old_phy); + + g_arch_instruction_set_range(instr, &range); - g_arch_instruction_set_location(instr, &prev, new_phy - old_phy); g_arch_instruction_add_to_list(&result, instr); copy_vmpa(&prev, &pos); @@ -146,7 +149,7 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt size_t i; /* Boucle de parcours */ - + const mrange_t *range; /* Couverture d'un symbole */ const vmpa2t *border; /* Nouvelle bordure rencontrée */ off_t length; /* Taille d'une partie traitée */ @@ -183,7 +186,14 @@ GArchInstruction *disassemble_binary_content(const GLoadedBinary *binary, GtkExt - border = g_binary_symbol_get_location(symbols[i], &length); + + range = g_binary_symbol_get_range(symbols[i]); + + border = get_mrange_addr(range); + length = get_mrange_length(range); + + + switch (g_binary_symbol_get_target_type(symbols[i])) { diff --git a/src/analysis/disass/limit.c b/src/analysis/disass/limit.c index 8501251..6d5bc35 100644 --- a/src/analysis/disass/limit.c +++ b/src/analysis/disass/limit.c @@ -87,7 +87,7 @@ void limit_all_routines(GArchInstruction *list, GBinRoutine **routines, size_t c lengths[i] = find_best_ending_address_for_routine(instr, i, starts, lengths, count); lengths[i] -= starts[i]; - g_binary_routine_set_size(routines[i], lengths[i]); + /////////g_binary_routine_set_size(routines[i], lengths[i]); lar_next: diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index f368796..a6d7845 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -55,8 +55,14 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form GArchProcessor *proc; /* Architecture du binaire */ MemoryDataSize msize; /* Taille du bus d'adresses */ const bin_t *content; /* Contenu binaire global */ + +#if 0 + const mrange_t *range; /* Cou + vmpa_t start; /* Adresse de départ */ vmpa_t end; /* Adresse de fin */ +#endif + const GArchInstruction *iter; /* Boucle de parcours #1 */ size_t i; /* Boucle de parcours #2 */ const vmpa2t *iaddr; /* Adresse d'instruction */ @@ -100,9 +106,13 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form content = g_binary_format_get_content(G_BIN_FORMAT(format), NULL); +#if 0 g_arch_instruction_get_location(instrs, NULL, NULL, &start); + start = + iter = g_arch_instruction_find_last(instrs); g_arch_instruction_get_location(iter, NULL, NULL, &end); +#endif for (iter = instrs, i = 0; iter != NULL; @@ -129,8 +139,8 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form if (sym_index < sym_count) { - iaddr = g_arch_instruction_get_location2(iter, NULL); - saddr = g_binary_symbol_get_location(symbols[sym_index], NULL); + iaddr = get_mrange_addr(g_arch_instruction_get_range(iter)); + saddr = get_mrange_addr(g_binary_symbol_get_range(symbols[sym_index])); if (cmp_vmpa_by_phy(iaddr, saddr) == 0) { |