diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-10-07 21:18:39 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-10-07 21:18:39 (GMT) |
commit | fe3ac685849b69d87ad536e80d6f31d08c593eac (patch) | |
tree | 7522f5cf0a259656c6aff47a39b442001fd7911a /src/analysis/disass | |
parent | f9c4cfc72cd8d7eb08ded8287fc5af1497567f8b (diff) |
Introduced code coverages to reduce search time.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@588 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/disass')
-rw-r--r-- | src/analysis/disass/loop.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/analysis/disass/loop.c b/src/analysis/disass/loop.c index 30265c9..5f97981 100644 --- a/src/analysis/disass/loop.c +++ b/src/analysis/disass/loop.c @@ -34,16 +34,17 @@ /* Suit un flot d'exécution à la recherche de boucles. */ -static void track_loops_in_code(const GArchProcessor *, const mrange_t *, const vmpa2t *, memfield_t *); +static void track_loops_in_code(const GArchProcessor *, const instr_coverage *, const mrange_t *, const vmpa2t *, memfield_t *); /****************************************************************************** * * -* Paramètres : proc = ensemble d'instructions à parcourir. * -* start = adresse du début de l'analyse. * -* end = adresse de fin de la routine traitée. * -* flow = ensemble des jalons de l'exécution du code. * +* Paramètres : proc = ensemble d'instructions à parcourir. * +* coverage = zone de couverture où rechercher des instructions.* +* range = zone de couverture de la routine analysée. * +* start = adresse du début de l'analyse. * +* flow = ensemble des jalons de l'exécution du code. * * * * Description : Suit un flot d'exécution à la recherche de boucles. * * * @@ -53,7 +54,7 @@ static void track_loops_in_code(const GArchProcessor *, const mrange_t *, const * * ******************************************************************************/ -static void track_loops_in_code(const GArchProcessor *proc, const mrange_t *range, const vmpa2t *start, memfield_t *flow) +static void track_loops_in_code(const GArchProcessor *proc, const instr_coverage *coverage, const mrange_t *range, const vmpa2t *start, memfield_t *flow) { bool exit_track; /* Détermine la fin du parcours*/ GArchInstruction *iter; /* Boucle de parcours */ @@ -69,7 +70,7 @@ static void track_loops_in_code(const GArchProcessor *proc, const mrange_t *rang exit_track = false; - for (iter = g_arch_processor_find_instr_by_address(proc, start); + for (iter = g_arch_processor_find_covered_instr_by_address(proc, coverage, start); iter != NULL && !exit_track; iter = g_arch_instruction_get_next_iter(iter /* FIXME : list*/, iter, ~0)) { @@ -120,7 +121,7 @@ static void track_loops_in_code(const GArchProcessor *proc, const mrange_t *rang addr = get_mrange_addr(irange); next_flow = create_mem_field_from(flow); - track_loops_in_code(proc, range, addr, next_flow); + track_loops_in_code(proc, coverage, range, addr, next_flow); delete_mem_field(next_flow); break; @@ -150,7 +151,7 @@ static void track_loops_in_code(const GArchProcessor *proc, const mrange_t *rang else { next_flow = dup_mem_field(flow); - track_loops_in_code(proc, range, addr, next_flow); + track_loops_in_code(proc, coverage, range, addr, next_flow); delete_mem_field(next_flow); } @@ -186,14 +187,19 @@ void detect_loops_in_code(const GArchProcessor *proc, GBinRoutine **routines, si { size_t i; /* Boucle de parcours */ const mrange_t *range; /* Couverture d'une routine */ + const vmpa2t *start; /* Adresse de départ */ + const instr_coverage *coverage; /* Instructions couvertes */ memfield_t *flow; /* Flot d'exécution à suivre */ for (i = 0; i < count; i++) { range = g_binary_routine_get_range(routines[i]); + start = get_mrange_addr(range); + + coverage = g_arch_processor_find_coverage_by_address(proc, start); flow = create_mem_field(range); - track_loops_in_code(proc, range, get_mrange_addr(range), flow); + track_loops_in_code(proc, coverage, range, start, flow); delete_mem_field(flow); gtk_extended_status_bar_update_activity(statusbar, id, (i + 1) * 1.0 / count); |