diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-12-14 23:32:23 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-12-14 23:32:23 (GMT) |
commit | a1c2bc0c3b6f4b4fda9c50beeb09a1f699419e2a (patch) | |
tree | 7856d9bc8fd702d0499f8a09156a555406eaaea9 /src/format/symbol.c | |
parent | 16d37d997b84c75c1f9b877fe446b3b3e5ce2495 (diff) |
Shown label of loaded symbols when possible.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@441 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r-- | src/format/symbol.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c index 0875e1f..3a909b4 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -138,6 +138,56 @@ GBinSymbol *g_binary_symbol_new(SymbolType type, const char *name, vmpa_t addres /****************************************************************************** * * +* Paramètres : a = premier symbole à analyser. * +* b = second symbole à analyser. * +* * +* Description : Compare deux symboles d'exécutable selon leurs propriétés. * +* * +* Retour : Bilan de la comparaison : -1, 0 ou 1 (-1 par défaut). * +* * +* Remarques : - * +* * +******************************************************************************/ + +int g_binary_symbol_cmp(const GBinSymbol **a, const GBinSymbol **b) +{ + int result; /* Bilan à retourner */ + const mrange_t *ra; /* Emplacement du symbole A */ + const mrange_t *rb; /* Emplacement du symbole B */ + const vmpa2t *aa; /* Adresse du symbole A */ + const vmpa2t *ab; /* Adresse du symbole B */ + + ra = g_binary_symbol_get_range(*a); + rb = g_binary_symbol_get_range(*b); + + if (ra == NULL && rb == NULL) + result = 0; + + else if (ra != NULL && rb == NULL) + result = 1; + + else if (ra == NULL && rb != NULL) + result = -1; + + else + { + aa = get_mrange_addr(ra); + ab = get_mrange_addr(rb); + + result = aa->virtual < ab->virtual ? -1 : (aa->virtual > ab->virtual ? 1 : 0); + ///result = cmp_mrange(ra, rb); + + //printf(" ?? 0x%08lx vs 0x%08lx -> %d\n", aa->virtual, ab->virtual, result); + + } + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : symbol = symbole à venir consulter. * * * * Description : Fournit le type du symbole. * @@ -189,6 +239,48 @@ vmpa_t g_binary_symbol_get_address(const GBinSymbol *symbol) } + + + + + + + +/****************************************************************************** +* * +* Paramètres : symbol = symbole à venir consulter. * +* * +* Description : Fournit un étiquette pour viser un symbole. * +* * +* Retour : Chaîne de caractères renvoyant au symbole. * +* * +* Remarques : - * +* * +******************************************************************************/ + +const char *g_binary_symbol_get_label(const GBinSymbol *symbol) +{ + const char *result; /* Etiquette à retourner */ + + result = NULL; + + switch (symbol->type) + { + case STP_ROUTINE: + result = g_binary_routine_get_name(symbol->extra.routine); + break; + + default: + result = NULL; + break; + + } + + return result; + +} + + /****************************************************************************** * * * Paramètres : symbol = symbole à venir consulter. * |