diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-01-30 20:53:24 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-01-30 20:53:24 (GMT) |
commit | 4132223466dcabc19a1b6f0178adf1c1a35b07ad (patch) | |
tree | ad5ef2262e8e1855c9c7f23a0f11f560039d54c6 /src/format/mangling/itanium/component.h | |
parent | 896b31fbbef2fba442566a422fa4d409771b61dd (diff) |
Moved the mangling related code.
Diffstat (limited to 'src/format/mangling/itanium/component.h')
-rw-r--r-- | src/format/mangling/itanium/component.h | 213 |
1 files changed, 0 insertions, 213 deletions
diff --git a/src/format/mangling/itanium/component.h b/src/format/mangling/itanium/component.h deleted file mode 100644 index 6aa4e57..0000000 --- a/src/format/mangling/itanium/component.h +++ /dev/null @@ -1,213 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * component.h - prototypes pour la représentation des composants extraits de l'ABI C++ Itanium - * - * Copyright (C) 2013-2017 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Chrysalide is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Foobar. If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef _FORMAT_MANGLING_ITANIUM_COMPONENT_H -#define _FORMAT_MANGLING_ITANIUM_COMPONENT_H - - -#include <ctype.h> -#include <stdlib.h> -#include <string.h> -#include <malloc.h> -#include <sys/types.h> - - -#include "context.h" -#include "../../../analysis/type.h" -#include "../../../common/fnv1a.h" - - - -/* Type de composants */ -typedef enum _ItaniumComponentType -{ - /** - * Représentation d'une règle vide. - */ - ICT_EMPTY, - - /** - * Chaîne de caractère, terminée par un octet nul. - */ - ICT_NAME, - ICT_STD_SUBST, - - /** - * Noms imbriqués, en deux parties : 'binary'. - */ - ICT_NESTED_NAME, - ICT_TEMPLATE_NAME_ARGS, - - /** - * Deux types de préfixes : un ou deux éléments. - * -> 'unary' ou 'binary' - */ - ICT_PREFIX_UNARY, - ICT_PREFIX_BINARY, - ICT_TPREFIX_UNARY, - ICT_TPREFIX_BINARY, - - /** - * Encodage d'un nom d'opérateur, consigné dans 'operator'. - */ - ICT_OPERATOR_NAME, - - - /** - * Fonctions virtuelles. - * -> décalage : 'offset'. - * -> fonctions simples : 'binary'. - * -> fonctions complexes : 'ternary'. - */ - ICT_NON_VIRTUAL_OFFSET, - ICT_VIRTUAL_OFFSET, - ICT_FUNCTION_THUNK, - ICT_FUNCTION_COVARIANT_THUNK, - - /** - * Constructeur ou destructeur, sans plus de détail. - */ - ICT_CONSTRUCTOR, - ICT_DESSTRUCTOR, - - /** - * Type instanciable dans le programme. - */ - ICT_TYPE, - - /** - * Différentes références vers un sous-type. - * Le champ impacté est 'unary'. - */ - ICT_POINTER_TO, - ICT_REFERENCE_TO, - ICT_RVALUE_REFERENCE_TO, - ICT_COMPLEX_PAIR, - ICT_IMAGINARY, - - /** - * Fonction (nom + retour/paramètres), sous forme binaire : - * -> left = function name - * -> right = bare-function-type - */ - ICT_FUNCTION_ENCODING, - - /** - * Liste d'arguments pour templates, à encadrer par des chevrons. - * 'unary' pointe vers la liste des éléments. - */ - ICT_TEMPLATE_ARGS, - - /** - * Liste de types, sous forme binaire : - * -> left = élément de la liste de types. - * -> right = reste de la liste de types. - */ - ICT_TYPES_LIST, - - ICT_COUNT - -} ItaniumComponentType; - - -/* Catégories d'opérateurs */ -typedef enum _ItaniumOperatorType -{ - IOT_SIMPLE, /* Présent dans la liste */ - IOT_CAST, /* Conversion forcée */ - IOT_VENDOR /* Défini par un vendeur */ - -} ItaniumOperatorType; - - -/* Enregistrement des opérateurs */ -typedef struct _itanium_operator_info -{ - const char *code; /* Nom encodé */ - const char *name; /* Désignation humaine */ - size_t name_len; /* Taille du nom humain */ - int args; /* Nombre d'arguments */ - -} itanium_operator_info; - - -/* Composant extrait de l'encodage */ -typedef struct _itanium_component itanium_component; - - - -/* Incrémente le nombre d'utilisation du composant. */ -void itd_ref_comp(itanium_component *); - -/* Décrémente le nombre d'utilisation du composant. */ -void itd_unref_comp(itanium_component *); - -/* Détermine ou fournit l'empreinte d'un composant. */ -fnv64_t itd_hash_comp(itanium_component *); - - - -/* Marque un composant comme étant disponible pour un usage. */ -void itd_free_comp(GItaniumDContext *, itanium_component *); - -/* Construit un composant dans un contexte Itanium. */ -itanium_component *itd_make_empty(GItaniumDContext *); - -/* Construit un composant dans un contexte Itanium. */ -itanium_component *itd_make_name(GItaniumDContext *, const char *, size_t); - - -/* Construit un composant dans un contexte Itanium. */ -itanium_component *itd_make_operator(GItaniumDContext *, const itanium_operator_info *); - - -/* Construit un composant dans un contexte Itanium. */ -itanium_component *itd_make_offset(GItaniumDContext *, ItaniumComponentType, ssize_t); - - -/* Construit un composant dans un contexte Itanium. */ -itanium_component *itd_make_type(GItaniumDContext *, GDataType *); - -/* Construit un composant dans un contexte Itanium. */ -itanium_component *itd_make_binary(GItaniumDContext *, ItaniumComponentType, itanium_component *, itanium_component *); - -/* Construit un composant dans un contexte Itanium. */ -itanium_component *itd_append_right_to_binary(GItaniumDContext *, ItaniumComponentType, itanium_component *, itanium_component *); - -/* Construit un composant dans un contexte Itanium. */ -itanium_component *itd_make_unary(GItaniumDContext *, ItaniumComponentType, itanium_component *); - - - -/* Modifie légèrement le type d'un composant donné. */ -void itd_set_type(itanium_component *, ItaniumComponentType); - -/* Fournit le type d'un composant issu d'un contexte Itanium. */ -ItaniumComponentType itd_get_component_type(const itanium_component *); - -/* Traduit les composants de contexte Itanium. */ -char *itd_translate_component(GItaniumDContext *, const itanium_component *, char *); - - - -#endif /* _FORMAT_MANGLING_ITANIUM_COMPONENT_H */ |