diff options
Diffstat (limited to 'src/format/symbol-int.h')
-rw-r--r-- | src/format/symbol-int.h | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/src/format/symbol-int.h b/src/format/symbol-int.h index 99cee88..48a27ed 100644 --- a/src/format/symbol-int.h +++ b/src/format/symbol-int.h @@ -26,6 +26,7 @@ #include "symbol.h" +#include "../analysis/storage/serialize-int.h" #include "../glibext/objhole.h" @@ -33,35 +34,40 @@ /* Fournit une étiquette pour viser un symbole. */ typedef char * (* get_symbol_label_fc) (const GBinSymbol *); +/* Charge un contenu depuis une mémoire tampon. */ +typedef bool (* load_symbol_fc) (GBinSymbol *, GObjectStorage *, packed_buffer_t *); + +/* Sauvegarde un contenu dans une mémoire tampon. */ +typedef bool (* store_symbol_fc) (GBinSymbol *, GObjectStorage *, packed_buffer_t *); + /* Informations glissées dans la structure GObject de GBinSymbol */ -typedef union _sym_obj_extra +typedef struct _sym_extra_data_t { - struct - { - SymbolType stype; /* Type du symbole */ - SymbolStatus status; /* Visibilité du symbole */ + SymbolType stype; /* Type du symbole */ + SymbolStatus status; /* Visibilité du symbole */ - char nm_prefix; /* Eventuel préfixe "nm" */ + char nm_prefix; /* Eventuel préfixe "nm" */ - SymbolFlag flags; /* Informations complémentaires*/ + SymbolFlag flags; /* Informations complémentaires*/ - }; +} sym_extra_data_t; - gint lock; /* Gestion d'accès aux fanions */ +/* Encapsulation avec un verrou d'accès */ +typedef union _symbol_obj_extra_t +{ + sym_extra_data_t data; /* Données embarquées */ + lockable_obj_extra_t lockable; /* Gestion d'accès aux fanions */ + +} symbol_obj_extra_t; -} sym_obj_extra; /* Symbole d'exécutable (instance) */ struct _GBinSymbol { GObject parent; /* A laisser en premier */ - mrange_t range; /* Couverture mémoire */ - - char *alt; /* Nom alternatif */ - -#if __SIZEOF_INT__ == __SIZEOF_LONG__ +#if 1 //__SIZEOF_INT__ == __SIZEOF_LONG__ /** * L'inclusion des informations suivantes dépend de l'architecture. @@ -70,38 +76,42 @@ struct _GBinSymbol * ce dernier. */ - sym_obj_extra extra; /* Externalisation embarquée */ + symbol_obj_extra_t extra; /* Externalisation embarquée */ #endif + mrange_t range; /* Couverture mémoire */ + + char *alt; /* Nom alternatif */ + }; -/** - * Accès aux informations éventuellement déportées. - */ +/* Symbole d'exécutable (classe) */ +struct _GBinSymbolClass +{ + GObjectClass parent; /* A laisser en premier */ -#if __SIZEOF_INT__ == __SIZEOF_LONG__ + get_symbol_label_fc get_label; /* Obtention d'une étiquette */ -# define INIT_BIN_SYMBOL_EXTRA(sym) sym->extra.lock = 0 + load_symbol_fc load; /* Chargement depuis un tampon */ + store_symbol_fc store; /* Conservation dans un tampon */ -# define GET_BIN_SYMBOL_EXTRA(sym) &sym->extra +}; -#else -# define INIT_BIN_SYMBOL_EXTRA(sym) INIT_GOBJECT_EXTRA(G_OBJECT(sym)) +/** + * Accès aux informations éventuellement déportées. + */ -# define GET_BIN_SYMBOL_EXTRA(sym) GET_GOBJECT_EXTRA(G_OBJECT(sym), sym_obj_extra) +#if 1 //__SIZEOF_INT__ == __SIZEOF_LONG__ -#endif +# define GET_BIN_SYMBOL_EXTRA(sym) (sym_extra_data_t *)&sym->extra -/* Symbole d'exécutable (classe) */ -struct _GBinSymbolClass -{ - GObjectClass parent; /* A laisser en premier */ +#else - get_symbol_label_fc get_label; /* Obtention d'une étiquette */ +# define GET_BIN_SYMBOL_EXTRA(sym) GET_GOBJECT_EXTRA(G_OBJECT(sym), sym_extra_data_t) -}; +#endif |