diff options
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r-- | src/format/symbol.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c index f1183cb..5b80555 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -192,8 +192,9 @@ vmpa_t g_binary_symbol_get_address(const GBinSymbol *symbol) /****************************************************************************** * * * Paramètres : symbol = symbole à venir consulter. * +* length = taille de l'instruction ou NULL. [OUT] * * * -* Description : Fournit l'adresse associée à un symbole. * +* Description : Fournit l'emplacement où se situe un symbole. * * * * Retour : Adresse virtuelle ou physique associée. * * * @@ -201,7 +202,7 @@ vmpa_t g_binary_symbol_get_address(const GBinSymbol *symbol) * * ******************************************************************************/ -const vmpa2t *g_binary_symbol_get_address2(const GBinSymbol *symbol) +const vmpa2t *g_binary_symbol_get_location(const GBinSymbol *symbol, off_t *length) { const vmpa2t *result; /* Localisation à retourner */ @@ -210,19 +211,20 @@ const vmpa2t *g_binary_symbol_get_address2(const GBinSymbol *symbol) switch (symbol->type) { case STP_DATA: - result = g_arch_instruction_get_location2(symbol->extra.instr, NULL); + result = g_arch_instruction_get_location2(symbol->extra.instr, length); break; - default: - result = NULL; - break; - - } - + case STP_ROUTINE: + result = g_binary_routine_get_address(symbol->extra.routine); + if (length != NULL) + *length = g_binary_routine_get_size(symbol->extra.routine); + break; - if (result == NULL) - printf("got addr=%p for symbol=%p (data=%d)\n", result, symbol, symbol->type == STP_DATA); + default: + result = NULL; + break; + } return result; |