diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-01-30 23:37:39 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-01-30 23:37:39 (GMT) |
commit | d246c98c515cb44c5bc4c742a674bae2e824872b (patch) | |
tree | 2ea1ec27ae5fba761ee778ba4ddb85c7752ebbf5 /src/format/symbol.c | |
parent | 262c95e0b088a56e9fd919edc57ad19f85e2e40e (diff) |
Bound a symbol for each loaded value for 'ldr' instructions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@462 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r-- | src/format/symbol.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c index 5e66c54..1e6063f 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -24,6 +24,7 @@ #include "symbol.h" +#include <assert.h> #include <string.h> @@ -290,6 +291,63 @@ const char *g_binary_symbol_get_label(const GBinSymbol *symbol) /****************************************************************************** * * +* Paramètres : symbol = symbole à venir mettre à jour. * +* full = adresse dont la définition est complète. * +* * +* Description : Raffine la définition de l'emplacement d'un symbole. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_symbol_fix_range(GBinSymbol *symbol, const vmpa2t *full) +{ + GArchInstruction *instr; /* Instruction associée */ + mrange_t range; /* Plage à manipuler */ + GBinRoutine *routine; /* Routine associée */ + + switch (symbol->type) + { + case STP_DATA: + + instr = g_binary_symbol_get_instruction(symbol); + + copy_mrange(&range, g_arch_instruction_get_range(instr)); + + assert(cmp_vmpa(get_mrange_addr(&range), full) == 0); + + copy_vmpa(get_mrange_addr(&range), full); + + g_arch_instruction_set_range(instr, &range); + + break; + + case STP_ROUTINE: + + routine = g_binary_symbol_get_routine(symbol); + + copy_mrange(&range, g_binary_routine_get_range(routine)); + + assert(cmp_vmpa(get_mrange_addr(&range), full) == 0); + + copy_vmpa(get_mrange_addr(&range), full); + + g_binary_routine_set_range(routine, &range); + + break; + + default: + break; + + } + +} + + +/****************************************************************************** +* * * Paramètres : symbol = symbole à venir consulter. * * * * Description : Fournit l'emplacement où se situe un symbole. * @@ -393,6 +451,25 @@ void g_binary_symbol_attach_instruction(GBinSymbol *symbol, GArchInstruction *in * * * Paramètres : symbol = symbole à venir consulter. * * * +* Description : Fournit l'éventuelle routine associée au symbole. * +* * +* Retour : - * +* * +* Remarques : Il n'y a pas de transfert de propriété ici ! * +* * +******************************************************************************/ + +GBinRoutine *g_binary_symbol_get_routine(const GBinSymbol *symbol) +{ + return symbol->extra.routine; + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = symbole à venir consulter. * +* * * Description : Fournit l'éventuelle instruction associée au symbole. * * * * Retour : - * |