diff options
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r-- | src/format/symbol.c | 202 |
1 files changed, 1 insertions, 201 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c index 16e54ef..2611a40 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -28,6 +28,7 @@ #include <string.h> +#include "symbol-int.h" #include "../glibext/linegen-int.h" @@ -35,35 +36,6 @@ /* --------------------- FONCTIONNALITES BASIQUES POUR SYMBOLES --------------------- */ -/* Symbole d'exécutable (instance) */ -struct _GBinSymbol -{ - GObject parent; /* A laisser en premier */ - - SymbolType type; /* Type du symbole */ - - bool block_start; /* Début d'un bloc ? */ - char *alt; /* Nom alternatif */ - - union - { - GArchInstruction *instr; /* Instruction correspondante */ - GBinRoutine *routine; /* Compléments pour fonction */ - - } extra; - - GDbComment *comment; /* Eventuel commentaire lié */ - -}; - -/* Symbole d'exécutable (classe) */ -struct _GBinSymbolClass -{ - GObjectClass parent; /* A laisser en premier */ - -}; - - /* Initialise la classe des symboles d'exécutables. */ static void g_binary_symbol_class_init(GBinSymbolClass *); @@ -334,65 +306,6 @@ SymbolType g_binary_symbol_get_target_type(const GBinSymbol *symbol) /****************************************************************************** * * -* Paramètres : symbol = symbole à venir compléter. * -* start = indication quant à la nature du symbole. * -* * -* Description : Définit si un symbole est susceptible de démarrer un bloc. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_binary_symbol_define_as_block_start(GBinSymbol *symbol, bool start) -{ - symbol->block_start = start; - -} - - -/****************************************************************************** -* * -* Paramètres : symbol = symbole à venir consulter. * -* * -* Description : Indique si un symbole est susceptible de démarrer un bloc. * -* * -* Retour : Capacité de rassemblement du symbole. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool g_binary_symbol_is_block_start(GBinSymbol *symbol) -{ - bool result; /* Statut à retourner */ - - switch (g_binary_symbol_get_target_type(symbol)) - { - case STP_ROUTINE: - case STP_OBJECT: - case STP_ENTRY_POINT: - case STP_STRING: - case STP_RO_STRING: - result = true; - break; - - default: - result = false; - break; - - } - - result |= symbol->block_start; - - return result; - -} - - -/****************************************************************************** -* * * Paramètres : symbol = symbole à venir consulter. * * * * Description : Fournit un étiquette pour viser un symbole. * @@ -459,66 +372,6 @@ void g_binary_symbol_set_alt_label(GBinSymbol *symbol, const char *alt) /****************************************************************************** * * -* 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: - case STP_RO_STRING: - - 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: - case STP_ENTRY_POINT: - case STP_CODE_LABEL: - - 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. * @@ -675,59 +528,6 @@ GArchInstruction *g_binary_symbol_get_instruction(const GBinSymbol *symbol) } -/****************************************************************************** -* * -* 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) -{ -#ifndef NDEBUG - const vmpa2t *saddr; /* Adresse du symbole */ - const vmpa2t *caddr; /* Adresse du commentaire */ -#endif - -#ifndef NDEBUG - - saddr = get_mrange_addr(g_binary_symbol_get_range(symbol)); - caddr = g_db_comment_get_address(comment); - - assert(cmp_vmpa(saddr, caddr) == 0); - -#endif - - symbol->comment = comment; - -} - - -/****************************************************************************** -* * -* Paramètres : symbol = symbole à venir consulter. * -* * -* Description : Fournit l'éventuel commentaire associé au symbole. * -* * -* Retour : Instance GLib en place ou NULL si aucune. * -* * -* Remarques : Il n'y a pas de transfert de propriété ici ! * -* * -******************************************************************************/ - -GDbComment *g_binary_symbol_get_comment(const GBinSymbol *symbol) -{ - return symbol->comment; - -} - - /* ---------------------------------------------------------------------------------- */ /* OFFRE DE CAPACITES DE GENERATION */ |