diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-01-02 22:09:09 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-01-02 22:09:09 (GMT) |
commit | 2f0c162313fa7272bfec7eb674b71e5e15c4ec7c (patch) | |
tree | ee6b7b25ebd83b709cb7644edb660f94d38e0f1f /src/analysis/disass | |
parent | 836e4ca6053594ceba7b78b8407d8a1f03491cd2 (diff) |
Unlinked instructions to save memory.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r-- | src/analysis/disass/area.c | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c index e57e2e0..a22f65a 100644 --- a/src/analysis/disass/area.c +++ b/src/analysis/disass/area.c @@ -861,8 +861,7 @@ mem_area *find_memory_area_by_addr(mem_area *list, size_t count, const vmpa2t *a void insert_extra_symbol_into_mem_areas(mem_area *areas, size_t count, const GBinSymbol *symbol) { SymbolType type; /* Type de symbole */ - GArchInstruction *list; /* Ensemble à insérer */ - GArchInstruction *iter; /* Boucle de parcours */ + GArchInstruction *instr; /* Instruction à insérer */ const mrange_t *range; /* Emplacement d'instruction */ const vmpa2t *addr; /* Départ de cet emplacement */ mem_area *area; /* Zone d'accueil désignée */ @@ -874,46 +873,42 @@ void insert_extra_symbol_into_mem_areas(mem_area *areas, size_t count, const GBi if (!HAS_DATA_INSTR(type)) return; - list = g_binary_symbol_get_instruction(symbol); + instr = g_binary_symbol_get_instruction(symbol); - for (iter = list; iter != NULL; iter = g_arch_instruction_get_next_iter(list, iter, ~0)) - { - range = g_arch_instruction_get_range(iter); - addr = get_mrange_addr(range); - - /* Une aire d'accueil existe-t-elle ? */ + range = g_arch_instruction_get_range(instr); + addr = get_mrange_addr(range); - area = find_memory_area_by_addr(areas, count, addr); + /* Une aire d'accueil existe-t-elle ? */ - if (area == NULL) - { - vmpa2_virt_to_string(addr, MDS_UNDEFINED, loc, NULL); + area = find_memory_area_by_addr(areas, count, addr); - log_variadic_message(LMT_WARNING, _("No place found for symbol located at %s."), loc); - continue; + if (area == NULL) + { + vmpa2_virt_to_string(addr, MDS_UNDEFINED, loc, NULL); - } + log_variadic_message(LMT_WARNING, _("No place found for symbol located at %s."), loc); + return; - /* L'instruction est-elle accueillie dans son intégralité ? */ + } - start = compute_vmpa_diff(get_mrange_addr(&area->range), addr); + /* L'instruction est-elle accueillie dans son intégralité ? */ - if (start + get_mrange_length(range) > get_mrange_length(&area->range)) - { - vmpa2_virt_to_string(addr, MDS_UNDEFINED, loc, NULL); + start = compute_vmpa_diff(get_mrange_addr(&area->range), addr); - log_variadic_message(LMT_WARNING, _("The symbol located at %s is too big for one place only."), loc); - continue; + if (start + get_mrange_length(range) > get_mrange_length(&area->range)) + { + vmpa2_virt_to_string(addr, MDS_UNDEFINED, loc, NULL); - } + log_variadic_message(LMT_WARNING, _("The symbol located at %s is too big for one place only."), loc); + return; - /* Inscription d'une instruction de symbole (sans retour arrière possible :/ ) */ + } - mark_range_in_mem_area_as_processed(area, iter, true); + /* Inscription d'une instruction de symbole (sans retour arrière possible :/ ) */ - g_object_ref(G_OBJECT(iter)); + mark_range_in_mem_area_as_processed(area, instr, true); - } + g_object_ref(G_OBJECT(instr)); } |