diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-09-30 00:00:43 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-09-30 00:00:43 (GMT) |
commit | 3c6968d4d5a8918c456cdea28a7c6195368d996e (patch) | |
tree | e6909254a8033cdabd116f287db2893e938a636d /src/analysis/routine.h | |
parent | 1beaa1af679d49d99696ec907662b764f7ba1867 (diff) |
Parsed and replaced ModRM operands.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@121 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/routine.h')
-rw-r--r-- | src/analysis/routine.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/analysis/routine.h b/src/analysis/routine.h new file mode 100644 index 0000000..4e47b5e --- /dev/null +++ b/src/analysis/routine.h @@ -0,0 +1,111 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * routine.h - prototypes pour la manipulation des prototypes de fonctions et de variables + * + * Copyright (C) 2008 Cyrille Bagard + * + * This file is part of OpenIDA. + * + * OpenIDA 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. + * + * OpenIDA 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 _ANALYSIS_ROUTINE_H +#define _ANALYSIS_ROUTINE_H + + +#include <glib-object.h> +#include <stdint.h> +#include <sys/types.h> + + +#include "variable.h" +#include "../arch/archbase.h" + + + +/* Type de routine traitée */ +typedef enum _RoutineType +{ + RTT_CLASSIC, /* Fonction ou méthode */ + RTT_CONSTRUCTOR, /* Constructeur */ + RTT_DESTRUCTOR /* Destructeur */ + +} RoutineType; + + +#define G_TYPE_BIN_ROUTINE g_bin_routine_get_type() +#define G_BIN_ROUTINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_bin_routine_get_type(), GBinRoutine)) +#define G_IS_BIN_ROUTINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_bin_routine_get_type())) +#define G_BIN_ROUTINE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_bin_routine_get_type(), GBinRoutineIface)) + + +/* Représentation générique de routine (instance) */ +typedef struct _GBinRoutine GBinRoutine; + +/* Représentation générique de routine (classe) */ +typedef struct _GBinRoutineClass GBinRoutineClass; + + +/* Indique le type définit pour une représentation de routine. */ +GType g_bin_routine_get_type(void); + +/* Crée une représentation de routine. */ +GBinRoutine *g_binary_routine_new(void); + +/* Etablit la comparaison ascendante entre deux routines. */ +int g_binary_routine_compare(const GBinRoutine **, const GBinRoutine **); + +/* Etablit la comparaison descendante entre deux routines. */ +int g_binary_routine_rcompare(const GBinRoutine **, const GBinRoutine **); + +/* Définit la position physique / en mémoire d'une routine. */ +void g_binary_routine_set_address(GBinRoutine *, vmpa_t); + +/* Fournit la position physique / en mémoire d'une routine. */ +vmpa_t g_binary_routine_get_address(const GBinRoutine *); + +/* Définit la taille du code d'une routine. */ +void g_binary_routine_set_size(GBinRoutine *, off_t); + +/* Fournit la taille du code associé à une routine. */ +off_t g_binary_routine_get_size(const GBinRoutine *); + +/* Définit le type d'une routine. */ +void g_binary_routine_set_type(GBinRoutine *, RoutineType); + +/* Définit le nom humain d'une routine. */ +void g_binary_routine_set_name(GBinRoutine *, char *); + +/* Désignation humainement lisible ou NULL si non définie. */ +const char *g_binary_routine_get_name(const GBinRoutine *); + +/* Définit le type de retour d'une routine. */ +void g_binary_routine_set_return_type(GBinRoutine *, variable *); + +/* Ajoute un argument à une routine. */ +void g_binary_routine_add_arg(GBinRoutine *, variable *); + +/* S'assure qu'une variable est bien associée à une routine. */ +void g_binary_routine_register_if_needed(GBinRoutine *, size_t, bool); + +/* Donne l'indice d'une variable dans la liste d'une routine. */ +size_t g_binary_routine_get_var_index_from_offset(const GBinRoutine *, size_t, bool); + +/* Décrit le prototype de la routine sous forme de caractères. */ +char *g_binary_routine_to_string(const GBinRoutine *); + + + +#endif /* _ANALYSIS_ROUTINE_H */ |