summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog31
-rw-r--r--configure.ac2
-rw-r--r--plugins/pychrysa/analysis/Makefile.am3
-rw-r--r--plugins/pychrysa/analysis/blocks/Makefile.am15
-rw-r--r--plugins/pychrysa/analysis/blocks/flow.c276
-rw-r--r--plugins/pychrysa/analysis/blocks/flow.h42
-rw-r--r--plugins/pychrysa/analysis/blocks/module.c91
-rw-r--r--plugins/pychrysa/analysis/blocks/module.h39
-rw-r--r--plugins/pychrysa/analysis/blocks/virtual.c108
-rw-r--r--plugins/pychrysa/analysis/blocks/virtual.h42
-rw-r--r--plugins/pychrysa/analysis/module.c2
-rwxr-xr-xsrc/analysis/Makefile.am3
-rwxr-xr-xsrc/analysis/blocks/Makefile.am18
-rw-r--r--src/analysis/blocks/flow.c711
-rw-r--r--src/analysis/blocks/flow.h102
-rw-r--r--src/analysis/blocks/raccess.c387
-rw-r--r--src/analysis/blocks/raccess.h105
-rw-r--r--src/analysis/blocks/virtual.c419
-rw-r--r--src/analysis/blocks/virtual.h69
-rw-r--r--src/gtkext/gtkgraphdisplay.c1
20 files changed, 33 insertions, 2433 deletions
diff --git a/ChangeLog b/ChangeLog
index 3130325..cfd9dbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,37 @@
16-12-30 Cyrille Bagard <nocbos@gmail.com>
* configure.ac:
+ * plugins/pychrysa/analysis/Makefile.am:
+ Update code.
+
+ * plugins/pychrysa/analysis/blocks/Makefile.am:
+ * plugins/pychrysa/analysis/blocks/flow.c:
+ * plugins/pychrysa/analysis/blocks/flow.h:
+ * plugins/pychrysa/analysis/blocks/module.c:
+ * plugins/pychrysa/analysis/blocks/module.h:
+ * plugins/pychrysa/analysis/blocks/virtual.c:
+ * plugins/pychrysa/analysis/blocks/virtual.h:
+ Deleted entries.
+
+ * plugins/pychrysa/analysis/module.c:
+ * src/analysis/Makefile.am:
+ Update code.
+
+ * src/analysis/blocks/Makefile.am:
+ * src/analysis/blocks/flow.c:
+ * src/analysis/blocks/flow.h:
+ * src/analysis/blocks/raccess.c:
+ * src/analysis/blocks/raccess.h:
+ * src/analysis/blocks/virtual.c:
+ * src/analysis/blocks/virtual.h:
+ Deleted entries: delete old code.
+
+ * src/gtkext/gtkgraphdisplay.c:
+ Update code.
+
+16-12-30 Cyrille Bagard <nocbos@gmail.com>
+
+ * configure.ac:
Extend AC_CONFIG_COMMANDS. Add the new Makefiles from the
'src/analysis/human', 'src/analysis/human/asm' and
'src/glibext/generators' directories.
diff --git a/configure.ac b/configure.ac
index 04be709..55c2b7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -321,7 +321,6 @@ AC_CONFIG_FILES([Makefile
plugins/mobicore/Makefile
plugins/pychrysa/Makefile
plugins/pychrysa/analysis/Makefile
- plugins/pychrysa/analysis/blocks/Makefile
plugins/pychrysa/analysis/contents/Makefile
plugins/pychrysa/analysis/db/Makefile
plugins/pychrysa/analysis/db/items/Makefile
@@ -348,7 +347,6 @@ AC_CONFIG_FILES([Makefile
plugins/stackvars/Makefile
src/Makefile
src/analysis/Makefile
- src/analysis/blocks/Makefile
src/analysis/contents/Makefile
src/analysis/db/Makefile
src/analysis/db/items/Makefile
diff --git a/plugins/pychrysa/analysis/Makefile.am b/plugins/pychrysa/analysis/Makefile.am
index 5b90c07..31d37f6 100644
--- a/plugins/pychrysa/analysis/Makefile.am
+++ b/plugins/pychrysa/analysis/Makefile.am
@@ -9,7 +9,6 @@ libpychrysaanalysis_la_SOURCES = \
routine.h routine.c
libpychrysaanalysis_la_LIBADD = \
- blocks/libpychrysaanalysisblocks.la \
contents/libpychrysaanalysiscontents.la \
db/libpychrysaanalysisdb.la
@@ -21,4 +20,4 @@ AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJE
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-SUBDIRS = blocks contents db
+SUBDIRS = contents db
diff --git a/plugins/pychrysa/analysis/blocks/Makefile.am b/plugins/pychrysa/analysis/blocks/Makefile.am
deleted file mode 100644
index b18f78a..0000000
--- a/plugins/pychrysa/analysis/blocks/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-
-noinst_LTLIBRARIES = libpychrysaanalysisblocks.la
-
-libpychrysaanalysisblocks_la_SOURCES = \
- flow.h flow.c \
- module.h module.c \
- virtual.h virtual.c
-
-libpychrysaanalysisblocks_la_LDFLAGS =
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
- -I../../../../src
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/pychrysa/analysis/blocks/flow.c b/plugins/pychrysa/analysis/blocks/flow.c
deleted file mode 100644
index d14ab8c..0000000
--- a/plugins/pychrysa/analysis/blocks/flow.c
+++ /dev/null
@@ -1,276 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * flow.h - équivalent Python du fichier "analysis/blocks/flow.c"
- *
- * Copyright (C) 2013 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "flow.h"
-
-
-#include <pygobject.h>
-
-
-#include <analysis/blocks/flow.h>
-
-
-#include "../block.h"
-#include "../../helpers.h"
-
-
-
-
-
-
-#if 0
-
-/* Fournit les adresses limites d'un bloc d'exécution. */
-static PyObject *py_flow_block_get_boundary_addresses(PyObject *, void *);
-
-/* Fournit le rang du bloc dans le flot d'exécution. */
-static PyObject *py_flow_block_get_rank(PyObject *, void *);
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant une instruction. *
-* closure = adresse non utilisée ici. *
-* *
-* Description : Fournit les adresses limites d'un bloc d'exécution. *
-* *
-* Retour : Valeur associée à la propriété consultée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_flow_block_get_boundary_addresses(PyObject *self, void *closure)
-{
- PyObject *result; /* Trouvailles à retourner */
- GFlowBlock *block; /* Version native */
- vmpa_t start; /* Adresse de départ du bloc */
- vmpa_t end; /* Dernière adresse du bloc */
-
- block = G_FLOW_BLOCK(pygobject_get(self));
- g_flow_block_get_boundary_addresses(block, &start, &end);
-
- result = Py_BuildValue("(KK)", start, end);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant une instruction. *
-* closure = adresse non utilisée ici. *
-* *
-* Description : Fournit le rang du bloc dans le flot d'exécution. *
-* *
-* Retour : Valeur associée à la propriété consultée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_flow_block_get_rank(PyObject *self, void *closure)
-{
- PyObject *result; /* Trouvailles à retourner */
- GFlowBlock *block; /* Version native */
-
- block = G_FLOW_BLOCK(pygobject_get(self));
-
- result = Py_BuildValue("I", g_flow_block_get_rank(block));
-
- return result;
-
-}
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide....blocks.FlowBlock'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_flow_block(PyObject *module)
-{
- PyObject *parent_mod; /* Module de la classe parente */
- int ret; /* Bilan d'un appel */
-
- static PyMethodDef py_flow_block_methods[] = {
- { NULL }
- };
-
- static PyGetSetDef py_flow_block_getseters[] = {
- {
- "boundary_addresses", (getter)py_flow_block_get_boundary_addresses, (setter)NULL,
- "Provide the boundary addresses of the current flow block.", NULL
- },
- {
- "rank", (getter)py_flow_block_get_rank, (setter)NULL,
- "Provide the rank of the current block in the execution flow.", NULL
- },
- { NULL }
- };
-
- static PyTypeObject py_flow_block_type = {
-
- PyObject_HEAD_INIT(NULL)
-
- .tp_name = "pychrysalide.analysis.blocks.FlowBlock",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyChrysalide basic flow block",
-
- .tp_methods = py_flow_block_methods,
- .tp_getset = py_flow_block_getseters
-
- };
-
- parent_mod = PyImport_ImportModule("pychrysalide.analysis");
- if (parent_mod == NULL) return false;
-
- py_flow_block_type.tp_base = (PyTypeObject *)PyObject_GetAttrString(parent_mod, "InstrBlock");
- Py_DECREF(parent_mod);
-
- if (PyType_Ready(&py_flow_block_type) < 0)
- return false;
-
- Py_INCREF(&py_flow_block_type);
- ret = PyModule_AddObject(module, "FlowBlock", (PyObject *)&py_flow_block_type);
-
- register_class_for_pygobject(module, "GFlowBlock", G_TYPE_FLOW_BLOCK, &py_flow_block_type,
- Py_BuildValue("(O)", py_flow_block_type.tp_base));
-
- return (ret == 0);
-
-}
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_flow_block_type(void)
-{
- static PyMethodDef py_flow_block_methods[] = {
- { NULL }
- };
-
- static PyGetSetDef py_flow_block_getseters[] = {
- { NULL }
- };
-
- static PyTypeObject py_flow_block_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.analysis.blocks.FlowBlock",
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide flow block",
-
- .tp_methods = py_flow_block_methods,
- .tp_getset = py_flow_block_getseters,
-
- };
-
- return &py_flow_block_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide...blocks.FlowBlock'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_flow_block(PyObject *module)
-{
- PyTypeObject *py_flow_block_type; /* Type Python 'FlowBlock' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_flow_block_type = get_python_flow_block_type();
-
- dict = PyModule_GetDict(module);
-
- if (!register_class_for_pygobject(dict, G_TYPE_FLOW_BLOCK, py_flow_block_type, get_python_instr_block_type()))
- return false;
-
- return true;
-
-}
diff --git a/plugins/pychrysa/analysis/blocks/flow.h b/plugins/pychrysa/analysis/blocks/flow.h
deleted file mode 100644
index 8ffae1a..0000000
--- a/plugins/pychrysa/analysis/blocks/flow.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * flow.h - prototypes pour l'équivalent Python du fichier "analysis/blocks/flow.h"
- *
- * Copyright (C) 2013 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSA_ANALYSIS_BLOCKS_FLOW_H
-#define _PLUGINS_PYCHRYSA_ANALYSIS_BLOCKS_FLOW_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_flow_block_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.analysis.blocks.FlowBlock'. */
-bool register_python_flow_block(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_BLOCKS_FLOW_H */
diff --git a/plugins/pychrysa/analysis/blocks/module.c b/plugins/pychrysa/analysis/blocks/module.c
deleted file mode 100644
index 857d69f..0000000
--- a/plugins/pychrysa/analysis/blocks/module.c
+++ /dev/null
@@ -1,91 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.c - intégration du répertoire blocks en tant que module
- *
- * Copyright (C) 2013 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "module.h"
-
-
-#include <assert.h>
-
-
-#include "flow.h"
-#include "virtual.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Ajoute le module 'blocks' au module Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_analysis_blocks_module_to_python_module(PyObject *super)
-{
- bool result; /* Bilan à retourner */
- PyObject *module; /* Sous-module mis en place */
- int ret; /* Bilan d'un appel */
-
- static PyModuleDef py_chrysalide_blocks_module = {
-
- .m_base = PyModuleDef_HEAD_INIT,
-
- .m_name = "pychrysalide.analysis.blocks",
- .m_doc = "Python module for Chrysalide.analysis.blocks",
-
- .m_size = -1,
-
- };
-
- result = false;
-
- module = PyModule_Create(&py_chrysalide_blocks_module);
- if (module == NULL) return false;
-
- ret = PyState_AddModule(super, &py_chrysalide_blocks_module);
- if (ret != 0) goto loading_failed;
-
- ret = _PyImport_FixupBuiltin(module, "pychrysalide.analysis.blocks");
- if (ret != 0) goto loading_failed;
-
- Py_INCREF(module);
- ret = PyModule_AddObject(super, "blocks", module);
- if (ret != 0) goto loading_failed;
-
- result = true;
-
- result &= register_python_flow_block(module);
- result &= register_python_virtual_block(module);
-
- loading_failed:
-
- assert(result);
-
- return result;
-
-}
diff --git a/plugins/pychrysa/analysis/blocks/module.h b/plugins/pychrysa/analysis/blocks/module.h
deleted file mode 100644
index 68959bd..0000000
--- a/plugins/pychrysa/analysis/blocks/module.h
+++ /dev/null
@@ -1,39 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.h - prototypes pour l'intégration du répertoire blocks en tant que module
- *
- * Copyright (C) 2013 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYOIDA_ANALYSIS_BLOCKS_MODULE_H
-#define _PLUGINS_PYOIDA_ANALYSIS_BLOCKS_MODULE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Ajoute le module 'blocks' au module Python. */
-bool add_analysis_blocks_module_to_python_module(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYOIDA_ANALYSIS_BLOCKS_MODULE_H */
diff --git a/plugins/pychrysa/analysis/blocks/virtual.c b/plugins/pychrysa/analysis/blocks/virtual.c
deleted file mode 100644
index 4879f62..0000000
--- a/plugins/pychrysa/analysis/blocks/virtual.c
+++ /dev/null
@@ -1,108 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * virtual.h - équivalent Python du fichier "analysis/blocks/virtual.c"
- *
- * Copyright (C) 2013 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "virtual.h"
-
-
-#include <pygobject.h>
-
-
-#include <analysis/blocks/virtual.h>
-
-
-#include "../block.h"
-#include "../../helpers.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_virtual_block_type(void)
-{
- static PyMethodDef py_virtual_block_methods[] = {
- { NULL }
- };
-
- static PyGetSetDef py_virtual_block_getseters[] = {
- { NULL }
- };
-
- static PyTypeObject py_virtual_block_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.analysis.blocks.VirtualBlock",
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide virtual block",
-
- .tp_methods = py_virtual_block_methods,
- .tp_getset = py_virtual_block_getseters,
-
- };
-
- return &py_virtual_block_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide...blocks.VirtualBlock'.*
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_virtual_block(PyObject *module)
-{
- PyTypeObject *py_virtual_block_type; /* Type Python 'VirtualBlock' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_virtual_block_type = get_python_virtual_block_type();
-
- dict = PyModule_GetDict(module);
-
- if (!register_class_for_pygobject(dict, G_TYPE_VIRTUAL_BLOCK,
- py_virtual_block_type, get_python_instr_block_type()))
- return false;
-
- return true;
-
-}
diff --git a/plugins/pychrysa/analysis/blocks/virtual.h b/plugins/pychrysa/analysis/blocks/virtual.h
deleted file mode 100644
index a5e8063..0000000
--- a/plugins/pychrysa/analysis/blocks/virtual.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * virtual.h - prototypes pour l'équivalent Python du fichier "analysis/blocks/virtual.h"
- *
- * Copyright (C) 2013 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSA_ANALYSIS_BLOCKS_VIRTUAL_H
-#define _PLUGINS_PYCHRYSA_ANALYSIS_BLOCKS_VIRTUAL_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_virtual_block_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.analysis.blocks.VirtualBlock'. */
-bool register_python_virtual_block(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_BLOCKS_VIRTUAL_H */
diff --git a/plugins/pychrysa/analysis/module.c b/plugins/pychrysa/analysis/module.c
index 1e1ab90..cfcd206 100644
--- a/plugins/pychrysa/analysis/module.c
+++ b/plugins/pychrysa/analysis/module.c
@@ -32,7 +32,6 @@
#include "block.h"
#include "content.h"
#include "routine.h"
-#include "blocks/module.h"
#include "contents/module.h"
#include "db/module.h"
@@ -89,7 +88,6 @@ bool add_analysis_module_to_python_module(PyObject *super)
//result &= register_python_binary_content(module);
result &= register_python_binary_routine(module);
- result &= add_analysis_blocks_module_to_python_module(module);
result &= add_analysis_contents_module_to_python_module(module);
result &= add_analysis_db_module_to_python_module(module);
diff --git a/src/analysis/Makefile.am b/src/analysis/Makefile.am
index a8b1538..3d45a26 100755
--- a/src/analysis/Makefile.am
+++ b/src/analysis/Makefile.am
@@ -15,7 +15,6 @@ libanalysis_la_SOURCES = \
variable.h variable.c
libanalysis_la_LIBADD = \
- blocks/libanalysisblocks.la \
contents/libanalysiscontents.la \
db/libanalysisdb.la \
db/libanalysiskeys.la \
@@ -32,4 +31,4 @@ AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-SUBDIRS = blocks contents db disass human types
+SUBDIRS = contents db disass human types
diff --git a/src/analysis/blocks/Makefile.am b/src/analysis/blocks/Makefile.am
deleted file mode 100755
index 500f02e..0000000
--- a/src/analysis/blocks/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-
-noinst_LTLIBRARIES = libanalysisblocks.la
-
-libanalysisblocks_la_SOURCES = \
- flow.h flow.c \
- raccess.h raccess.c \
- virtual.h virtual.c
-
-libanalysisblocks_la_LIBADD =
-
-libanalysisblocks_la_LDFLAGS =
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-
-SUBDIRS =
diff --git a/src/analysis/blocks/flow.c b/src/analysis/blocks/flow.c
deleted file mode 100644
index 041a134..0000000
--- a/src/analysis/blocks/flow.c
+++ /dev/null
@@ -1,711 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * flow.c - encadrement des instructions par blocs d'exécution
- *
- * Copyright (C) 2012-2013 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/>.
- */
-
-
-#include "flow.h"
-
-
-#include <malloc.h>
-#include <sys/param.h>
-
-
-#include "../block-int.h"
-
-
-
-/* Description d'un bloc d'exécution d'instructions (instance) */
-struct _GFlowBlock
-{
- GInstrBlock parent; /* A laisser en premier */
-
- unsigned int rank; /* Rang dans l'exécution */
- unsigned int next_rank; /* Rang suivant de l'exécution */
-
- GArchProcessor *proc; /* Liste complète d'instruct° */
- GArchInstruction *first; /* Première instruction */
- GArchInstruction *last; /* Dernière instruction */
-
- GRAccessList *regs; /* Accès aux registres */
- GRAccessList *awaited; /* Registres définis pour après*/
-
-};
-
-/* Description d'un bloc d'exécution d'instructions (classe) */
-struct _GFlowBlockClass
-{
- GInstrBlockClass parent; /* A laisser en premier */
-
-};
-
-
-/* Initialise la classe des blocs d'instructions. */
-static void g_flow_block_class_init(GFlowBlockClass *);
-
-/* Initialise un bloc d'instructions. */
-static void g_flow_block_init(GFlowBlock *);
-
-/* Supprime toutes les références externes. */
-static void g_flow_block_dispose(GFlowBlock *);
-
-/* Procède à la libération totale de la mémoire. */
-static void g_flow_block_finalize(GFlowBlock *);
-
-/* Recherche le bloc contenant une adresse donnée. */
-static GInstrBlock *g_flow_block_find_by_addr(const GFlowBlock *, const vmpa2t *, bool);
-
-/* Parcourt le bloc d'instructions dans un ordre donné. */
-static bool g_flow_block_visit(GFlowBlock *, instr_block_visitor_cb, void *);
-
-/* Etablit la liste de tous les blocs présents. */
-static void g_flow_block_list_all_blocks(const GFlowBlock *, GInstrBlock ***, size_t *);
-
-/* Etablit la liste de tous les blocs terminaux. */
-static void g_flow_block_list_leafs_blocks(const GFlowBlock *, GInstrBlock ***, size_t *);
-
-/* Prend note de l'usage d'un registre, au besoin. */
-static void g_flow_block_memorize_access(GFlowBlock *, GArchRegister *, RegAccessType, vmpa_t);
-
-/* Note les différents accès aux registres. */
-static void g_flow_block_compute_regs_access(GFlowBlock *);
-
-/* Fournit les différents accès aux registres. */
-//static const reg_access *g_flow_block_list_regs_accesses(const GFlowBlock *, size_t *);
-
-
-
-/* Indique le type défini pour un bloc d'exécution d'instructions. */
-G_DEFINE_TYPE(GFlowBlock, g_flow_block, G_TYPE_INSTR_BLOCK);
-
-
-/******************************************************************************
-* *
-* Paramètres : class = classe à initialiser. *
-* *
-* Description : Initialise la classe des blocs d'instructions. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_flow_block_class_init(GFlowBlockClass *class)
-{
- GObjectClass *object; /* Autre version de la classe */
- GInstrBlockClass *block_class; /* Version parente du la classe*/
-
- object = G_OBJECT_CLASS(class);
- block_class = G_INSTR_BLOCK_CLASS(class);
-
- object->dispose = (GObjectFinalizeFunc/* ! */)g_flow_block_dispose;
- object->finalize = (GObjectFinalizeFunc)g_flow_block_finalize;
-
- block_class->find_by_addr = (find_by_addr_fc)g_flow_block_find_by_addr;
- block_class->visit_blocks = (visit_all_blocks_fc)g_flow_block_visit;
- block_class->list_blocks = (list_all_blocks_fc)g_flow_block_list_all_blocks;
- block_class->list_leafs = (list_leafs_blocks_fc)g_flow_block_list_leafs_blocks;
- //block_class->list_regs = (list_regs_accesses_fc)g_flow_block_list_regs_accesses;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance à initialiser. *
-* *
-* Description : Initialise un bloc d'instructions. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_flow_block_init(GFlowBlock *block)
-{
- g_flow_block_set_rank(block, 0);
-
- block->regs = g_raccess_list_new();
- block->awaited = g_raccess_list_new();
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance d'objet GLib à traiter. *
-* *
-* Description : Supprime toutes les références externes. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_flow_block_dispose(GFlowBlock *block)
-{
- //g_object_unref(G_OBJECT(block->proc));
- g_object_unref(G_OBJECT(block->first));
- g_object_unref(G_OBJECT(block->last));
-
- g_object_unref(G_OBJECT(block->regs));
- g_object_unref(G_OBJECT(block->awaited));
-
- G_OBJECT_CLASS(g_flow_block_parent_class)->dispose(G_OBJECT(block));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance d'objet GLib à traiter. *
-* *
-* Description : Procède à la libération totale de la mémoire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_flow_block_finalize(GFlowBlock *block)
-{
- G_OBJECT_CLASS(g_flow_block_parent_class)->finalize(G_OBJECT(block));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : proc = liste de toutes les instructions. *
-* first = première instruction du bloc. *
-* last = dernière instruction du bloc. *
-* *
-* Description : Crée un bloc d'exécution d'instructions. *
-* *
-* Retour : Adresse de la structure mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GInstrBlock *g_flow_block_new(GArchProcessor *proc, GArchInstruction *first, GArchInstruction *last)
-{
- GFlowBlock *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_FLOW_BLOCK, NULL);
-
- /* FIXME : proc non utilisé ! */
-
- result->proc = proc;
- result->first = first;
- result->last = last;
-
- //g_object_ref(G_OBJECT(result->proc));
- g_object_ref(G_OBJECT(result->first));
- g_object_ref(G_OBJECT(result->last));
-
- //g_flow_block_compute_regs_access(result);
-
- return G_INSTR_BLOCK(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instruction à consulter. *
-* *
-* Description : Fournit le rang du bloc dans le flot d'exécution. *
-* *
-* Retour : Indice supérieur ou égal à zéro. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-unsigned int g_flow_block_get_rank(const GFlowBlock *block)
-{
- return block->rank;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instruction à consulter. *
-* rank = Indice supérieur à zéro à prendre en compte. *
-* *
-* Description : Définit le rang du bloc dans le flot d'exécution. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_flow_block_set_rank(GFlowBlock *block, unsigned int rank)
-{
- block->rank = rank;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc de départ des recherches. *
-* addr = ensemble de blocs à parcourir. *
-* final = indique si la cible ou le conteneur est renvoyée. *
-* *
-* Description : Recherche le bloc contenant une adresse donnée. *
-* *
-* Retour : bloc basique trouvé ou NULL en cas d'échec. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GInstrBlock *g_flow_block_find_by_addr(const GFlowBlock *block, const vmpa2t *addr, bool final)
-{
- GInstrBlock *result; /* Resultat à retourner */
- vmpa2t start; /* Adresse de début du bloc */
- vmpa2t end; /* Adresse de fin du bloc */
- mrange_t range; /* Couverture globale */
-
- g_flow_block_get_boundary_addresses(block, &start, &end);
-
- init_mrange(&range, &start, compute_vmpa_diff(&start, &end));
-
- if (mrange_contains_addr(&range, addr))
- result = G_INSTR_BLOCK(block);
-
- else
- result = NULL;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions concerné par la visite. *
-* callback = ensemble de blocs à parcourir. *
-* data = donnée utilisateur à associer au parcours. *
-* *
-* Description : Parcourt le bloc d'instructions dans un ordre donné. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_flow_block_visit(GFlowBlock *block, instr_block_visitor_cb callback, void *data)
-{
- return callback(G_INSTR_BLOCK(block), BVO_PENDING, data);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* list = ensemble de blocs à compléter. [OUT] *
-* count = nombre de blocs au total. [OUT] *
-* *
-* Description : Etablit la liste de tous les blocs présents. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_flow_block_list_all_blocks(const GFlowBlock *block, GInstrBlock ***list, size_t *count)
-{
- (*list) = (GInstrBlock **)realloc(*list, ++(*count) * sizeof(GInstrBlock *));
-
- (*list)[*count - 1] = G_INSTR_BLOCK(block);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* list = ensemble de blocs à compléter. [OUT] *
-* count = nombre de blocs au total. [OUT] *
-* *
-* Description : Etablit la liste de tous les blocs terminaux. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_flow_block_list_leafs_blocks(const GFlowBlock *block, GInstrBlock ***list, size_t *count)
-{
- (*list) = (GInstrBlock **)realloc(*list, ++(*count) * sizeof(GInstrBlock *));
-
- (*list)[*count - 1] = G_INSTR_BLOCK(block);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à mettre à jour. *
-* reg = registre visé par l'opération. *
-* type = type d'accès à l'opérande. *
-* addr = adresse de l'instruction associée. *
-* *
-* Description : Prend note de l'usage d'un registre, au besoin. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_flow_block_memorize_access(GFlowBlock *block, GArchRegister *reg, RegAccessType type, vmpa_t addr)
-{
- reg_access *found; /* Accès à mettre à jour */
- reg_access access; /* Accès à mettre en place */
-
- found = g_raccess_list_find(block->regs, reg);
-
- /* Simpple mise à jour ? */
- if (found != NULL)
- {
- if (type == RAT_WRITE)
- found->last_write = addr;
- }
-
- /* Ou ajout pur et simple ? */
- else
- {
- access.reg = reg;
- access.first_access = type;
- access.last_write = (type == RAT_WRITE ? addr : VMPA_MAX);
-
- g_raccess_list_add(block->regs, &access);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à parcourir. *
-* *
-* Description : Note les différents accès aux registres. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_flow_block_compute_regs_access(GFlowBlock *block)
-{
- GArchInstruction *iter; /* Boucle de parcours #1 */
- vmpa_t max; /* Adresse de fin */
- vmpa_t addr; /* Adresse d'instruction */
- GArchRegister **rregs; /* Liste des registres lus */
- size_t rcount; /* Nombre de registres lus */
- GArchRegister **wregs; /* Liste des registres écrits */
- size_t wcount; /* Nombre de registres écrits */
- size_t i; /* Boucle de parcours #2 */
-
- g_arch_instruction_get_location(block->last, NULL, NULL, &max);
- max++;
-
- for (iter = block->first;
- iter != NULL;
- iter = NULL/* FIXME g_arch_instruction_get_next_iter(block->instrs, iter, max)*/)
- {
- g_arch_instruction_get_location(iter, NULL, NULL, &addr);
-
- g_arch_instruction_get_rw_registers(iter, &rregs, &rcount, &wregs, &wcount);
-
- for (i = 0; i < rcount; i++)
- {
- g_flow_block_memorize_access(block, rregs[i], RAT_READ, addr);
- g_object_unref(G_OBJECT(rregs[i]));
- }
-
- for (i = 0; i < wcount; i++)
- {
- g_flow_block_memorize_access(block, wregs[i], RAT_WRITE, addr);
- g_object_unref(G_OBJECT(wregs[i]));
- }
-
- if (rregs != NULL) free(rregs);
- if (wregs != NULL) free(wregs);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* *
-* Description : Donne le processeur d'appartenance des instructions du bloc. *
-* *
-* Retour : Liste de l'ensemble des instructions. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchProcessor *g_flow_block_get_processor(const GFlowBlock *block)
-{
- return block->proc;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* first = instruction de départ du bloc. [OUT] *
-* last = dernière instruction du bloc. [OUT] *
-* *
-* Description : Fournit les instructions limites d'un bloc d'exécution. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_flow_block_get_boundary(const GFlowBlock *block, GArchInstruction **first, GArchInstruction **last)
-{
- if (first != NULL)
- *first = block->first;
-
- if (last != NULL)
- *last = block->last;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* start = adresse de départ du bloc. [OUT] *
-* end = dernière adresse du bloc. [OUT] *
-* *
-* Description : Fournit les adresses limites d'un bloc d'exécution. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_flow_block_get_boundary_addresses(const GFlowBlock *block, vmpa2t *start, vmpa2t *end)
-{
- const mrange_t *range; /* Couverture d'instruction */
-
- if (start != NULL)
- {
- range = g_arch_instruction_get_range(block->first);
- copy_vmpa(start, get_mrange_addr(range));
- }
-
- if (end != NULL)
- {
- range = g_arch_instruction_get_range(block->last);
- copy_vmpa(end, get_mrange_addr(range));
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions démarrant la visite. *
-* list = ensemble des blocs basiques à parcourir. *
-* target = bloc de fin de parcours. *
-* *
-* Description : Détermine si un bloc peut conduire à un autre. *
-* *
-* Retour : true si un lien existe entre les deux blocs fournis. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_flow_block_is_looping_to(GFlowBlock *block, const GInstrBlock *list, GFlowBlock *target)
-{
- bool result; /* Bilan à retourner */
- instr_link_t *dests; /* Instr. visées par une autre */
- size_t dcount; /* Nombre de liens de dest. */
- size_t i; /* Boucle de parcours */
- vmpa_t addr; /* Adresse de la destination */
- GInstrBlock *next; /* Bloc suivant à visiter */
-
- result = (block == target);
-
- g_arch_instruction_rlock_dest(block->last);
- dcount = g_arch_instruction_get_destinations(block->last, &dests);
-
- for (i = 0; i < dcount && !result; i++)
- switch (dests[i].type)
- {
- case ILT_EXEC_FLOW:
- case ILT_JUMP:
- case ILT_CASE_JUMP:
- case ILT_JUMP_IF_TRUE:
- case ILT_JUMP_IF_FALSE:
- g_arch_instruction_get_location(dests[i].linked, NULL, NULL, &addr);
- next = g_instr_block_find_by_addr(list, addr, true);
- result = g_flow_block_is_looping_to(G_FLOW_BLOCK(next), list, target);
- break;
-
- case ILT_LOOP:
- g_arch_instruction_get_location(dests[i].linked, NULL, NULL, &addr);
- next = g_instr_block_find_by_addr(list, addr, true);
- result = (G_FLOW_BLOCK(next) == target);
- default:
- break;
-
- }
-
- g_arch_instruction_runlock_dest(block->last);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions démarrant la visite. *
-* list = ensemble des blocs basiques à parcourir. *
-* mask = points de passage à marquer. *
-* callback = ensemble de blocs à parcourir. *
-* data = donnée utilisateur à associer au parcours. *
-* *
-* Description : Suit le flot d'excution bloc par bloc. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_flow_block_follow(GFlowBlock *block, const GInstrBlock *list, BlockFollowPosition mask, flow_block_follow_cb callback, void *data)
-{
- bool result; /* Bilan à retourner */
- instr_link_t *dests; /* Instr. visées par une autre */
- size_t dcount; /* Nombre de liens de dest. */
- size_t i; /* Boucle de parcours */
- vmpa_t addr; /* Adresse de la destination */
- GInstrBlock *next; /* Bloc suivant à visiter */
-
- result = true;
-
- if (mask & BFP_ENTER)
- result = callback(block, BFP_ENTER, data);
-
- g_arch_instruction_rlock_dest(block->last);
- dcount = g_arch_instruction_get_destinations(block->last, &dests);
-
- for (i = 0; i < dcount && result; i++)
- switch (dests[i].type)
- {
- case ILT_EXEC_FLOW:
- case ILT_JUMP:
- case ILT_CASE_JUMP:
- case ILT_JUMP_IF_TRUE:
- case ILT_JUMP_IF_FALSE:
-
- g_arch_instruction_get_location(dests[i].linked, NULL, NULL, &addr);
- next = g_instr_block_find_by_addr(list, addr, true);
-
- if (next)
- {
- result = callback(block, BFP_FOLLOW, data);
- result &= g_flow_block_follow(G_FLOW_BLOCK(next), list, mask, callback, data);
- result &= callback(block, BFP_BACK, data);
- }
- break;
-
- default:
- break;
-
- }
-
- g_arch_instruction_runlock_dest(block->last);
-
- if (mask & BFP_EXIT)
- result &= callback(block, BFP_EXIT, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* *
-* Description : Fournit les différents accès aux registres. *
-* *
-* Retour : Liste des accès aux registres. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const GRAccessList *g_flow_block_list_regs_accesses(const GFlowBlock *block)
-{
- return block->regs;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* *
-* Description : Fournit les registres écrits par le bloc et utilisées après. *
-* *
-* Retour : Liste des accès aux registres. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRAccessList *g_flow_block_list_awaited_regs(const GFlowBlock *block)
-{
- return block->awaited;
-
-}
diff --git a/src/analysis/blocks/flow.h b/src/analysis/blocks/flow.h
deleted file mode 100644
index 45671ad..0000000
--- a/src/analysis/blocks/flow.h
+++ /dev/null
@@ -1,102 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * flow.h - prototypes pour l'encadrement des instructions par blocs d'exécution
- *
- * Copyright (C) 2012-2013 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 _ANALYSIS_BLOCKS_FLOW_H
-#define _ANALYSIS_BLOCKS_FLOW_H
-
-
-#include <glib.h>
-#include <glib-object.h>
-
-
-#include "raccess.h"
-#include "../block.h"
-#include "../../arch/processor.h"
-
-
-
-#define G_TYPE_FLOW_BLOCK g_flow_block_get_type()
-#define G_FLOW_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_flow_block_get_type(), GFlowBlock))
-#define G_IS_FLOW_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_flow_block_get_type()))
-#define G_FLOW_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FLOW_BLOCK, GFlowBlockClass))
-#define G_IS_FLOW_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FLOW_BLOCK))
-#define G_FLOW_BLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_FLOW_BLOCK, GFlowBlockClass))
-
-
-/* Description d'un bloc d'exécution d'instructions (instance) */
-typedef struct _GFlowBlock GFlowBlock;
-
-/* Description d'un bloc d'exécution d'instructions (classe) */
-typedef struct _GFlowBlockClass GFlowBlockClass;
-
-
-/* Position au cours d'une visite */
-typedef enum _BlockFollowPosition
-{
- BFP_ENTER = (1 << 0), /* Entrée dans le bloc */
- BFP_FOLLOW = (1 << 1), /* Suivi des liens : aller... */
- BFP_BACK = (1 << 2), /* Suivi des liens : retour ! */
- BFP_EXIT = (1 << 3) /* Sortie du bloc */
-
-} BlockFollowPosition;
-
-/* Rappel à chaque bloc visité */
-typedef bool (* flow_block_follow_cb) (GFlowBlock *, BlockFollowPosition, void *);
-
-
-/* Indique le type défini pour un bloc d'exécution d'instructions. */
-GType g_flow_block_get_type(void);
-
-/* Crée un bloc d'exécution d'instructions. */
-GInstrBlock *g_flow_block_new(GArchProcessor *, GArchInstruction *, GArchInstruction *);
-
-/* Fournit le rang du bloc dans le flot d'exécution. */
-unsigned int g_flow_block_get_rank(const GFlowBlock *);
-
-/* Définit le rang du bloc dans le flot d'exécution. */
-void g_flow_block_set_rank(GFlowBlock *, unsigned int);
-
-/* Donne le processeur d'appartenance des instructions du bloc. */
-GArchProcessor *g_flow_block_get_processor(const GFlowBlock *);
-
-/* Fournit les instructions limites d'un bloc d'exécution. */
-void g_flow_block_get_boundary(const GFlowBlock *, GArchInstruction **, GArchInstruction **);
-
-/* Fournit les adresses limites d'un bloc d'exécution. */
-void g_flow_block_get_boundary_addresses(const GFlowBlock *, vmpa2t *, vmpa2t *);
-
-/* Détermine si un bloc peut conduire à un autre. */
-bool g_flow_block_is_looping_to(GFlowBlock *, const GInstrBlock *, GFlowBlock *);
-
-/* Suit le flot d'excution bloc par bloc. */
-bool g_flow_block_follow(GFlowBlock *, const GInstrBlock *, BlockFollowPosition, flow_block_follow_cb, void *);
-
-/* Fournit les différents accès aux registres. */
-const GRAccessList *g_flow_block_list_regs_accesses(const GFlowBlock *);
-
-/* Fournit les registres écrits par le bloc et utilisées après. */
-GRAccessList *g_flow_block_list_awaited_regs(const GFlowBlock *);
-
-
-
-#endif /* _ANALYSIS_BLOCKS_FLOW_H */
diff --git a/src/analysis/blocks/raccess.c b/src/analysis/blocks/raccess.c
deleted file mode 100644
index 1a3e978..0000000
--- a/src/analysis/blocks/raccess.c
+++ /dev/null
@@ -1,387 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * raccess.c - suivi des accès aux registres
- *
- * Copyright (C) 2013 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/>.
- */
-
-
-#include "raccess.h"
-
-
-#include <malloc.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-
-/* Description d'une liste d'accès à des registres (instance) */
-struct _GRAccessList
-{
- GObject parent; /* A laisser en premier */
-
- reg_access *accesses; /* Liste des accès */
- size_t count; /* Taille de cette liste */
-
-};
-
-/* Description d'une liste d'accès à des registres (classe) */
-struct _GRAccessListClass
-{
- GObjectClass parent; /* A laisser en premier */
-
-};
-
-
-/* Initialise la classe des listes d'accès aux registres. */
-static void g_raccess_list_class_init(GRAccessListClass *);
-
-/* Initialise une liste d'accès aux registres. */
-static void g_raccess_list_init(GRAccessList *);
-
-/* Supprime toutes les références externes. */
-static void g_raccess_list_dispose(GRAccessList *);
-
-/* Procède à la libération totale de la mémoire. */
-static void g_raccess_list_finalize(GRAccessList *);
-
-
-
-/* Indique le type défini pour une liste d'accès à des registres. */
-G_DEFINE_TYPE(GRAccessList, g_raccess_list, G_TYPE_OBJECT);
-
-
-/******************************************************************************
-* *
-* Paramètres : class = classe à initialiser. *
-* *
-* Description : Initialise la classe des listes d'accès aux registres. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_raccess_list_class_init(GRAccessListClass *class)
-{
- GObjectClass *object; /* Autre version de la classe */
-
- object = G_OBJECT_CLASS(class);
-
- object->dispose = (GObjectFinalizeFunc/* ! */)g_raccess_list_dispose;
- object->finalize = (GObjectFinalizeFunc)g_raccess_list_finalize;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : list = instance à initialiser. *
-* *
-* Description : Initialise une liste d'accès aux registres. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_raccess_list_init(GRAccessList *list)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance d'objet GLib à traiter. *
-* *
-* Description : Supprime toutes les références externes. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_raccess_list_dispose(GRAccessList *list)
-{
- size_t i; /* Boucle de parcours */
-
- for (i = 0; i < list->count; i++)
- g_object_unref(G_OBJECT(list->accesses[i].reg));
-
- if (list->accesses != NULL)
- free(list->accesses);
-
- G_OBJECT_CLASS(g_raccess_list_parent_class)->dispose(G_OBJECT(list));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance d'objet GLib à traiter. *
-* *
-* Description : Procède à la libération totale de la mémoire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_raccess_list_finalize(GRAccessList *list)
-{
- G_OBJECT_CLASS(g_raccess_list_parent_class)->finalize(G_OBJECT(list));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Crée une liste d'accès à des registres. *
-* *
-* Retour : Adresse de la structure mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRAccessList *g_raccess_list_new(void)
-{
- GRAccessList *result; /* Liste à retourner */
-
- result = g_object_new(G_TYPE_RACCESS_LIST, NULL);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : list = liste des accès à venir grossir. *
-* src = liste dont les accès sont à reprendre. *
-* *
-* Description : Intègre une liste d'accès à des registres dans une autre. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_raccess_list_merge(GRAccessList *list, const GRAccessList *src)
-{
- size_t count; /* Taille d'un parcours */
- size_t i; /* Boucle de parcours */
- reg_access *access; /* Accès à un registre */
-
- count = g_raccess_list_count(src);
-
- for (i = 0; i < count; i++)
- {
- access = g_raccess_list_get(src, i);
-
- if (g_raccess_list_find(list, access->reg) == NULL)
- g_raccess_list_add(list, access);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : a = premier opérande à consulter. *
-* b = second opérande à consulter. *
-* *
-* Description : Compare un accès registre avec un autre. *
-* *
-* Retour : Bilan de la comparaison. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-int compare_reg_accesses(const reg_access *a, const reg_access *b)
-{
- return g_arch_register_compare(a->reg, b->reg);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : list = ensemble d'accès à consulter. *
-* reg = registre matériel à rechercher. *
-* *
-* Description : Recherche des informations existantes sur un registre. *
-* *
-* Retour : Bilan de la recherche. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-reg_access *g_raccess_list_find(const GRAccessList *list, GArchRegister *reg)
-{
- reg_access *result; /* Trouaille à retourner */
-
- result = bsearch((reg_access []) { { .reg = reg } }, list->accesses, list->count,
- sizeof(reg_access), (__compar_fn_t)compare_reg_accesses);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : list = ensemble d'accès à mettre à jour. *
-* template = patron de l'accès à intégrer. *
-* *
-* Description : Recherche des informations existantes sur un registre. *
-* *
-* Retour : Bilan de la recherche. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_raccess_list_add(GRAccessList *list, const reg_access *template)
-{
- g_object_ref(G_OBJECT(template->reg));
-
- list->accesses = (reg_access *)realloc(list->accesses, ++list->count * sizeof(reg_access));
- list->accesses[list->count - 1] = *template;
-
- qsort(list->accesses, list->count, sizeof(reg_access), (__compar_fn_t)compare_reg_accesses);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : list = ensemble d'accès à consulter. *
-* *
-* Description : Dénombre les accès aux registres comptabilisés. *
-* *
-* Retour : Quantité d'accès pris en compte. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-size_t g_raccess_list_count(const GRAccessList *list)
-{
- return list->count;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : list = ensemble d'accès à consulter. *
-* index = indice de l'accès recherché. *
-* *
-* Description : Fournit un accès donné de la liste. *
-* *
-* Retour : Accès à un registre. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-reg_access *g_raccess_list_get(const GRAccessList *list, size_t index)
-{
- reg_access *result; /* Accès à renvoyer */
-
- if (index >= list->count)
- result = NULL;
- else
- result = &list->accesses[index];
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : list = ensemble d'accès à mettre à jour. *
-* access = accès visé par la procédure. *
-* *
-* Description : Retire un accès donné de la liste. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_raccess_list_delete(GRAccessList *list, reg_access *access)
-{
- size_t index; /* Indice correspondant */
-
- if (list->count > 0)
- {
- index = (access - list->accesses) / sizeof(reg_access);
- g_raccess_list_delete_by_index(list, index);
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : list = ensemble d'accès à mettre à jour. *
-* index = indice de l'accès visé par la procédure. *
-* *
-* Description : Retire un accès donné de la liste. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_raccess_list_delete_by_index(GRAccessList *list, size_t index)
-{
- if (index >= list->count)
- return;
-
- if ((index + 1) < list->count)
- memmove(&list->accesses[index], &list->accesses[index + 1],
- (list->count - index - 1) * sizeof(reg_access));
-
- list->count--;
-
- if (list->count == 0)
- {
- free(list->accesses);
- list->accesses = NULL;
- }
- else
- list->accesses = (reg_access *)realloc(list->accesses, list->count * sizeof(reg_access));
-
-}
diff --git a/src/analysis/blocks/raccess.h b/src/analysis/blocks/raccess.h
deleted file mode 100644
index 4aa791f..0000000
--- a/src/analysis/blocks/raccess.h
+++ /dev/null
@@ -1,105 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * raccess.h - prototypes pour le suivi des accès aux registres
- *
- * Copyright (C) 2013 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 _ANALYSIS_BLOCKS_RACCESS_H
-#define _ANALYSIS_BLOCKS_RACCESS_H
-
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <stdbool.h>
-
-
-#include "../../arch/register.h"
-
-
-
-/* Note sur le premier accès */
-typedef enum _RegAccessType
-{
- RAT_NONE = (0 << 0), /* Registre non rencontré */
- RAT_READ = (1 << 0), /* Lecture */
- RAT_WRITE = (1 << 1) /* Ecriture */
-
-} RegAccessType;
-
-/* Description minimale des accès à un registre */
-typedef struct _reg_access
-{
- GArchRegister *reg; /* Register concerné */
-
- RegAccessType first_access; /* Type du premier accès */
- vmpa_t last_write; /* Dernière écriture */
-
-} reg_access;
-
-
-#define G_TYPE_RACCESS_LIST g_raccess_list_get_type()
-#define G_RACCESS_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_raccess_list_get_type(), GRAccessList))
-#define G_IS_RACCESS_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_raccess_list_get_type()))
-#define G_RACCESS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_RACCESS_LIST, GRAccessListClass))
-#define G_IS_RACCESS_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_RACCESS_LIST))
-#define G_RACCESS_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_RACCESS_LIST, GRAccessListClass))
-
-
-/* Description d'une liste d'accès à des registres (instance) */
-typedef struct _GRAccessList GRAccessList;
-
-/* Description d'une liste d'accès à des registres (classe) */
-typedef struct _GRAccessListClass GRAccessListClass;
-
-
-/* Indique le type défini pour une liste d'accès à des registres. */
-GType g_raccess_list_get_type(void);
-
-/* Crée une liste d'accès à des registres. */
-GRAccessList *g_raccess_list_new(void);
-
-/* Intègre une liste d'accès à des registres dans une autre. */
-void g_raccess_list_merge(GRAccessList *, const GRAccessList *);
-
-/* Compare un accès registre avec un autre. */
-int compare_reg_accesses(const reg_access *, const reg_access *);
-
-/* Recherche des informations existantes sur un registre. */
-reg_access *g_raccess_list_find(const GRAccessList *, GArchRegister *);
-
-/* Recherche des informations existantes sur un registre. */
-void g_raccess_list_add(GRAccessList *, const reg_access *);
-
-/* Dénombre les accès aux registres comptabilisés. */
-size_t g_raccess_list_count(const GRAccessList *);
-
-/* Fournit un accès donné de la liste. */
-reg_access *g_raccess_list_get(const GRAccessList *, size_t);
-
-/* Retire un accès donné de la liste. */
-void g_raccess_list_delete(GRAccessList *, reg_access *);
-
-/* Retire un accès donné de la liste. */
-void g_raccess_list_delete_by_index(GRAccessList *, size_t);
-
-
-
-#endif /* _ANALYSIS_BLOCKS_RACCESS_H */
diff --git a/src/analysis/blocks/virtual.c b/src/analysis/blocks/virtual.c
deleted file mode 100644
index 8df6ffc..0000000
--- a/src/analysis/blocks/virtual.c
+++ /dev/null
@@ -1,419 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * virtual.c - encadrement des instructions par blocs virtuels
- *
- * Copyright (C) 2012-2013 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/>.
- */
-
-
-#include "virtual.h"
-
-
-#include <malloc.h>
-
-
-#include "flow.h"
-#include "../block-int.h"
-
-
-
-/* Description d'un bloc d'exécution d'instructions (instance) */
-struct _GVirtualBlock
-{
- GInstrBlock parent; /* A laisser en premier */
-
- GArchInstruction *instrs; /* Liste complète d'instruct° */
- GArchInstruction *first; /* Première instruction */
- GArchInstruction *last; /* Dernière instruction */
-
- GInstrBlock **children; /* Sous-blocs intégrés */
- size_t children_count; /* Nombre de ces sous-blocs */
-
-#if 0
- reg_access *accesses; /* Commodités d'accès #1 */
- size_t count; /* Commodités d'accès #2 */
-#endif
-
-};
-
-/* Description d'un bloc d'exécution d'instructions (classe) */
-struct _GVirtualBlockClass
-{
- GInstrBlockClass parent; /* A laisser en premier */
-
-};
-
-
-/* Initialise la classe des blocs d'instructions. */
-static void g_virtual_block_class_init(GVirtualBlockClass *);
-
-/* Initialise un bloc d'instructions. */
-static void g_virtual_block_init(GVirtualBlock *);
-
-/* Supprime toutes les références externes. */
-static void g_virtual_block_dispose(GVirtualBlock *);
-
-/* Procède à la libération totale de la mémoire. */
-static void g_virtual_block_finalize(GVirtualBlock *);
-
-/* Recherche le bloc contenant une adresse donnée. */
-static GInstrBlock *g_virtual_block_find_by_addr(const GVirtualBlock *, const vmpa2t *, bool);
-
-/* Parcourt le bloc d'instructions dans un ordre donné. */
-static bool g_virtual_block_visit(GVirtualBlock *, instr_block_visitor_cb, void *);
-
-/* Etablit la liste de tous les blocs présents. */
-static void g_virtual_block_list_all_blocks(const GVirtualBlock *, GInstrBlock ***, size_t *);
-
-/* Etablit la liste de tous les blocs terminaux. */
-static void g_virtual_block_list_leafs_blocks(const GVirtualBlock *, GInstrBlock ***, size_t *);
-
-/* Fournit les différents accès aux registres. */
-//static const reg_access *g_virtual_block_list_regs_accesses(const GVirtualBlock *, size_t *);
-
-
-
-/* Indique le type défini pour un bloc virtuel d'instructions. */
-G_DEFINE_TYPE(GVirtualBlock, g_virtual_block, G_TYPE_INSTR_BLOCK);
-
-
-/******************************************************************************
-* *
-* Paramètres : class = classe à initialiser. *
-* *
-* Description : Initialise la classe des blocs d'instructions. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_virtual_block_class_init(GVirtualBlockClass *class)
-{
- GObjectClass *object; /* Autre version de la classe */
- GInstrBlockClass *block_class; /* Version parente du la classe*/
-
- object = G_OBJECT_CLASS(class);
- block_class = G_INSTR_BLOCK_CLASS(class);
-
- object->dispose = (GObjectFinalizeFunc/* ! */)g_virtual_block_dispose;
- object->finalize = (GObjectFinalizeFunc)g_virtual_block_finalize;
-
- block_class->find_by_addr = (find_by_addr_fc)g_virtual_block_find_by_addr;
- block_class->visit_blocks = (visit_all_blocks_fc)g_virtual_block_visit;
- block_class->list_blocks = (list_all_blocks_fc)g_virtual_block_list_all_blocks;
- block_class->list_leafs = (list_leafs_blocks_fc)g_virtual_block_list_leafs_blocks;
- //block_class->list_regs = (list_regs_accesses_fc)g_virtual_block_list_regs_accesses;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance à initialiser. *
-* *
-* Description : Initialise un bloc d'instructions. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_virtual_block_init(GVirtualBlock *block)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance d'objet GLib à traiter. *
-* *
-* Description : Supprime toutes les références externes. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_virtual_block_dispose(GVirtualBlock *block)
-{
- size_t i; /* Boucle de parcours */
-
- for (i = 0; i < block->children_count; i++)
- g_object_unref(G_OBJECT(block->children[i]));
-
- G_OBJECT_CLASS(g_virtual_block_parent_class)->dispose(G_OBJECT(block));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance d'objet GLib à traiter. *
-* *
-* Description : Procède à la libération totale de la mémoire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_virtual_block_finalize(GVirtualBlock *block)
-{
- if (block->children != NULL)
- free(block->children);
-
- G_OBJECT_CLASS(g_virtual_block_parent_class)->finalize(G_OBJECT(block));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Crée un bloc virtuel d'instructions. *
-* *
-* Retour : Adresse de la structure mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GInstrBlock *g_virtual_block_new(void)
-{
- GVirtualBlock *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_VIRTUAL_BLOCK, NULL);
-
- return G_INSTR_BLOCK(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc de départ des recherches. *
-* addr = ensemble de blocs à parcourir. *
-* final = indique si la cible ou le conteneur est renvoyée. *
-* *
-* Description : Recherche le bloc contenant une adresse donnée. *
-* *
-* Retour : bloc basique trouvé ou NULL en cas d'échec. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GInstrBlock *g_virtual_block_find_by_addr(const GVirtualBlock *block, const vmpa2t *addr, bool final)
-{
- GInstrBlock *result; /* Resultat à retourner */
- size_t i; /* Boucle de parcours */
- GInstrBlock *ret; /* Retour des inspections */
-
- result = NULL;
-
- for (i = 0; i < block->children_count && result == NULL; i++)
- {
- ret = g_instr_block_find_by_addr(block->children[i], addr, final);
-
- if (ret != NULL)
- {
- if (final) result = ret;
- else result = (G_IS_FLOW_BLOCK(ret) ? G_INSTR_BLOCK(block) : ret);
- }
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions concerné par la visite. *
-* callback = ensemble de blocs à parcourir. *
-* data = donnée utilisateur à associer au parcours. *
-* *
-* Description : Parcourt le bloc d'instructions dans un ordre donné. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_virtual_block_visit(GVirtualBlock *block, instr_block_visitor_cb callback, void *data)
-{
- bool result; /* Bilan à retourner */
- size_t i; /* Boucle de parcours */
-
- result = callback(G_INSTR_BLOCK(block), BVO_IN, data);
-
- for (i = 0; i < block->children_count && result; i++)
- result = g_instr_block_visit(block->children[i], callback, data);
-
- result &= callback(G_INSTR_BLOCK(block), BVO_OUT, data);
-
- return true;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* list = ensemble de blocs à compléter. [OUT] *
-* count = nombre de blocs au total. [OUT] *
-* *
-* Description : Etablit la liste de tous les blocs présents. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_virtual_block_list_all_blocks(const GVirtualBlock *block, GInstrBlock ***list, size_t *count)
-{
- size_t i; /* Boucle de parcours */
-
- for (i = 0; i < block->children_count; i++)
- g_instr_block_list_all_blocks(block->children[i], list, count);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* list = ensemble de blocs à compléter. [OUT] *
-* count = nombre de blocs au total. [OUT] *
-* *
-* Description : Etablit la liste de tous les blocs terminaux. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_virtual_block_list_leafs_blocks(const GVirtualBlock *block, GInstrBlock ***list, size_t *count)
-{
- if (block->children_count > 0)
- g_instr_block_list_leafs_blocks(block->children[block->children_count - 1], list, count);
-
-}
-
-
-#if 0
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* count = nombre de registres consignés. [OUT] *
-* *
-* Description : Fournit les différents accès aux registres. *
-* *
-* Retour : Liste des accès aux registres. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static const reg_access *g_virtual_block_list_regs_accesses(const GVirtualBlock *block, size_t *count)
-{
- *count = 0;
-
- return NULL;
-
-}
-#endif
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à compléter. *
-* child = sous-bloc à insérer. *
-* *
-* Description : Ajoute un bloc au groupe courant. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_virtual_block_add_child(GVirtualBlock *block, GInstrBlock *child)
-{
- block->children = (GInstrBlock **)realloc(block->children,
- ++block->children_count * sizeof(GInstrBlock *));
-
- block->children[block->children_count - 1] = child;
-
- g_object_ref(G_OBJECT(child));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* *
-* Description : Compte le nombre de blocs contenus dans le groupe courant. *
-* *
-* Retour : Quantité normalement non nulle. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-size_t g_virtual_block_count_children(const GVirtualBlock *block)
-{
- return block->children_count;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = bloc d'instructions à consulter. *
-* index = indice du sous-bloc recherché. *
-* *
-* Description : Renvoie un des blocs contenus dans le groupe courant. *
-* *
-* Retour : Un des blocs du groupe. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GInstrBlock *g_virtual_block_get_child(const GVirtualBlock *block, size_t index)
-{
- if (index >= block->children_count)
- return NULL;
-
- else
- return block->children[index];
-
-}
diff --git a/src/analysis/blocks/virtual.h b/src/analysis/blocks/virtual.h
deleted file mode 100644
index 01e2103..0000000
--- a/src/analysis/blocks/virtual.h
+++ /dev/null
@@ -1,69 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * virtual.h - prototypes pour l'encadrement des instructions par blocs virtuels
- *
- * Copyright (C) 2012-2013 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 _ANALYSIS_BLOCKS_VIRTUAL_H
-#define _ANALYSIS_BLOCKS_VIRTUAL_H
-
-
-#include <glib.h>
-#include <glib-object.h>
-
-
-#include "../block.h"
-#include "../../arch/instruction.h"
-
-
-
-#define G_TYPE_VIRTUAL_BLOCK g_virtual_block_get_type()
-#define G_VIRTUAL_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_virtual_block_get_type(), GVirtualBlock))
-#define G_IS_VIRTUAL_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_virtual_block_get_type()))
-#define G_VIRTUAL_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_VIRTUAL_BLOCK, GVirtualBlockClass))
-#define G_IS_VIRTUAL_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_VIRTUAL_BLOCK))
-#define G_VIRTUAL_BLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_VIRTUAL_BLOCK, GVirtualBlockClass))
-
-
-/* Description d'un bloc virtuel d'instructions (instance) */
-typedef struct _GVirtualBlock GVirtualBlock;
-
-/* Description d'un bloc virtuel d'instructions (classe) */
-typedef struct _GVirtualBlockClass GVirtualBlockClass;
-
-
-/* Indique le type défini pour un bloc virtuel d'instructions. */
-GType g_virtual_block_get_type(void);
-
-/* Crée un bloc virtuel d'instructions. */
-GInstrBlock *g_virtual_block_new(void);
-
-/* Ajoute un bloc au groupe courant. */
-void g_virtual_block_add_child(GVirtualBlock *, GInstrBlock *);
-
-/* Compte le nombre de blocs contenus dans le groupe courant. */
-size_t g_virtual_block_count_children(const GVirtualBlock *);
-
-/* Renvoie un des blocs contenus dans le groupe courant. */
-GInstrBlock *g_virtual_block_get_child(const GVirtualBlock *, size_t);
-
-
-
-#endif /* _ANALYSIS_BLOCKS_VIRTUAL_H */
diff --git a/src/gtkext/gtkgraphdisplay.c b/src/gtkext/gtkgraphdisplay.c
index 1d4f831..1727777 100644
--- a/src/gtkext/gtkgraphdisplay.c
+++ b/src/gtkext/gtkgraphdisplay.c
@@ -31,7 +31,6 @@
#include "gtkbufferdisplay.h"
#include "gtkdisplaypanel-int.h"
#include "graph/cluster.h"
-#include "../analysis/blocks/flow.h"
#include "../format/format.h"
#include "../gui/editem.h"