diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-05-30 20:31:59 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-05-30 20:31:59 (GMT) |
commit | 36760a757f4c3cdecd04d678a41d3484dcdac566 (patch) | |
tree | b4987539ac2bc5bfd65eec1600b464b11766cd0d /src/format | |
parent | 3154db88ce14aa681cc553a8910edba1e69d8c2b (diff) |
Resolved a suitable symbol depending on the request tolerance.
Diffstat (limited to 'src/format')
-rw-r--r-- | src/format/format.c | 11 | ||||
-rw-r--r-- | src/format/format.h | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/format/format.c b/src/format/format.c index 5b44156..ef8258f 100644 --- a/src/format/format.c +++ b/src/format/format.c @@ -812,6 +812,7 @@ bool g_binary_format_find_next_symbol_at(GBinFormat *format, const vmpa2t *addr, * * * Paramètres : format = informations chargées à consulter. * * addr = adresse à cibler lors des recherches. * +* strict = indication de tolérance acceptée. * * symbol = éventuel symbole trouvé à déréfenrencer. [OUT] * * diff = décallage entre l'adresse et le symbole. [OUT] * * * @@ -823,17 +824,23 @@ bool g_binary_format_find_next_symbol_at(GBinFormat *format, const vmpa2t *addr, * * ******************************************************************************/ -bool g_binary_format_resolve_symbol(GBinFormat *format, const vmpa2t *addr, GBinSymbol **symbol, phys_t *diff) +bool g_binary_format_resolve_symbol(GBinFormat *format, const vmpa2t *addr, bool strict, GBinSymbol **symbol, phys_t *diff) { bool result; /* Bilan à retourner */ const mrange_t *range; /* Espace mémoire parcouru */ - result = g_binary_format_find_symbol_for(format, addr, symbol); + if (strict) + result = g_binary_format_find_symbol_at(format, addr, symbol); + else + result = g_binary_format_find_symbol_for(format, addr, symbol); if (result) { range = g_binary_symbol_get_range(*symbol); *diff = compute_vmpa_diff(get_mrange_addr(range), addr); + + assert(!strict || *diff == 0); + } return result; diff --git a/src/format/format.h b/src/format/format.h index e21e478..4d5cac5 100644 --- a/src/format/format.h +++ b/src/format/format.h @@ -92,7 +92,7 @@ bool g_binary_format_find_symbol_for(GBinFormat *, const vmpa2t *, GBinSymbol ** bool g_binary_format_find_next_symbol_at(GBinFormat *, const vmpa2t *, GBinSymbol **); /* Recherche le symbole correspondant à une adresse. */ -bool g_binary_format_resolve_symbol(GBinFormat *, const vmpa2t *, GBinSymbol **, phys_t *); +bool g_binary_format_resolve_symbol(GBinFormat *, const vmpa2t *, bool, GBinSymbol **, phys_t *); /* Fournit le prototype de toutes les routines détectées. */ GBinRoutine **g_binary_format_get_routines(const GBinFormat *, size_t *); |