diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-08-19 20:25:20 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-08-19 20:25:20 (GMT) |
commit | 2425953ed7330c8f92ec7d04a5f248db1ed98a9d (patch) | |
tree | f389f040f6bcc9f88d837e0e2f37cbd49758f610 /src/format/symbol.c | |
parent | a0a7b6c1e05c78ae433f353d15e3366107b67d03 (diff) |
Added a demo symbol when loading an ELF header.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@390 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r-- | src/format/symbol.c | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c index 467bfd2..b478dc7 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -42,6 +42,7 @@ struct _GBinSymbol union { + GArchInstruction *instr; /* Instruction correspondante */ GBinRoutine *routine; /* Compléments pour fonction */ } extra; @@ -178,6 +179,14 @@ const char *g_binary_symbol_to_string(const GBinSymbol *symbol) } +vmpa_t g_binary_symbol_get_address(const GBinSymbol *symbol) +{ + + return 0; + +} + + /****************************************************************************** * * * Paramètres : symbol = symbole à venir consulter. * @@ -190,9 +199,19 @@ const char *g_binary_symbol_to_string(const GBinSymbol *symbol) * * ******************************************************************************/ -vmpa_t g_binary_symbol_get_address(const GBinSymbol *symbol) +const vmpa2t *g_binary_symbol_get_address2(const GBinSymbol *symbol) { - return symbol->address; + const vmpa2t *result; /* Localisation à retourner */ + + switch (symbol->type) + { + case STP_DATA: + result = g_arch_instruction_get_location2(symbol->extra.instr, NULL); + break; + + } + + return result; } @@ -270,3 +289,44 @@ void g_binary_symbol_attach_routine(GBinSymbol *symbol, GBinRoutine *routine) symbol->extra.routine = routine; } + + +/****************************************************************************** +* * +* Paramètres : symbol = symbole à venir consulter. * +* instr = représentation du symbole associé. * +* * +* Description : Attache l'instruction associée au symbole. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_symbol_attach_instruction(GBinSymbol *symbol, GArchInstruction *instr) +{ + symbol->type = STP_DATA; + + symbol->extra.instr = instr; + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = symbole à venir consulter. * +* * +* Description : Fournit l'éventuelle instruction associée au symbole. * +* * +* Retour : - * +* * +* Remarques : Il n'y a pas de transfert de propriété ici ! * +* * +******************************************************************************/ + +GArchInstruction *g_binary_symbol_get_instruction(const GBinSymbol *symbol) +{ + return symbol->extra.instr; + +} |