diff options
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 : - * |