diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-02-01 22:39:57 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-02-01 22:39:57 (GMT) |
commit | 5511e355e7810f06bd610b79bcc94402c88d7ec9 (patch) | |
tree | 59023590f49f01cbd4ebfa9c1e82f797315e6f36 /src/analysis | |
parent | 21a05df6423bdc13ca148ff2b96aec80bf7af2b2 (diff) |
Added some development assertions and avoided to load code twice.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@464 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/disass/area.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c index 600818a..17df2af 100644 --- a/src/analysis/disass/area.c +++ b/src/analysis/disass/area.c @@ -359,10 +359,14 @@ static bool mark_range_in_mem_area_as_processed(mem_area *area, phys_t start, ph index = i / (sizeof(unsigned long) * 8); remaining = i % (sizeof(unsigned long) * 8); + assert((area->processed[index] & (1ul << remaining)) == 0); + area->processed[index] |= (1ul << remaining); } + assert(area->instructions[start] == NULL); + area->instructions[start] = instr; return true; @@ -464,7 +468,8 @@ void load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons for (i = diff; i < alen; i += diff) { - //il y a eu un point d'entrée... -> STOP + /* S'il y a eu un point d'entrée en milieu de zone, on s'arrête ! */ + if (!is_range_blank_in_mem_area(area, i, 1, NULL)) break; /* Décodage d'une nouvelle instruction */ @@ -503,7 +508,7 @@ void load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons has_new_sym = g_proc_context_pop_new_symbol_at(ctx, &sym_addr)) { printf("depop :: %x / %x\n", (unsigned int)sym_addr.physical, (unsigned int)sym_addr.virtual); - + //continue; //if (sym_addr.physical != 0x5bc && sym_addr.physical != 0x5c0) continue; //if (sym_addr.physical != 0x5bc) continue; @@ -558,6 +563,8 @@ void load_code_from_mem_area(mem_area **list, size_t *count, size_t *index, cons } + assert(1 && !is_range_blank_in_mem_areas(*list, *count, &range)); + if (g_arch_instruction_is_return(instr)) printf("BREAK @ 0x%08x\n", (unsigned int)get_virt_addr(&prev)); @@ -1306,9 +1313,37 @@ static bool insert_extra_symbol_into_mem_areas(mem_area **list, size_t *count, s index = find_memory_area_by_addr(*list, *count, get_mrange_addr(sym_range)); assert(index < *count); - if (index <= *old_index) (*old_index)++; + //if (index <= *old_index) (*old_index)++; area = &(*list)[index]; + + + if (strcmp("Value used @ 0x00008a26", g_db_comment_get_text(g_binary_symbol_get_comment(symbol))) == 0) + printf("break\n"); + + + do + { + size_t i; + + printf("--- comment '%s'...\n", + g_db_comment_get_text(g_binary_symbol_get_comment(symbol))); + + printf("--- insert @ 0x%04x + %u\n", + get_phy_addr(get_mrange_addr(sym_range)), get_mrange_length(sym_range)); + + for (i = 0; i < 3; i++) + printf("area [ %zu ] <=> 0x%04x + %u (sym ? %d)\n", + index - 1 + i, + get_phy_addr(get_mrange_addr(&(&(*list)[index - 1 + i])->range)), + get_mrange_length(&(&(*list)[index - 1 + i])->range), + (&(*list)[index - 1 + i])->has_sym); + + } + while (0); + + if (area->has_sym) return true; + assert(!area->has_sym); saved = *area; |