diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-05-28 14:39:56 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-05-28 14:42:41 (GMT) |
commit | 3154db88ce14aa681cc553a8910edba1e69d8c2b (patch) | |
tree | c54fa0190da66831c19c83ae57dba117e56387e7 /src/analysis/disass/block.h | |
parent | ed70a0bacfdca738ba29d50e9f1b02290f28b9b8 (diff) |
Built the basic blocks list simply at loading.
Diffstat (limited to 'src/analysis/disass/block.h')
-rw-r--r-- | src/analysis/disass/block.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/analysis/disass/block.h b/src/analysis/disass/block.h new file mode 100644 index 0000000..8d38976 --- /dev/null +++ b/src/analysis/disass/block.h @@ -0,0 +1,111 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * block.h - prototypes pour l'encadrement des instructions par blocs + * + * Copyright (C) 2012-2013 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * 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_DISASS_BLOCK_H +#define _ANALYSIS_DISASS_BLOCK_H + + +#include <glib-object.h> + + +#include "../../arch/instruction.h" + + + +/* ------------------------ MISE EN PLACE DES BLOCS BASIQUES ------------------------ */ + + +#define G_TYPE_BASIC_BLOCK g_basic_block_get_type() +#define G_BASIC_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_basic_block_get_type(), GBasicBlock)) +#define G_IS_BASIC_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_basic_block_get_type())) +#define G_BASIC_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BASIC_BLOCK, GBasicBlockClass)) +#define G_IS_BASIC_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BASIC_BLOCK)) +#define G_BASIC_BLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BASIC_BLOCK, GBasicBlockClass)) + + +/* Description d'un bloc basique d'instructions (instance) */ +typedef struct _GBasicBlock GBasicBlock; + +/* Description d'un bloc basique d'instructions (classe) */ +typedef struct _GBasicBlockClass GBasicBlockClass; + + +/* Indique le type défini pour un bloc d'instructions basique. */ +GType g_basic_block_get_type(void); + +/* Crée un bloc basique d'exécution d'instructions. */ +GBasicBlock *g_basic_block_new(GArchInstruction *, GArchInstruction *); + +/* Fournit les instructions limites d'un bloc basique. */ +void g_basic_block_get_boundary(const GBasicBlock *, GArchInstruction **, GArchInstruction **); + +/* Fournit les adresses limites d'un bloc basique. */ +void g_basic_block_get_boundary_addresses(const GBasicBlock *, vmpa2t *, vmpa2t *); + +/* Fournit le rang du bloc basique dans le flot d'exécution. */ +unsigned int g_basic_block_get_rank(const GBasicBlock *); + +/* Définit le rang du bloc basique dans le flot d'exécution. */ +void g_basic_block_set_rank(GBasicBlock *, unsigned int); + + + +/* ------------------------- REGROUPEMENT EN LISTE DE BLOCS ------------------------- */ + + +#define G_TYPE_BLOCK_LIST g_block_list_get_type() +#define G_BLOCK_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_block_list_get_type(), GBasicBlock)) +#define G_IS_BLOCK_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_block_list_get_type())) +#define G_BLOCK_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BLOCK_LIST, GBasicBlockClass)) +#define G_IS_BLOCK_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BLOCK_LIST)) +#define G_BLOCK_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BLOCK_LIST, GBasicBlockClass)) + + +/* Description d'une liste de blocs basiques (instance) */ +typedef struct _GBlockList GBlockList; + +/* Description d'une liste de blocs basiques (classe) */ +typedef struct _GBlockListClass GBlockListClass; + + +/* Indique le type défini pour une liste de blocs basiques. */ +GType g_block_list_get_type(void); + +/* Crée une liste de blocs basiques. */ +GBlockList *g_block_list_new(size_t); + +/* Compte le nombre de blocs basiques représentés. */ +size_t g_block_list_count_blocks(const GBlockList *); + +/* Ajoute un bloc basique à une liste définie. */ +void g_block_list_add_block(GBlockList *, GBasicBlock *, size_t); + +/* Fournit un bloc basique à d'une liste définie. */ +GBasicBlock *g_block_list_get_block(GBlockList *, size_t ); + +/* Recherche un bloc basique selon une première instruction. */ +GBasicBlock *g_block_list_find_by_starting_instr(const GBlockList *, GArchInstruction *); + + + +#endif /* _ANALYSIS_DISASS_BLOCK_H */ |