diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-04-25 21:35:19 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-04-25 21:35:19 (GMT) |
commit | ee0ff01247738e847ae3faa44dcb5168d7b758ba (patch) | |
tree | e945f95a84a97237debf0b16ee11ed95d6862afb /src/analysis | |
parent | 2a1dd967d3b4e06f504431f9d3d613992095b2c3 (diff) |
Registered suitable linkage hooks and defined right links between instructions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@519 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/disass/macro.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/analysis/disass/macro.c b/src/analysis/disass/macro.c index 96a3b25..9527457 100644 --- a/src/analysis/disass/macro.c +++ b/src/analysis/disass/macro.c @@ -40,6 +40,8 @@ /* Bornes d'une zone à couvrir */ typedef struct _code_coverage { + bool initial; /* Couverture racine ? */ + mrange_t range; /* Couverture totale */ vmpa2t start; /* Position butoir de début */ @@ -209,6 +211,8 @@ static code_coverage *create_code_coverage(const mrange_t *range) result = (code_coverage *)calloc(1, sizeof(code_coverage)); + result->initial = true; + copy_mrange(&result->range, range); copy_vmpa(&result->start, get_mrange_addr(range)); @@ -251,6 +255,8 @@ static code_coverage *dup_code_coverage(const code_coverage *src, const vmpa2t * result = (code_coverage *)calloc(1, sizeof(code_coverage)); + result->initial = false; + copy_mrange(&result->range, &src->range); copy_vmpa(&result->start, new); @@ -261,10 +267,15 @@ static code_coverage *dup_code_coverage(const code_coverage *src, const vmpa2t * for (i = 0; i < result->ends_count; i++) copy_vmpa(&result->ends[i], &src->ends[i]); - result->processed = (unsigned long *)calloc(src->allocated, sizeof(unsigned long)); - result->allocated = src->allocated; + /** + * Les blocs produits par le découpage sont à accès global, et ne sont donc pas + * la propriété d'une branche particulière. + * Il ne faut donc pas créer deux blocs identiques à partir de deux chemins + * différents ; aussi on partage la couverture de code plutôt que la copier. + * Et, par ailleurs, c'est plus simple & efficace. + */ - memcpy(result->processed, src->processed, src->allocated * sizeof(unsigned long)); + result->processed = src->processed; return result; @@ -287,7 +298,8 @@ static void delete_code_coverage(code_coverage *coverage) { free(coverage->ends); - free(coverage->processed); + if (coverage->initial) + free(coverage->processed); free(coverage); |