diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-10-14 00:10:11 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-10-14 00:10:11 (GMT) |
commit | 48726043e2f07874e7a09a866c4cc537a65a683c (patch) | |
tree | 557e4f6cd700d131e8964d02890a6381f87e52cd /src/format/format.c | |
parent | 18beadb4192144b00c06769645befb17ae1ce98e (diff) |
Forced the full definition of locations to fix the search of symbols.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@594 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/format.c')
-rw-r--r-- | src/format/format.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/format/format.c b/src/format/format.c index 9f03924..9c42508 100644 --- a/src/format/format.c +++ b/src/format/format.c @@ -221,7 +221,7 @@ void g_binary_format_setup_disassembling_context(const GBinFormat *format, GProc * * * Description : Ajoute un symbole à la collection du format binaire. * * * -* Retour : - * +* Retour : true si le symbole était bien localisé et a été inséré. * * * * Remarques : - * * * @@ -229,6 +229,26 @@ void g_binary_format_setup_disassembling_context(const GBinFormat *format, GProc void _g_binary_format_add_symbol(GBinFormat *format, GBinSymbol *symbol, bool sort) { + const mrange_t *range; /* Couverture du symbole */ + const vmpa2t *addr; /* Emplacement du symbole */ + + /** + * Lorsque les fonctions de recherche type g_binary_format_find_symbol_at() + * sont appelées avec une localisation, cette dernière peut reposer soit sur + * une position physique soit une adresse virtuelle uniquement. + * + * Pour que les comparaisons de positions puissent se réaliser, il faut donc + * pouvoir satisfaire les deux aspects : physiques et virtuels. + * + * On corrige donc le tir si besoin est ici. + */ + +#ifndef NDEBUG + range = g_binary_symbol_get_range(symbol); + addr = get_mrange_addr(range); + + assert(get_phy_addr(addr) != VMPA_NO_PHYSICAL && get_virt_addr(addr) != VMPA_NO_VIRTUAL); +#endif g_rw_lock_writer_lock(&format->syms_lock); @@ -628,7 +648,7 @@ bool g_binary_format_find_symbol_at(const GBinFormat *format, const vmpa2t *addr range = g_binary_symbol_get_range(*sym); - return cmp_vmpa_by_virt(addr, get_mrange_addr(range)); + return cmp_vmpa(addr, get_mrange_addr(range)); } |