diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-09-01 22:20:28 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-09-01 22:20:28 (GMT) |
commit | 04ca0756d59629113bd3f602565850a2910ac84e (patch) | |
tree | 26c70bc546e4ac55967530beb583dc851b2f82c9 /src/format/symbol.c | |
parent | a738b482b70d263252ec4dc18919c71503490297 (diff) |
Loaded some ELF symbols from DYNSYM and SYMTAB sections.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@397 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
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; |