diff options
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r-- | src/format/symbol.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c index b478dc7..f1183cb 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -47,6 +47,8 @@ struct _GBinSymbol } extra; + GDbComment *comment; /* Eventuel commentaire lié */ + }; /* Symbole d'exécutable (classe) */ @@ -203,14 +205,25 @@ const vmpa2t *g_binary_symbol_get_address2(const GBinSymbol *symbol) { const vmpa2t *result; /* Localisation à retourner */ + result = NULL; + switch (symbol->type) { case STP_DATA: result = g_arch_instruction_get_location2(symbol->extra.instr, NULL); break; + default: + result = NULL; + break; + } + + if (result == NULL) + printf("got addr=%p for symbol=%p (data=%d)\n", result, symbol, symbol->type == STP_DATA); + + return result; } @@ -293,7 +306,7 @@ void g_binary_symbol_attach_routine(GBinSymbol *symbol, GBinRoutine *routine) /****************************************************************************** * * -* Paramètres : symbol = symbole à venir consulter. * +* Paramètres : symbol = symbole à venir manipuler. * * instr = représentation du symbole associé. * * * * Description : Attache l'instruction associée au symbole. * @@ -330,3 +343,42 @@ GArchInstruction *g_binary_symbol_get_instruction(const GBinSymbol *symbol) return symbol->extra.instr; } + + +/****************************************************************************** +* * +* Paramètres : symbol = symbole à venir manipuler. * +* comment = commentaire construit à propos du symbole. * +* * +* Description : Ajoute un commentaire facultatif au symbole. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_symbol_set_comment(GBinSymbol *symbol, GDbComment *comment) +{ + symbol->comment = comment; + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = symbole à venir consulter. * +* * +* Description : Fournit l'éventuel commentaire associé au symbole. * +* * +* Retour : - * +* * +* Remarques : Il n'y a pas de transfert de propriété ici ! * +* * +******************************************************************************/ + +GDbComment *g_binary_symbol_get_comment(const GBinSymbol *symbol) +{ + return symbol->comment; + +} |