summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog84
-rw-r--r--plugins/Makefile.am2
-rw-r--r--plugins/dexresolver/Makefile.am16
-rw-r--r--plugins/dexresolver/context.c321
-rw-r--r--plugins/dexresolver/context.h57
-rw-r--r--plugins/dexresolver/operand.c306
-rw-r--r--plugins/dexresolver/operand.h70
-rw-r--r--plugins/dexresolver/plugin.c120
-rw-r--r--plugins/dexresolver/plugin.h49
-rw-r--r--plugins/pychrysa/analysis/Makefile.am3
-rw-r--r--plugins/pychrysa/analysis/exporter-int.h53
-rw-r--r--plugins/pychrysa/analysis/exporter.c284
-rw-r--r--plugins/pychrysa/analysis/exporter.h44
-rw-r--r--plugins/pychrysa/analysis/line.c793
-rw-r--r--plugins/pychrysa/analysis/line.h61
-rw-r--r--plugins/stackvars/operand.c5
-rw-r--r--plugins/stackvars/stackvars.c4
-rw-r--r--plugins/stackvars/stackvars.h4
-rw-r--r--plugins/theseus/Makefile.am14
-rw-r--r--plugins/theseus/theseus.c620
-rw-r--r--plugins/theseus/theseus.h49
-rwxr-xr-xsrc/analysis/Makefile.am7
-rw-r--r--src/analysis/binary.h1
-rw-r--r--src/analysis/exporter-int.h70
-rw-r--r--src/analysis/exporter.c281
-rw-r--r--src/analysis/exporter.h70
-rw-r--r--src/analysis/line-int.h86
-rw-r--r--src/analysis/line.c717
-rw-r--r--src/analysis/line.h151
-rw-r--r--src/analysis/line_code.c334
-rw-r--r--src/analysis/line_code.h62
-rw-r--r--src/analysis/line_comment.c248
-rw-r--r--src/analysis/line_comment.h58
-rw-r--r--src/analysis/line_prologue.c202
-rw-r--r--src/analysis/line_prologue.h60
-rw-r--r--src/arch/dalvik/register.c2
-rw-r--r--src/arch/immediate.c70
-rw-r--r--src/arch/instruction-int.h5
-rw-r--r--src/arch/instruction.c170
-rw-r--r--src/arch/instruction.h3
-rw-r--r--src/arch/jvm/operand.c11
-rw-r--r--src/arch/mips/operand.c34
-rw-r--r--src/arch/operand-int.h9
-rw-r--r--src/arch/operand.c49
-rw-r--r--src/arch/operand.h8
-rw-r--r--src/arch/x86/Makefile.am2
-rw-r--r--src/arch/x86/operands/data.c16
-rw-r--r--src/arch/x86/operands/modrm.c15
-rw-r--r--src/arch/x86/operands/modrm.h2
-rw-r--r--src/arch/x86/operands/moffs.c14
-rw-r--r--src/arch/x86/operands/register.c42
-rw-r--r--src/arch/x86/operands/register.h2
-rw-r--r--src/arch/x86/operands/relative.c14
-rw-r--r--src/arch/x86/register.c (renamed from src/arch/x86/registers.c)157
-rw-r--r--src/arch/x86/register.h (renamed from src/arch/x86/registers.h)15
-rw-r--r--src/dialogs/add_shellcode.c2
-rw-r--r--src/dialogs/export.h3
-rw-r--r--src/gui/panels/log.c3
-rw-r--r--src/gui/panels/panel-int.h1
-rw-r--r--src/gui/tb/toolbar.c3
-rw-r--r--src/project.h1
61 files changed, 249 insertions, 5710 deletions
diff --git a/ChangeLog b/ChangeLog
index 46b8ce7..b3778c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,87 @@
+12-11-05 Cyrille Bagard <nocbos@gmail.com>
+
+ * plugins/dexresolver/context.c:
+ * plugins/dexresolver/context.h:
+ * plugins/dexresolver/Makefile.am:
+ * plugins/dexresolver/operand.c:
+ * plugins/dexresolver/operand.h:
+ * plugins/dexresolver/plugin.c:
+ * plugins/dexresolver/plugin.h:
+ Delete these useless entries.
+
+ * plugins/Makefile.am:
+ Update the SUBDIRS.
+
+ * plugins/pychrysa/analysis/exporter.c:
+ * plugins/pychrysa/analysis/exporter.h:
+ * plugins/pychrysa/analysis/exporter-int.h:
+ * plugins/pychrysa/analysis/line.c:
+ * plugins/pychrysa/analysis/line.h:
+ Deleted entries.
+
+ * plugins/pychrysa/analysis/Makefile.am:
+ * plugins/stackvars/operand.c:
+ * plugins/stackvars/stackvars.c:
+ * plugins/stackvars/stackvars.h:
+ Update code.
+
+ * plugins/theseus/Makefile.am:
+ * plugins/theseus/theseus.c:
+ * plugins/theseus/theseus.h:
+ Deleted entries.
+
+ * src/analysis/binary.h:
+ Update code.
+
+ * src/analysis/exporter.c:
+ * src/analysis/exporter.h:
+ * src/analysis/exporter-int.h:
+ * src/analysis/line.c:
+ * src/analysis/line_code.c:
+ * src/analysis/line_code.h:
+ * src/analysis/line_comment.c:
+ * src/analysis/line_comment.h:
+ * src/analysis/line.h:
+ * src/analysis/line-int.h:
+ * src/analysis/line_prologue.c:
+ * src/analysis/line_prologue.h:
+ Deleted entries.
+
+ * src/analysis/Makefile.am:
+ * src/arch/dalvik/register.c:
+ * src/arch/immediate.c:
+ * src/arch/instruction.c:
+ * src/arch/instruction.h:
+ * src/arch/instruction-int.h:
+ * src/arch/jvm/operand.c:
+ * src/arch/mips/operand.c:
+ * src/arch/operand.c:
+ * src/arch/operand.h:
+ * src/arch/operand-int.h:
+ * src/arch/x86/Makefile.am:
+ * src/arch/x86/operands/data.c:
+ * src/arch/x86/operands/modrm.c:
+ * src/arch/x86/operands/modrm.h:
+ * src/arch/x86/operands/moffs.c:
+ * src/arch/x86/operands/register.c:
+ * src/arch/x86/operands/register.h:
+ * src/arch/x86/operands/relative.c:
+ * src/arch/x86/register.c:
+ * src/arch/x86/register.h:
+ Update code.
+
+ * src/arch/x86/registers.c:
+ * src/arch/x86/registers.h:
+ Renamed entries.
+
+ * src/dialogs/add_shellcode.c:
+ * src/dialogs/export.h:
+ * src/gui/panels/log.c:
+ * src/gui/panels/panel-int.h:
+ * src/gui/tb/toolbar.c:
+ * src/project.h:
+ Update code.
+
12-11-02 Cyrille Bagard <nocbos@gmail.com>
* configure.ac:
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index be5740c..b789239 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = dexresolver pychrysa python stackvars theseus
+SUBDIRS = pychrysa python stackvars
diff --git a/plugins/dexresolver/Makefile.am b/plugins/dexresolver/Makefile.am
deleted file mode 100644
index f290a99..0000000
--- a/plugins/dexresolver/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-
-lib_LTLIBRARIES = libdexresolver.la
-
-libdexresolver_la_SOURCES = \
- context.h context.c \
- operand.h operand.c \
- plugin.h plugin.c
-
-libdexresolver_la_CFLAGS = $(AM_CFLAGS)
-
-
-INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) -I../../src
-
-AM_CPPFLAGS =
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/dexresolver/context.c b/plugins/dexresolver/context.c
deleted file mode 100644
index b63ccf3..0000000
--- a/plugins/dexresolver/context.c
+++ /dev/null
@@ -1,321 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * context.h - prototypes pour les instances d'actions du présent greffon
- *
- * Copyright (C) 2010 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "context.h"
-
-
-#include <analysis/line_code.h>
-#include <arch/dalvik/operand.h>
-#include <glibext/delayed-int.h>
-#include <plugins/context-int.h>
-
-
-#include "operand.h"
-
-
-
-/* ---------------------------- REMPLACEMENT D'OPERANDES ---------------------------- */
-
-
-#define G_TYPE_DEX_RESOLVER_WORK g_dex_resolver_work_get_type()
-#define G_DEX_RESOLVER_WORK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dex_resolver_work_get_type(), GDelayedDisassembly))
-#define G_IS_DEX_RESOLVER_WORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dex_resolver_work_get_type()))
-#define G_DEX_RESOLVER_WORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DEX_RESOLVER_WORK, GDelayedDisassemblyClass))
-#define G_IS_DEX_RESOLVER_WORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DEX_RESOLVER_WORK))
-#define G_DEX_RESOLVER_WORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DEX_RESOLVER_WORK, GDelayedDisassemblyClass))
-
-
-/* Instance du greffon pour OpenIDA (instance) */
-typedef struct _GDexResolverWork
-{
- GDelayedWork parent; /* A laisser en premier */
-
- GLoadedBinary *binary; /* Destinataire final */
-
-} GDexResolverWork;
-
-
-/* Instance du greffon pour OpenIDA (classe) */
-typedef struct _GDexResolverWorkClass
-{
- GDelayedWorkClass parent; /* A laisser en premier */
-
-} GDexResolverWorkClass;
-
-
-/* Indique le type défini pour les tâches de résolutions différées. */
-static GType g_dex_resolver_work_get_type(void);
-
-/* Initialise la classe des résolutions d'opérandes différées. */
-static void g_dex_resolver_work_class_init(GDexResolverWorkClass *);
-
-/* Initialise une tâche de résolution d'opérandes différée. */
-static void g_dex_resolver_work_init(GDexResolverWork *);
-
-/* Crée une tâche de résolution d'opérandes différée. */
-static GDexResolverWork *g_dex_resolver_work_new(GLoadedBinary *);
-
-/* Assure la résolution d'opérandes en différé. */
-static void g_dex_resolver_work_process(GDexResolverWork *, GtkExtStatusBar *);
-
-
-
-/* -------------------------- TACHE DIFFEREE DANS LE TEMPS -------------------------- */
-/* -------------------------- TACHE DIFFEREE DANS LE TEMPS -------------------------- */
-
-
-
-/* Instance du greffon pour OpenIDA (instance) */
-struct _GDexResolverContext
-{
- GPluginContext parent; /* A laisser en premier */
-
-};
-
-
-/* Instance du greffon pour OpenIDA (classe) */
-struct _GDexResolverContextClass
-{
- GPluginContextClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des instances de greffon. */
-static void g_dex_resolver_context_class_init(GDexResolverContextClass *);
-
-/* Initialise une instance d'instance de greffon. */
-static void g_dex_resolver_context_init(GDexResolverContext *);
-
-
-
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* REMPLACEMENT D'OPERANDES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/* Indique le type défini pour les tâches de résolutions différées. */
-G_DEFINE_TYPE(GDexResolverWork, g_dex_resolver_work, G_TYPE_DELAYED_WORK);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des résolutions d'opérandes différées. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dex_resolver_work_class_init(GDexResolverWorkClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : disass = instance à initialiser. *
-* *
-* Description : Initialise une tâche de résolution d'opérandes différée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dex_resolver_work_init(GDexResolverWork *disass)
-{
- G_DELAYED_WORK(disass)->run = (run_task_fc)g_dex_resolver_work_process;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = binaire chargé en attente des résultats. *
-* *
-* Description : Crée une tâche de résolution d'opérandes différée. *
-* *
-* Retour : Tâche créée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GDexResolverWork *g_dex_resolver_work_new(GLoadedBinary *binary)
-{
- GDexResolverWork *result; /* Tâche à retourner */
-
- result = g_object_new(G_TYPE_DEX_RESOLVER_WORK, NULL);
-
- result->binary = binary;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : work = analyse à mener. *
-* statusbar = barre de statut à tenir informée. *
-* *
-* Description : Assure la résolution d'opérandes en différé. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dex_resolver_work_process(GDexResolverWork *work, GtkExtStatusBar *statusbar)
-{
- GDexFormat *format; /* Format du binaire utilisé */
- GRenderingLine *lines; /* Lignes désassemblées */
- GRenderingLine *iter; /* Boucle de parcours */
- GArchInstruction *instr; /* Instruction à ausculter */
- size_t count; /* Quantité d'opérandes */
- size_t i; /* Boucle de parcours */
- const GArchOperand *op; /* Opérande à analyser */
- GArchOperand *new; /* Nouvel opérande à afficher */
-
- format = G_DEX_FORMAT(g_loaded_binary_get_format(work->binary));
-
- lines = g_loaded_binary_get_lines(work->binary);
-
- for (iter = lines;
- iter != NULL;
- iter = g_rendering_line_get_next_iter(lines, iter, NULL))
- {
- /* On ne traite que du code ici ! */
- if (!G_IS_CODE_LINE(iter)) continue;
-
- instr = g_code_line_get_instruction(G_CODE_LINE(iter));
- count = g_arch_instruction_count_operands(instr);
-
- /* FIXME : l'opérande recherchée est à position fixe ! */
- for (i = 0; i < count; i++)
- {
- op = g_arch_instruction_get_operand(instr, i);
-
- if (G_IS_DALVIK_POOL_OPERAND(op))
- {
- new = g_dalvik_hpool_operand_new(format, G_DALVIK_POOL_OPERAND(op));
-
- if (new != NULL)
- g_arch_instruction_replace_operand(instr, new, op);
-
- }
-
- }
-
- }
-
-}
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* REMPLACEMENT D'OPERANDES */
-/* REMPLACEMENT D'OPERANDES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/* Indique le type défini pour une instance de greffon. */
-G_DEFINE_TYPE(GDexResolverContext, g_dex_resolver_context, G_TYPE_PLUGIN_CONTEXT);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des instances de greffon. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dex_resolver_context_class_init(GDexResolverContextClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : context = instance à initialiser. *
-* *
-* Description : Initialise une instance d'instance de greffon. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dex_resolver_context_init(GDexResolverContext *context)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = contenu binaire chargé à traiter. *
-* *
-* Description : Lance l'exécution d'une action du greffon. *
-* *
-* Retour : Instance d'exécution du greffon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GPluginContext *g_dex_resolver_context_new(GLoadedBinary *binary)
-{
- GPluginContext *result; /* Bilan d'exécution à renvoyer*/
- GDexResolverWork *work; /* Tâche de parcours de lignes */
-
- result = g_object_new(G_TYPE_DEX_RESOLVER_CONTEXT, NULL);
-
- work = g_dex_resolver_work_new(binary);
-
- g_signal_connect(work, "work-completed", G_CALLBACK(g_object_unref), NULL);
-
- g_work_queue_schedule_work(get_work_queue(), G_DELAYED_WORK(work));
-
- return result;
-
-}
diff --git a/plugins/dexresolver/context.h b/plugins/dexresolver/context.h
deleted file mode 100644
index bcc4f19..0000000
--- a/plugins/dexresolver/context.h
+++ /dev/null
@@ -1,57 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * context.h - prototypes pour les instances d'actions du présent greffon
- *
- * Copyright (C) 2010 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_DEXRESOLVER_CONTEXT_H
-#define _PLUGINS_DEXRESOLVER_CONTEXT_H
-
-
-#include <analysis/binary.h>
-#include <plugins/context.h>
-
-
-
-/* Instance du greffon pour OpenIDA (instance) */
-typedef struct _GDexResolverContext GDexResolverContext;
-
-/* Instance du greffon pour OpenIDA (classe) */
-typedef struct _GDexResolverContextClass GDexResolverContextClass;
-
-
-#define G_TYPE_DEX_RESOLVER_CONTEXT (g_dex_resolver_context_get_type())
-#define G_DEX_RESOLVER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContext))
-#define G_IS_DEX_RESOLVER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_DEX_RESOLVER_CONTEXT))
-#define G_DEX_RESOLVER_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContextClass))
-#define G_IS_DEX_RESOLVER_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DEX_RESOLVER_CONTEXT))
-#define G_DEX_RESOLVER_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContextClass))
-
-
-/* Indique le type défini pour une instance de greffon. */
-GType g_dex_resolver_context_get_type(void);
-
-/* Lance l'exécution d'une action du greffon. */
-GPluginContext *g_dex_resolver_context_new(GLoadedBinary *);
-
-
-
-#endif /* _PLUGINS_DEXRESOLVER_CONTEXT_H */
diff --git a/plugins/dexresolver/operand.c b/plugins/dexresolver/operand.c
deleted file mode 100644
index 7293599..0000000
--- a/plugins/dexresolver/operand.c
+++ /dev/null
@@ -1,306 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * operand.c - remplacement d'opérandes par d'autres plus explicites
- *
- * Copyright (C) 2010 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/>.
- */
-
-
-#include "operand.h"
-
-
-#include <string.h>
-
-
-#include <arch/operand-int.h>
-#include <format/dex/pool.h>
-
-
-
-/* ----------------- OPERANDES POINTANT VERS LA TABLE DE CONSTANTES ----------------- */
-
-
-/* Définition d'un opérande visant un élément de table de constantes Dalvik (instance) */
-struct _GDalvikHPoolOperand
-{
- GArchOperand parent; /* Instance parente */
-
- const GDexFormat *format; /* Format de binaire utilisé */
- const GDalvikPoolOperand *child; /* Opérande encapsulé */
-
- union
- {
- GBinVariable *field; /* Champ à représenter */
- GBinRoutine *method; /* Méthode à représenter */
-
- } cache;
-
-};
-
-
-/* Définition d'un opérande visant un élément de table de constantes Dalvik (classe) */
-struct _GDalvikHPoolOperandClass
-{
- GArchOperandClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des opérandes de constante Dalvik. */
-static void g_dalvik_hpool_operand_class_init(GDalvikHPoolOperandClass *);
-
-/* Initialise une instance d'opérande de constante Dalvik. */
-static void g_dalvik_hpool_operand_init(GDalvikHPoolOperand *);
-
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_dalvik_hpool_operand_add_text(const GDalvikHPoolOperand *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_dalvik_hpool_operand_to_buffer(/*const */GDalvikHPoolOperand *, GBufferLine *, GRenderingOptions *);
-
-
-
-
-
-
-
-
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* OPERANDES POINTANT VERS LA TABLE DE CONSTANTES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/* Indique le type défini par la GLib pour un un élément de table de constantes Dalvik. */
-G_DEFINE_TYPE(GDalvikHPoolOperand, g_dalvik_hpool_operand, G_TYPE_ARCH_OPERAND);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérandes de constante Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_hpool_operand_class_init(GDalvikHPoolOperandClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opérande de constante Dalvik. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_hpool_operand_init(GDalvikHPoolOperand *operand)
-{
- GContentExporter *parent; /* Instance parente */
-
- parent = G_CONTENT_EXPORTER(operand);
-
- parent->add_text = (add_text_fc)g_dalvik_hpool_operand_add_text;
- parent->export_buffer = (export_buffer_fc)g_dalvik_hpool_operand_to_buffer;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : format = représentation interne du format DEX à consulter. *
-* child = instance existante à encapsuler. *
-* *
-* Description : Crée un opérande explicitant l'usage d'un élément constant. *
-* *
-* Retour : Opérande mis en place ou NULL si soucis. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchOperand *g_dalvik_hpool_operand_new(const GDexFormat *format, const GDalvikPoolOperand *child)
-{
- GDalvikHPoolOperand *result; /* Structure à retourner */
-
- if (g_dalvik_pool_operand_get_pool_type(child) == DPT_NONE)
- return NULL;
-
- result = g_object_new(G_TYPE_DALVIK_HPOOL_OPERAND, NULL);
-
- result->format = format;
- result->child = child;
-
- return G_ARCH_OPERAND(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_hpool_operand_add_text(const GDalvikHPoolOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- //g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->reg), options, rendering, stream);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_hpool_operand_to_buffer(/*const */GDalvikHPoolOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
-{
- GContentExporter *exporter; /* Autre vision de l'opérande */
- uint32_t index; /* Indice de l'élément visé */
- const char *string; /* Chaîne à afficher */
- GDataType *type; /* Type quelconque */
- char *tmp; /* Chaîne à afficher & libérer */
-
- exporter = G_CONTENT_EXPORTER(operand);
-
- index = g_dalvik_pool_operand_get_index(operand->child);
-
- switch (g_dalvik_pool_operand_get_pool_type(operand->child))
- {
- case DPT_STRING:
-
- string = get_string_from_dex_pool(operand->format, index);
-
- if (string == NULL)
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "<bad_string_index>", 18, RTT_STRING);
- else
- {
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "\"", 1, RTT_STRING);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- string, strlen(string), RTT_STRING);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "\"", 1, RTT_STRING);
-
- }
-
- break;
-
- case DPT_FIELD:
-
- if (operand->cache.field == NULL)
- operand->cache.field = get_field_from_dex_pool(operand->format, index);
-
- if (operand->cache.field == NULL)
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "<bad_field_index>", 17, RTT_VAR_NAME);
-
- else
- {
- type = g_binary_variable_get_vtype(operand->cache.field);
- tmp = g_data_type_to_string(type);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- tmp, strlen(tmp), RTT_VAR_NAME);
-
- free(tmp);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "->", 2, RTT_LTGT);
-
- string = g_binary_variable_get_name(operand->cache.field);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- string, strlen(string), RTT_VAR_NAME);
-
- }
-
- break;
-
- case DPT_METHOD:
-
- if (operand->cache.method == NULL)
- operand->cache.method = get_routine_from_dex_pool(operand->format, index);
-
- if (operand->cache.method == NULL)
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "<bad_method_index>", 18, RTT_VAR_NAME);
-
- else
- {
- tmp = g_binary_routine_to_string(operand->cache.method);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- tmp, strlen(tmp), RTT_VAR_NAME);
-
- free(tmp);
-
- }
-
- break;
-
- default:
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- "<-?->", 5, RTT_SECTION);
- break;
-
- }
-
-
-
-
-}
-
-
-
-
diff --git a/plugins/dexresolver/operand.h b/plugins/dexresolver/operand.h
deleted file mode 100644
index f5e9ef9..0000000
--- a/plugins/dexresolver/operand.h
+++ /dev/null
@@ -1,70 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * operand.h - prototypes pour le remplacement d'opérandes par d'autres plus explicites
- *
- * Copyright (C) 2010 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 _PLUGINS_DEXRESOLVER_OPERAND_H
-#define _PLUGINS_DEXRESOLVER_OPERAND_H
-
-
-#include <glib-object.h>
-
-
-#include <arch/dalvik/operand.h>
-#include <format/dex/dex.h>
-
-
-
-/* ----------------- OPERANDES POINTANT VERS LA TABLE DE CONSTANTES ----------------- */
-
-
-
-#define G_TYPE_DALVIK_HPOOL_OPERAND g_dalvik_hpool_operand_get_type()
-#define G_DALVIK_HPOOL_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dalvik_hpool_operand_get_type(), GDalvikHpoolOperand))
-#define G_IS_DALVIK_HPOOL_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dalvik_hpool_operand_get_type()))
-#define G_DALVIK_HPOOL_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_dalvik_hpool_operand_get_type(), GDalvikHpoolOperandIface))
-
-
-/* Définition d'un opérande visant un élément de table de constantes Dalvik (instance) */
-typedef struct _GDalvikHPoolOperand GDalvikHPoolOperand;
-
-/* Définition d'un opérande visant un élément de table de constantes Dalvik (classe) */
-typedef struct _GDalvikHPoolOperandClass GDalvikHPoolOperandClass;
-
-
-/* Indique le type défini par la GLib pour un un élément de table de constantes Dalvik. */
-GType g_dalvik_hpool_operand_get_type(void);
-
-/* Crée un opérande explicitant l'usage d'un élément constant. */
-GArchOperand *g_dalvik_hpool_operand_new(const GDexFormat *, const GDalvikPoolOperand *);
-
-
-
-
-
-
-
-
-
-
-
-
-#endif /* _PLUGINS_DEXRESOLVER_OPERAND_H */
diff --git a/plugins/dexresolver/plugin.c b/plugins/dexresolver/plugin.c
deleted file mode 100644
index 7a2fe77..0000000
--- a/plugins/dexresolver/plugin.c
+++ /dev/null
@@ -1,120 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * plugin.c - résolution des références avec le format DEX
- *
- * Copyright (C) 2010 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/>.
- */
-
-
-#include "plugin.h"
-
-
-#include "context.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* *
-* Description : Initialise le greffon pour les bornes de routine. *
-* *
-* Retour : true. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-G_MODULE_EXPORT bool init_plugin(GObject *ref)
-{
- return true;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit une indication sur le(s) type(s) du greffon présent. *
-* *
-* Retour : Description d'un greffon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-G_MODULE_EXPORT PluginType get_plugin_type(void)
-{
- return PGT_BINARY;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit une indication sur le type d'opération(s) menée(s). *
-* *
-* Retour : Description d'une action. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-G_MODULE_EXPORT PluginAction get_plugin_action(void)
-{
- return PGA_CODE_PROCESS;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = représentation binaire à traiter. *
-* action = action attendue. *
-* *
-* Description : Exécute une action définie sur un binaire chargé. *
-* *
-* Retour : true si une action a été menée, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *binary, PluginAction action)
-{
- bool result; /* Bilan à retourner */
-
-
-
-
- GPluginContext *context;
-
-
- context = g_dex_resolver_context_new(binary);
-
- printf("Run it !!!\n");
-
- result = true;
-
-
- return result;
-
-}
diff --git a/plugins/dexresolver/plugin.h b/plugins/dexresolver/plugin.h
deleted file mode 100644
index c5a1a97..0000000
--- a/plugins/dexresolver/plugin.h
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * plugin.h - prototypes pour la résolution des références avec le format DEX
- *
- * Copyright (C) 2010 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 _PLUGINS_DEXRESOLVER_PLUGIN_H
-#define _PLUGINS_DEXRESOLVER_PLUGIN_H
-
-
-#include <gmodule.h>
-
-
-#include <plugins/plugin-def.h>
-
-
-
-/* Initialise le greffon pour les bornes de routine. */
-G_MODULE_EXPORT bool init_plugin(GObject *);
-
-/* Fournit une indication sur le(s) type(s) du greffon présent. */
-G_MODULE_EXPORT PluginType get_plugin_type(void);
-
-/* Fournit une indication sur le type d'opération(s) menée(s). */
-G_MODULE_EXPORT PluginAction get_plugin_action(void);
-
-/* Exécute une action définie sur un binaire chargé. */
-G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *, PluginAction);
-
-
-
-#endif /* _PLUGINS_DEXRESOLVER_PLUGIN_H */
diff --git a/plugins/pychrysa/analysis/Makefile.am b/plugins/pychrysa/analysis/Makefile.am
index 123279b..f5322e8 100644
--- a/plugins/pychrysa/analysis/Makefile.am
+++ b/plugins/pychrysa/analysis/Makefile.am
@@ -3,9 +3,6 @@ noinst_LTLIBRARIES = libpychrysaanalysis.la
libpychrysaanalysis_la_SOURCES = \
binary.h binary.c \
- exporter-int.h \
- exporter.h exporter.c \
- line.h line.c \
module.h module.c \
roptions.h roptions.c
diff --git a/plugins/pychrysa/analysis/exporter-int.h b/plugins/pychrysa/analysis/exporter-int.h
deleted file mode 100644
index 2498d4b..0000000
--- a/plugins/pychrysa/analysis/exporter-int.h
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * exporter-int.h - prototypes internes pour l'équivalent Python du fichier "analysis/exporter.h"
- *
- * Copyright (C) 2010 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 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_EXPORTER_INT_H
-#define _PLUGINS_PYOIDA_ANALYSIS_EXPORTER_INT_H
-
-
-#include <Python.h>
-
-#include <analysis/exporter.h>
-
-
-
-/* Classe 'analysis.exporter' pour Python */
-typedef struct _py_exporter
-{
- PyObject_HEAD
-
- GContentExporter *glib; /* Interface version GLib */
-
-} py_exporter;
-
-
-#define PY_EXPORTER(exp) ((py_exporter *)exp)
-
-
-/* Fournit le type d'objet 'analysis.exporter' pour Python. */
-PyTypeObject *get_analysis_exporter_type(void);
-
-
-
-#endif /* _PLUGINS_PYOIDA_ANALYSIS_EXPORTER_INT_H */
diff --git a/plugins/pychrysa/analysis/exporter.c b/plugins/pychrysa/analysis/exporter.c
deleted file mode 100644
index 8c49542..0000000
--- a/plugins/pychrysa/analysis/exporter.c
+++ /dev/null
@@ -1,284 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * exporter.c - équivalent Python du fichier "analysis/exporter.h"
- *
- * Copyright (C) 2010 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "exporter.h"
-
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-
-
-#include "exporter-int.h"
-#include "../analysis/roptions.h"
-
-
-
-
-#define PY_EXPORT_TEXT_BUFLEN 64
-
-
-/* Crée un nouvel objet Python de type 'py_exporter'. */
-static PyObject *py_exporter_new(PyTypeObject *, PyObject *, PyObject *);
-
-
-
-
-/* Fournit le texte correspondant à un contenu rendu. */
-static PyObject *py_exporter_get_text(py_exporter *, PyObject *);
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : type = type de l'objet à instancier. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Crée un nouvel objet Python de type 'py_exporter'. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_exporter_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- py_exporter *result; /* Instance à retourner */
-
- result = (py_exporter *)type->tp_alloc(type, 0);
-
- return (PyObject *)result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : exporter = objet GLib existant à transposer. *
-* *
-* Description : Crée un nouvel objet Python de type 'py_exporter'. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyObject *py_exporter_new_from_existing(GContentExporter *exporter)
-{
- py_exporter *result; /* Instance à retourner */
- PyTypeObject *type; /* Type Python à instancier */
-
- result = (py_exporter *)g_object_get_data(G_OBJECT(exporter), "python_object");
-
- if (result == NULL)
- {
- type = get_analysis_exporter_type();
-
- result = (py_exporter *)type->tp_alloc(type, 0);
-
- result->glib = exporter;
- g_object_ref(exporter);
-
- g_object_set_data(G_OBJECT(exporter), "python_object", result);
-
- }
- else Py_INCREF((PyObject *)result);
-
- return (PyObject *)result;
-
-}
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = instance manipulée à traiter. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Fournit le texte correspondant à un contenu rendu. *
-* *
-* Retour : Chaîne de caractères Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_exporter_get_text(py_exporter *self, PyObject *args)
-{
- PyObject *result; /* Liste à retourner */
- PyObject *roptions; /* Options de rendu jointes */
- int ret; /* Bilan de lecture des args. */
- GRenderingOptions *_roptions; /* Version GLib des options */
- int fd[2]; /* Tube pour récupérer le code */
- FILE *stream; /* Flux (ré)ouvert en écriture */
- char buffer[PY_EXPORT_TEXT_BUFLEN]; /* Tampon pour la lecture */
- ssize_t len; /* Nombre de caractères lus */
- PyObject *src; /* Source ajoutée au résultat */
-
- ret = PyArg_ParseTuple(args, "O", &roptions);
- if (!ret) return Py_None;
-
- _roptions = py_rendering_options_get_glib_instance(roptions);
-
- result = Py_None;
-
- ret = pipe2(fd, O_NONBLOCK);
- //if (ret ... perror("pipe"); goto pegt_pipe_error;
-
-
- stream = fdopen(fd[1], "w");
- if (stream == NULL)
- {
- perror("stream");
- goto pegt_stream_error;
- }
-
- g_content_exporter_add_text(self->glib, _roptions, MRD_BLOCK/* FIXME*/, stream);
- fflush(stream);
-
- do
- {
- memset(buffer, 0, PY_EXPORT_TEXT_BUFLEN);
- len = read(fd[0], buffer, PY_EXPORT_TEXT_BUFLEN);
-
- src = PyString_FromString(buffer);
-
- if (result == Py_None) result = src;
- else PyString_ConcatAndDel(&result, src);
-
- }
- while (len > 0);
-
- fclose(stream);
-
- pegt_stream_error:
-
- close(fd[0]);
- //close(fd[1]);
-
- pegt_pipe_error:
-
- return result;
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit le type d'objet 'analysis.exporter' pour Python. *
-* *
-* Retour : Adresse du type vivant à manipuler. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_analysis_exporter_type(void)
-{
- static PyTypeObject *result = NULL; /* Type pour objet à retourner */
-
- static PyMethodDef py_exporter_methods[] = {
- {
- "get_text", (PyCFunction)py_exporter_get_text,
- METH_VARARGS,
- "Provide the text version of the rendered content."
- },
- { NULL }
- };
-
- static PyGetSetDef py_exporter_getset[] = {
- { NULL }
- };
-
- static PyTypeObject py_exporter_type = {
-
- PyObject_HEAD_INIT(NULL)
-
- .tp_name = "pyoida.analysis.Exporter",
- .tp_basicsize = sizeof(py_exporter),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyOIDA exporter interface",
-
- .tp_methods = py_exporter_methods,
- .tp_getset = py_exporter_getset,
- .tp_new = (newfunc)py_exporter_new
-
- };
-
- if (result == NULL) result = &py_exporter_type;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Ajoute l'objet 'analysis.exporter' au module Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_analysis_exporter_to_python_module(PyObject *module)
-{
- PyTypeObject *py_exporter_type; /* Type défini pour Python */
- int ret; /* Bilan d'un appel */
-
- py_exporter_type = get_analysis_exporter_type();
-
- if (PyType_Ready(py_exporter_type) < 0)
- return false;
-
- Py_INCREF(py_exporter_type);
- ret = PyModule_AddObject(module, "Exporter", (PyObject *)py_exporter_type);
-
- return (ret == 0);
-
-}
diff --git a/plugins/pychrysa/analysis/exporter.h b/plugins/pychrysa/analysis/exporter.h
deleted file mode 100644
index 4668934..0000000
--- a/plugins/pychrysa/analysis/exporter.h
+++ /dev/null
@@ -1,44 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * exporter.h - prototypes pour l'équivalent Python du fichier "analysis/exporter.h"
- *
- * Copyright (C) 2010 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 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_EXPORTER_H
-#define _PLUGINS_PYOIDA_ANALYSIS_EXPORTER_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-#include <analysis/exporter.h>
-
-
-
-/* Crée un nouvel objet Python de type 'py_exporter'. */
-PyObject *py_exporter_new_from_existing(GContentExporter *);
-
-/* Ajoute l'objet 'analysis.exporter' au module Python. */
-bool add_analysis_exporter_to_python_module(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYOIDA_ANALYSIS_EXPORTER_H */
diff --git a/plugins/pychrysa/analysis/line.c b/plugins/pychrysa/analysis/line.c
deleted file mode 100644
index fd697e2..0000000
--- a/plugins/pychrysa/analysis/line.c
+++ /dev/null
@@ -1,793 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line.c - équivalent Python du fichier "analysis/line.h"
- *
- * Copyright (C) 2010 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "line.h"
-
-
-#include "exporter-int.h"
-#include "../arch/archbase.h"
-
-
-
-
-
-
-
-/* Classe 'analysis.line' pour Python */
-typedef struct _py_line
-{
- py_exporter parent; /* A laisser en premier */
-
- GRenderingLine *line; /* Référence GLib */
-
-} py_line;
-
-
-
-
-/* Crée un nouvel objet Python de type 'py_line'. */
-static PyObject *py_line_new(PyTypeObject *, PyObject *, PyObject *);
-
-
-
-
-
-
-/* Fournit le type d'objet 'analysis.line' pour Python. */
-static PyTypeObject *get_analysis_line_type(void);
-
-
-
-/* Prépare un parcours de lignes. */
-static PyObject *py_line_get_iter(py_line *);
-
-/* Prépare un parcours de lignes en sens inverse. */
-static PyObject *py_line_get_riter(py_line *);
-
-
-
-/* Fournit l'adresse physique ou en mémoire d'une ligne. */
-static PyObject *py_line_get_address(py_line *, void *);
-
-/* Fournit le commentaire associé à la ligne s'il existe. */
-static PyObject *py_line_get_comment(py_line *, void *);
-
-/* Définit ou supprime un commentaire pour la ligne indiquée. */
-static int py_line_set_comment(py_line *, PyObject *, void *);
-
-
-
-
-
-/* ---------------------- ITERATEUR POUR LE PARCOURS DE LIGNES ---------------------- */
-
-
-/* Itérateur pour lignes de rendu */
-typedef struct _py_line_iter
-{
- PyObject_HEAD /* A laisser en premier */
-
- GRenderingLine *head; /* Liste à parcourir */
- GRenderingLine *cur; /* Point de parcours courant */
-
-} py_line_iter;
-
-
-/* Fournit le type d'objet 'analysis.LineIter' pour Python. */
-static PyTypeObject *get_analysis_line_iter_type(void);
-
-/* Prépare l'itérateur pour un parcours de lignes de rendu. */
-static PyObject *py_line_iter_new(GRenderingLine *);
-
-/* Libère la mémoire occupée par un itérateur de 'py_line'. */
-static void py_line_iter_dealloc(py_line_iter *);
-
-/* Fournit l'élément suivant dans un parcours de lignes. */
-static PyObject *py_line_iter_get_next(py_line_iter *);
-
-
-
-/* ---------------------- ITERATEUR POUR LE PARCOURS DE LIGNES ---------------------- */
-
-
-/* Itérateur pour lignes de rendu */
-typedef py_line_iter py_line_riter;
-
-
-/* Fournit le type d'objet 'analysis.LineRevIter' pour Python. */
-static PyTypeObject *get_analysis_line_riter_type(void);
-
-/* Prépare l'itérateur pour un parcours de lignes de rendu. */
-static PyObject *py_line_riter_new(GRenderingLine *);
-
-/* Libère la mémoire occupée par un itérateur de 'py_line'. */
-static void py_line_riter_dealloc(py_line_riter *);
-
-/* Fournit l'élément précédant dans un parcours de lignes. */
-static PyObject *py_line_riter_get_prev(py_line_riter *);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : type = type de l'objet à instancier. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Crée un nouvel objet Python de type 'py_line'. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- py_line *result; /* Instance à retourner */
-
- result = (py_line *)type->tp_alloc(type, 0);
-
- return (PyObject *)result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = objet GLib existant à transposer. *
-* *
-* Description : Crée un nouvel objet Python de type 'py_line'. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyObject *py_line_new_from_existing(GRenderingLine *line)
-{
- py_line *result; /* Instance à retourner */
- PyTypeObject *type; /* Type Python à instancier */
-
- result = (py_line *)g_object_get_data(G_OBJECT(line), "python_object");
-
- if (result == NULL)
- {
- type = get_analysis_line_type();
-
- result = (py_line *)type->tp_alloc(type, 0);
-
- PY_EXPORTER(result)->glib = G_CONTENT_EXPORTER(line); /* TODO : move me ! */
-
- result->line = line;
- g_object_ref(line);
-
- g_object_set_data(G_OBJECT(line), "python_object", result);
-
- }
- else Py_INCREF((PyObject *)result);
-
- return (PyObject *)result;
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit le type d'objet 'analysis.line' pour Python. *
-* *
-* Retour : Adresse du type vivant à manipuler. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyTypeObject *get_analysis_line_type(void)
-{
- static PyTypeObject *result = NULL; /* Type pour objet à retourner */
-
- static PyMethodDef py_line_methods[] = {
- {
- "__reversed__", (PyCFunction)py_line_get_riter,
- METH_NOARGS,
- "Return a reverse iterator over the rendering lines."
- },
- { NULL }
- };
-
- static PyGetSetDef py_line_getset[] = {
- {
- "address",
- (getter)py_line_get_address,
- (setter)NULL,
- "Get the physical or virtual address relative to the line."
- },
- {
- "comment",
- (getter)py_line_get_comment,
- (setter)py_line_set_comment,
- "Get or set a comment for the rendering line."
- },
- { NULL }
- };
-
- static PyTypeObject py_line_type = {
-
- PyObject_HEAD_INIT(NULL)
-
- .tp_name = "pyoida.analysis.Line",
- .tp_basicsize = sizeof(py_line),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyOIDA rendering line",
-
- .tp_iter = (getiterfunc)py_line_get_iter,
-
- .tp_methods = py_line_methods,
- .tp_getset = py_line_getset,
- .tp_new = (newfunc)py_line_new
-
- };
-
- if (result == NULL)
- {
- py_line_type.tp_base = get_analysis_exporter_type();
- result = &py_line_type;
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Ajoute l'objet 'analysis.line' au module Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_analysis_line_to_python_module(PyObject *module)
-{
- PyTypeObject *py_line_type; /* Type défini pour Python */
- int ret; /* Bilan d'un appel */
-
- py_line_type = get_analysis_line_type();
-
- if (PyType_Ready(py_line_type) < 0)
- return false;
-
- Py_INCREF(py_line_type);
- ret = PyModule_AddObject(module, "Line", (PyObject *)py_line_type);
-
- return (ret == 0);
-
-}
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = instance manipulée à traiter. *
-* *
-* Description : Prépare un parcours de lignes. *
-* *
-* Retour : Point de départ d'un parcours. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_get_iter(py_line *self)
-{
- return (PyObject *)py_line_iter_new(self->line);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = instance manipulée à traiter. *
-* *
-* Description : Prépare un parcours de lignes en sens inverse. *
-* *
-* Retour : Point de départ d'un parcours. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_get_riter(py_line *self)
-{
- return (PyObject *)py_line_riter_new(self->line);
-
-}
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe présentant une ligne de rendu. *
-* data = adresse non utilisée ici. *
-* *
-* Description : Fournit l'adresse physique ou en mémoire d'une ligne. *
-* *
-* Retour : Position physique ou en mémoire associée à la ligne. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_get_address(py_line *self, void *data)
-{
- vmpa_t value; /* Adresse à convertir */
-
- value = get_rendering_line_address(self->line);
-
- return py_vmpa_new_from_existing(value);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe présentant une ligne de rendu. *
-* data = adresse non utilisée ici. *
-* *
-* Description : Fournit le commentaire associé à la ligne s'il existe. *
-* *
-* Retour : Chaîne de caractères ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_get_comment(py_line *self, void *data)
-{
- const char *comment; /* Commentaire à transmettre */
-
- comment = get_rendering_line_comment(self->line);
-
- return Py_BuildValue("s", comment);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe présentant des options de représentation. *
-* value = nouvelle valeur affectée. *
-* data = adresse non utilisée ici. *
-* *
-* Description : Définit ou supprime un commentaire pour la ligne indiquée. *
-* *
-* Retour : Bilan de la mise à jour. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int py_line_set_comment(py_line *self, PyObject *value, void *data)
-{
- char *comment; /* Commentaire à définir */
-
- comment = PyString_AsString(value);
- /* FIXME : nil pour supprimer ? */
-
- set_rendering_line_comment(self->line, comment);
-
- return 0;
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* ITERATEUR POUR LE PARCOURS DE LIGNES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit le type d'objet 'analysis.LineIter' pour Python. *
-* *
-* Retour : Adresse du type vivant à manipuler. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyTypeObject *get_analysis_line_iter_type(void)
-{
- static PyTypeObject *result = NULL; /* Type pour objet à retourner */
-
- static PyTypeObject py_line_iter_type = {
-
- PyObject_HEAD_INIT(NULL)
-
- .tp_name = "pyoida.analysis.LineIter",
- .tp_basicsize = sizeof(py_line_iter),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyOIDA iterator for rendering lines",
-
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = (iternextfunc)py_line_iter_get_next
-
- };
-
- if (result == NULL) result = &py_line_iter_type;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Ajoute l'objet 'analysis.LineIter' au module Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_analysis_line_iter_to_python_module(PyObject *module)
-{
- PyTypeObject *py_line_iter_type; /* Type défini pour Python */
- int ret; /* Bilan d'un appel */
-
- py_line_iter_type = get_analysis_line_iter_type();
-
- if (PyType_Ready(py_line_iter_type) < 0)
- return false;
-
- Py_INCREF(py_line_iter_type);
- ret = PyModule_AddObject(module, "Iter", (PyObject *)py_line_iter_type);
-
- return (ret == 0);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : head = liste à parcourir. *
-* *
-* Description : Prépare l'itérateur pour un parcours de lignes de rendu. *
-* *
-* Retour : Instance d'itérateur prête à emploi. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_iter_new(GRenderingLine *head)
-{
- py_line_iter *result; /* Nouvelle instance à renvoyer*/
- PyTypeObject *type; /* Type d'objet à créer */
-
- type = get_analysis_line_iter_type();
-
- result = (py_line_iter *)type->tp_alloc(type, 0);
-
- if (result != NULL)
- {
- result->head = head;
- result->cur = NULL;
- }
-
- return (PyObject *)result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = instance d'objet à supprimer. *
-* *
-* Description : Libère la mémoire occupée par un itérateur de 'py_line'. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void py_line_iter_dealloc(py_line_iter *self)
-{
-#if PY_VERSION_HEX < 0x03000000
- self->ob_type->tp_free((PyObject *)self);
-#else
- Py_TYPE(self)->tp_free((PyObject *)self);
-#endif
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = instance manipulée à traiter. *
-* *
-* Description : Fournit l'élément suivant dans un parcours de lignes. *
-* *
-* Retour : Point suivant du parcours ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_iter_get_next(py_line_iter *self)
-{
- PyObject *result; /* Elément à retourner */
- GRenderingLine *next; /* Elément réel suivant */
-
- if (self->cur == NULL) next = self->head;
- else next = g_rendering_line_get_next_iter(self->head, self->cur, NULL);
-
- if (next != NULL)
- {
- self->cur = next;
- result = py_line_new_from_existing(next);
- Py_INCREF(result);
- }
- else result = NULL;
-
- return (PyObject *)result;
-
-}
-
-/* ---------------------------------------------------------------------------------- */
-/* ITERATEUR POUR LE PARCOURS DE LIGNES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit le type d'objet 'analysis.LineRevIter' pour Python. *
-* *
-* Retour : Adresse du type vivant à manipuler. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyTypeObject *get_analysis_line_riter_type(void)
-{
- static PyTypeObject *result = NULL; /* Type pour objet à retourner */
-
- static PyTypeObject py_line_riter_type = {
-
- PyObject_HEAD_INIT(NULL)
-
- .tp_name = "pyoida.analysis.LineRevIter",
- .tp_basicsize = sizeof(py_line_riter),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyOIDA iterator for rendering lines",
-
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = (iternextfunc)py_line_riter_get_prev
-
- };
-
- if (result == NULL) result = &py_line_riter_type;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Ajoute l'objet 'analysis.LineRevIter' au module Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_analysis_line_riter_to_python_module(PyObject *module)
-{
- PyTypeObject *py_line_riter_type; /* Type défini pour Python */
- int ret; /* Bilan d'un appel */
-
- py_line_riter_type = get_analysis_line_riter_type();
-
- if (PyType_Ready(py_line_riter_type) < 0)
- return false;
-
- Py_INCREF(py_line_riter_type);
- ret = PyModule_AddObject(module, "RevIter", (PyObject *)py_line_riter_type);
-
- return (ret == 0);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : head = liste à parcourir. *
-* *
-* Description : Prépare l'itérateur pour un parcours de lignes de rendu. *
-* *
-* Retour : Instance d'itérateur prête à emploi. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_riter_new(GRenderingLine *head)
-{
- py_line_riter *result; /* Nouvelle instance à renvoyer*/
- PyTypeObject *type; /* Type d'objet à créer */
-
- type = get_analysis_line_riter_type();
-
- result = (py_line_riter *)type->tp_alloc(type, 0);
-
- if (result != NULL)
- {
- result->head = head;
- result->cur = NULL;
- }
-
- return (PyObject *)result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = instance d'objet à supprimer. *
-* *
-* Description : Libère la mémoire occupée par un itérateur de 'py_line'. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void py_line_riter_dealloc(py_line_riter *self)
-{
-#if PY_VERSION_HEX < 0x03000000
- self->ob_type->tp_free((PyObject *)self);
-#else
- Py_TYPE(self)->tp_free((PyObject *)self);
-#endif
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = instance manipulée à traiter. *
-* *
-* Description : Fournit l'élément précédant dans un parcours de lignes. *
-* *
-* Retour : Point suivant du parcours ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_riter_get_prev(py_line_riter *self)
-{
- PyObject *result; /* Elément à retourner */
- GRenderingLine *prev; /* Elément réel précédant */
-
- if (self->cur == NULL) prev = g_rendering_line_get_last_iter(self->head, NULL);
- else prev = g_rendering_line_get_prev_iter(self->head, self->cur, NULL);
-
- if (prev != NULL)
- {
- self->cur = prev;
- result = py_line_new_from_existing(prev);
- Py_INCREF(result);
- }
- else result = NULL;
-
- return (PyObject *)result;
-
-}
diff --git a/plugins/pychrysa/analysis/line.h b/plugins/pychrysa/analysis/line.h
deleted file mode 100644
index e71596c..0000000
--- a/plugins/pychrysa/analysis/line.h
+++ /dev/null
@@ -1,61 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line.h - prototypes pour l'équivalent Python du fichier "analysis/line.h"
- *
- * Copyright (C) 2010 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 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_LINE_H
-#define _PLUGINS_PYOIDA_ANALYSIS_LINE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-#include <analysis/line.h>
-
-
-
-/* Crée un nouvel objet Python de type 'py_line'. */
-PyObject *py_line_new_from_existing(GRenderingLine *);
-
-/* Ajoute l'objet 'analysis.line' au module Python. */
-bool add_analysis_line_to_python_module(PyObject *);
-
-
-
-
-/* ---------------------- ITERATEUR POUR LE PARCOURS DE LIGNES ---------------------- */
-
-
-/* Ajoute l'objet 'analysis.LineIter' au module Python. */
-bool add_analysis_line_iter_to_python_module(PyObject *);
-
-
-
-/* ---------------------- ITERATEUR POUR LE PARCOURS DE LIGNES ---------------------- */
-
-
-/* Ajoute l'objet 'analysis.LineRevIter' au module Python. */
-bool add_analysis_line_riter_to_python_module(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYOIDA_ANALYSIS_LINE_H */
diff --git a/plugins/stackvars/operand.c b/plugins/stackvars/operand.c
index 77ea43d..c8028d1 100644
--- a/plugins/stackvars/operand.c
+++ b/plugins/stackvars/operand.c
@@ -95,11 +95,6 @@ static void g_stack_var_operand_class_init(GStackVarOperandClass *klass)
static void g_stack_var_operand_init(GStackVarOperand *operand)
{
- GContentExporter *parent; /* Instance parente */
-
- parent = G_CONTENT_EXPORTER(operand);
-
- //parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_stack_var_operand_add_to_gtk_buffer;
}
diff --git a/plugins/stackvars/stackvars.c b/plugins/stackvars/stackvars.c
index 1e18f28..26d9e11 100644
--- a/plugins/stackvars/stackvars.c
+++ b/plugins/stackvars/stackvars.c
@@ -23,8 +23,7 @@
#include "stackvars.h"
-
-#include <analysis/line_code.h>
+#if 0
#include <analysis/routine.h>
#include <arch/x86/operand.h>
#include <format/executable.h>
@@ -277,3 +276,4 @@ static bool replace_stack_var_in_operand(const GArchOperand *operand, GBinRoutin
return result;
}
+#endif
diff --git a/plugins/stackvars/stackvars.h b/plugins/stackvars/stackvars.h
index bf3e42e..accd5a4 100644
--- a/plugins/stackvars/stackvars.h
+++ b/plugins/stackvars/stackvars.h
@@ -24,7 +24,7 @@
#ifndef _PLUGINS_STACKVARS_STACKVARS_H
#define _PLUGINS_STACKVARS_STACKVARS_H
-
+#if 0
#include <glib-object.h>
#include <gmodule.h>
#include <stdbool.h>
@@ -43,7 +43,7 @@ G_MODULE_EXPORT PluginAction get_plugin_action(void);
/* Exécute une action définie sur un binaire chargé. */
G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *, PluginAction);
-
+#endif
#endif /* _PLUGINS_STACKVARS_STACKVARS_H */
diff --git a/plugins/theseus/Makefile.am b/plugins/theseus/Makefile.am
deleted file mode 100644
index 8040bb4..0000000
--- a/plugins/theseus/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-
-lib_LTLIBRARIES = libtheseus.la
-
-libtheseus_la_SOURCES = \
- theseus.h theseus.c
-
-libtheseus_la_CFLAGS = $(AM_CFLAGS)
-
-
-INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) -I../../src
-
-AM_CPPFLAGS =
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/theseus/theseus.c b/plugins/theseus/theseus.c
deleted file mode 100644
index ea119ef..0000000
--- a/plugins/theseus/theseus.c
+++ /dev/null
@@ -1,620 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * theseus.c - décompilation en fonction du flot d'exécution
- *
- * Copyright (C) 2010-2012 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/>.
- */
-
-
-#include "theseus.h"
-
-
-#include <analysis/exporter.h>
-#include <analysis/line_code.h>
-#include <arch/artificial.h>
-
-
-/* Traite en premier lieu les adresses marquées "impératives". */
-static bool register_white_list(GLoadedBinary *);
-
-/* Indique si une ligne peut faire l'objet d'un nouveau suivi. */
-static bool can_line_be_followed(const GRenderingLine *);
-
-/* Indique si une ligne a déjà été traitée lors d'un suivi. */
-static bool can_line_be_processed(const GRenderingLine *);
-
-/* Marque une ligne comme ayant été traitée. */
-static void mark_line_as_done(GRenderingLine *, bool);
-
-/* Suit le flot d'exécution à partir d'un point donné. */
-static bool follow_flow_from_line(GLoadedBinary *, vmpa_t);
-
-/* Désassemble une nouvelle instruction à partir d'une adresse. */
-static GRenderingLine *disassemble_target_address(GLoadedBinary *, GRenderingLine *, vmpa_t);
-
-/* Insère dans le flux existant les nouvelles lignes crées. */
-static bool insert_new_lines_into_flow(GLoadedBinary *, GRenderingLine *, GRenderingLine *);
-
-
-
-
-
-/*
-mov edx, 0x80480fb
-call [edx]
-mov edx, 0x80480fb
-add edx, 0x8
-call [edx]
-mov edx, 0x80480fb
-add edx, 0x10
-call [edx]
-mov edx, 0x80480fb
-add edx, 0xc
-call [edx]
-mov edx, 0x80480fb
-add edx, 0x14
-call [edx]
-mov edx, 0x80480fb
-add edx, 0x4
-call [edx]
-*/
-
-
-static const vmpa_t _white_list[] = {
- 0x80480fbull,
- 0x8048103ull,
- 0x804810bull,
- 0x8048107ull,
- 0x804810full,
- 0x80480ffull
-};
-
-static const size_t _white_list_count = 6;
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* *
-* Description : Initialise le greffon pour les bornes de routine. *
-* *
-* Retour : true. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-G_MODULE_EXPORT bool init_plugin(GObject *ref)
-{
- return true;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit une indication sur le type d'opération(s) menée(s). *
-* *
-* Retour : Description d'une action. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-G_MODULE_EXPORT PluginAction get_plugin_action(void)
-{
- return PGA_CODE_PROCESS;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = représentation binaire à traiter. *
-* action = action attendue. *
-* *
-* Description : Exécute une action définie sur un binaire chargé. *
-* *
-* Retour : true si une action a été menée, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *binary, PluginAction action)
-{
- bool result; /* Bilan à retourner */
- GRenderingLine *lines; /* Lignes désassemblées */
- GExeFormat *format; /* Format du binaire traité */
- vmpa_t start; /* Point de départ de l'action */
-
-
-
- GRenderingOptions *options;
- GRenderingLine *iter;
-
-
- lines = g_loaded_binary_get_lines(binary);
-
-
-
-
- format = g_loaded_binary_get_format(binary);
-
- start = g_exe_format_get_entry_point(format);
-
- result = register_white_list(binary);
-
- result &= follow_flow_from_line(binary, start);
-
-
- //follow_flow_from_line(binary, 0x0804810bull);
-
-
-
-
-
- options = g_loaded_binary_get_options(binary);
-
- for (iter = lines; iter != NULL; iter = g_rendering_line_get_next_iter(lines, iter, NULL))
- {
-
- printf(" >>>>>> %c%c ",
- g_object_get_data(G_OBJECT(iter), "theseus_white") != NULL ? '!' : ' ',
- g_object_get_data(G_OBJECT(iter), "theseus_done") != NULL ? '*' : ' ');
- g_content_exporter_add_text(G_CONTENT_EXPORTER(iter), options, 0/*MRD_BLOCK*/, stdout);
- fflush(stdout);
- printf("\n");
-
-
- }
-
-
-
- //exit(-1);
-
-
-
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = représentation binaire à traiter. *
-* *
-* Description : Traite en premier lieu les adresses marquées "impératives". *
-* *
-* Retour : true si le déroulement s'est bien effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool register_white_list(GLoadedBinary *binary)
-{
- bool result; /* Bilan à retourner */
- GRenderingLine *lines; /* Lignes désassemblées */
- size_t i; /* Boucle de parcours */
- GRenderingLine *target; /* Ligne à transformer ? */
- GRenderingLine *last; /* Nouvelle ligne principale */
- GRenderingLine *new; /* Nouvelles lignes de rendu */
-
- result = true;
-
- lines = g_loaded_binary_get_lines(binary);
-
- for (i = 0; i < _white_list_count && result; i++)
- {
- target = g_rendering_line_find_by_address(lines, NULL, _white_list[i]);
- target = g_rendering_line_loop_for_code(target, NULL);
-
- new = disassemble_target_address(binary, target, _white_list[i]);
-
- last = g_rendering_line_get_last_iter(new, NULL);
- mark_line_as_done(last, true);
-
- result = insert_new_lines_into_flow(binary, target, new);
-
- result &= follow_flow_from_line(binary, _white_list[i]);
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de rendu à analyser. *
-* *
-* Description : Indique si une ligne peut faire l'objet d'un nouveau suivi. *
-* *
-* Retour : true si le suivi peut continuer, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool can_line_be_followed(const GRenderingLine *line)
-{
- bool result; /* Bilan d'analyse à renvoyer */
-
- result = true;
-
- if (g_object_get_data(G_OBJECT(line), "theseus_done") != NULL)
- result = (g_object_get_data(G_OBJECT(line), "theseus_white") != NULL);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de rendu à analyser. *
-* *
-* Description : Indique si une ligne a déjà été traitée lors d'un suivi. *
-* *
-* Retour : true si le suivi peut continuer, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool can_line_be_processed(const GRenderingLine *line)
-{
- return (g_object_get_data(G_OBJECT(line), "theseus_done") == NULL);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de rendu à traiter. *
-* white = type de marquage à apposer (liste blanche ou normal).*
-* *
-* Description : Marque une ligne comme ayant été traitée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void mark_line_as_done(GRenderingLine *line, bool white)
-{
- if (white)
- g_object_set_data(G_OBJECT(line), "theseus_white", line);
- else
- g_object_set_data(G_OBJECT(line), "theseus_done", line);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = représentation binaire à traiter. *
-* start = point de départ de la procédure. *
-* *
-* Description : Suit le flot d'exécution à partir d'un point donné. *
-* *
-* Retour : true si le déroulement s'est bien effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool follow_flow_from_line(GLoadedBinary *binary, vmpa_t start)
-{
- bool result; /* Bilan de opérations */
- GRenderingLine *lines; /* Lignes désassemblées */
- GRenderingLine *first; /* Première ligne à traiter */
- vmpa_t addr; /* Adresse référencée */
- GRenderingLine *new; /* Nouvelles lignes de rendu */
- GRenderingLine *iter; /* Boucle de parcours */
- GArchInstruction *instr; /* Instruction à ausculter */
- InstructionLinkType type; /* Type de référence */
- GRenderingLine *target; /* Ligne visée par la référence*/
-
- lines = g_loaded_binary_get_lines(binary);
-
- first = g_rendering_line_find_by_address(lines, NULL, start);
- first = g_rendering_line_loop_for_code(first, NULL);
-
- if (!can_line_be_followed(first))
- return true;
-
- //if (start != 0x0804810bull) return true;
-
- printf("###################################### Passage\n");
-
- /* Alignement sur le point d'entrée */
-
- result = true;
-
- addr = get_rendering_line_address(first);
-
- if (addr < start)
- {
- new = disassemble_target_address(binary, first, start);
-
- result = insert_new_lines_into_flow(binary, target, new);
-
- first = g_rendering_line_find_by_address(lines, NULL, start);
-
- //return true;
-
- }
- else g_object_set_data(G_OBJECT(first), "theseus_done", binary);
-
-
-
-
- printf("Analyse :: 0x%016llx\n", get_rendering_line_address(first));
-
-
-
-
-
- /* Poursuite du suivi du flot... */
-
- for (iter = g_rendering_line_get_next_iter(lines, first, NULL);
- iter != NULL/* && result*/;
- iter = g_rendering_line_get_next_iter(lines, iter, NULL))
- {
- /* On ne traite que du code ici ! */
- if (!G_IS_CODE_LINE(iter)) continue;
-
- /*
- printf("testing... 0x%08llx => %d\n",
- get_rendering_line_address(iter),
- can_line_be_processed(iter));
- */
-
- if (!can_line_be_processed(iter))
- break;
-
- instr = g_code_line_get_instruction(G_CODE_LINE(iter));
-
- /* Si le code n'es pas désassemblé ! */
- if (G_IS_DB_INSTRUCTION(instr))
- {
- new = disassemble_target_address(binary, iter, get_rendering_line_address(iter));
- result = insert_new_lines_into_flow(binary, iter, new);
-
- if (!result)
- {
- mark_line_as_done(iter, false);
- break;
- }
- else
- {
- iter = new;
- mark_line_as_done(iter, false);
-
- instr = g_code_line_get_instruction(G_CODE_LINE(iter));
- if (!G_IS_DB_INSTRUCTION(instr)) break;
-
- }
-
- }
- else mark_line_as_done(iter, false);
-
- type = g_arch_instruction_get_link(instr, &addr);
-
- if (get_rendering_line_address(iter) == 0x0804811aull)
- printf(" == got it !! ==\n");
-
-
- switch (type)
- {
- case ILT_JUMP:
- case ILT_JUMP_IF_FALSE:
- case ILT_JUMP_IF_TRUE:
- result = follow_flow_from_line(binary, addr);
- break;
-
- default:
- break;
-
- }
-
- if (get_rendering_line_address(iter) == 0x0804811aull)
- printf(" == continue ? %d\n", result);
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = représentation binaire à traiter. *
-* old = ligne contenant l'adresse visée à remplacer. *
-* target = adresse de la nouvelle instruction à voir. *
-* *
-* Description : Désassemble une nouvelle instruction à partir d'une adresse. *
-* *
-* Retour : Nouvelle(s) ligne(s) en place ou NULL en cas d'échec. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GRenderingLine *disassemble_target_address(GLoadedBinary *binary, GRenderingLine *old, vmpa_t target)
-{
- GRenderingLine *result; /* Lignes en place à renvoyer */
- GExeFormat *format; /* Format du binaire fourni */
- GArchProcessor *proc; /* Architecture du binaire */
- GRenderingOptions *options; /* Options de désassemblage */
- bin_t *data; /* Données binaires chargées */
- off_t length; /* Taille du code binaire */
- vmpa_t old_addr; /* Adresse de ligne à casser */
- off_t offset; /* Position dans le contenu */
- vmpa_t i; /* Boucle de parcours */
- GArchInstruction *instr; /* Instruction décodée */
- GRenderingLine *line; /* Nouvelle ligne de rendu */
-
- result = NULL;
-
- format = g_loaded_binary_get_format(binary);
- proc = get_arch_processor_from_format(format);
- options = g_loaded_binary_get_options(binary);
-
- data = g_loaded_binary_get_data(binary, &length);
-
- old_addr = get_rendering_line_address(old);
- if (!g_exe_format_translate_address_into_offset(format, old_addr, &offset))
- return NULL;
-
- /* Si on doit laisser sur le carreau quelques octets perdus... */
- for (i = 0; i < (target - old_addr); i++)
- {
- instr = g_db_instruction_new_from_data(data, &offset, length, 0/*base*/, proc);
- g_arch_instruction_set_location(instr, 0/*base*/ + offset - 1, 1, old_addr + i);
-
- line = g_code_line_new(old_addr + i, instr, options);
- g_rendering_line_add_to_lines(&result, line);
-
- }
-
- /* Décodage des instructions */
-
- instr = g_arch_processor_decode_instruction(proc, NULL /*FIXME*/, data,
- &offset, length, 0/*offset*/, target, NULL/*FIXME*/);
-
- line = g_code_line_new(target, instr, options);
- g_rendering_line_add_to_lines(&result, line);
-
- mark_line_as_done(line, false);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = représentation binaire à traiter. *
-* old = ancienne ligne, point de départ des remplacements. *
-* new = nouvelle(s) ligne(s) de représentation. *
-* *
-* Description : Insère dans le flux existant les nouvelles lignes crées. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool insert_new_lines_into_flow(GLoadedBinary *binary, GRenderingLine *old, GRenderingLine *new)
-{
- bool result; /* Bilan de opérations */
- GExeFormat *format; /* Format du binaire fourni */
- GArchProcessor *proc; /* Architecture du binaire */
- GRenderingOptions *options; /* Options de désassemblage */
- bin_t *data; /* Données binaires chargées */
- off_t length; /* Taille du code binaire */
- GRenderingLine **root; /* Racine des lignes de rendu */
- GRenderingLine *iter; /* Boucle de parcours */
- vmpa_t start; /* Adresse de début du bloc */
- vmpa_t end; /* Adresse de fin du bloc */
- vmpa_t max; /* Adresse de fin de ligne */
- vmpa_t i; /* Boucle de parcours */
- off_t offset; /* Position dans le contenu */
- GArchInstruction *instr; /* Instruction décodée */
- GRenderingLine *line; /* Nouvelle ligne de rendu */
- GRenderingLine *last; /* Dernière ligne à vérifier */
-
- format = g_loaded_binary_get_format(binary);
- proc = get_arch_processor_from_format(format);
- options = g_loaded_binary_get_options(binary);
-
- data = g_loaded_binary_get_data(binary, &length);
-
- /* Etendue du bloc de remplacement */
-
- iter = g_rendering_line_get_last_iter(new, NULL);
-
- start = get_rendering_line_address(new);
-
- end = get_rendering_line_address(iter);
- end += get_rendering_line_length(iter) - 1;
-
- /* Bourrage nécessaire ? */
-
- root = g_loaded_binary_get_lines_root(binary);
-
- iter = g_rendering_line_find_by_address(*root, NULL, end);
-
- max = get_rendering_line_address(iter);
- max += get_rendering_line_length(iter);
-
- for (i = end + 1; i < max; i++)
- {
- if (!g_exe_format_translate_address_into_offset(format, i, &offset))
- /**
- * Comme les adresses proviennent à l'origine de partie valide,
- * on considère que l'appel est toujours un succès.
- * Cela permet d'avoir deux bilan possible : procédure bien déroulée,
- * ou bien remplacement impossible pour cause de place déjà prise.
- */
- /*return false*/;
-
- instr = g_db_instruction_new_from_data(data, &offset, length, 0/*base*/, proc);
- g_arch_instruction_set_location(instr, 0/*base*/ + offset - 1, 1, i);
-
- line = g_code_line_new(i, instr, options);
- g_rendering_line_add_to_lines(&new, line);
-
- }
-
- /* S'assure qu'on ne touche à rien de sacré */
-
- result = true;
-
- last = g_rendering_line_find_by_address(*root, NULL, end);
-
- for (iter = g_rendering_line_find_by_address(*root, NULL, start);
- iter != NULL && result;
- iter = g_rendering_line_get_next_iter(*root, iter, last))
- {
- result = can_line_be_processed(iter);
- }
-
- /* Remplacement en bonne et due forme */
-
- if (result)
- {
- g_rendering_line_remove_range(root, start, end);
- g_rendering_line_insert_lines(root, &new);
- }
-
- return result;
-
-}
diff --git a/plugins/theseus/theseus.h b/plugins/theseus/theseus.h
deleted file mode 100644
index e1a6f36..0000000
--- a/plugins/theseus/theseus.h
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * theseus.h - prototypes pour la décompilation en fonction du flot d'exécution
- *
- * Copyright (C) 2010 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 _PLUGINS_THESEUS_THESEUS_H
-#define _PLUGINS_THESEUS_THESEUS_H
-
-
-#include <glib-object.h>
-#include <gmodule.h>
-#include <stdbool.h>
-
-
-#include <analysis/binary.h>
-#include <plugins/plugin-def.h>
-
-
-
-/* Initialise le greffon pour les bornes de routine. */
-G_MODULE_EXPORT bool init_plugin(GObject *);
-
-/* Fournit une indication sur le type d'opération(s) menée(s). */
-G_MODULE_EXPORT PluginAction get_plugin_action(void);
-
-/* Exécute une action définie sur un binaire chargé. */
-G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *, PluginAction);
-
-
-
-#endif /* _PLUGINS_THESEUS_THESEUS_H */
diff --git a/src/analysis/Makefile.am b/src/analysis/Makefile.am
index 1c3950f..f58ddca 100755
--- a/src/analysis/Makefile.am
+++ b/src/analysis/Makefile.am
@@ -3,13 +3,6 @@ noinst_LTLIBRARIES = libanalysis.la
libanalysis_la_SOURCES = \
binary.h binary.c \
- exporter-int.h \
- exporter.h exporter.c \
- line-int.h \
- line.h line.c \
- line_code.h line_code.c \
- line_comment.h line_comment.c \
- line_prologue.h line_prologue.c \
roptions.h roptions.c \
routine.h routine.c \
type-int.h \
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index eb042c6..073c546 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -29,7 +29,6 @@
#include <stdbool.h>
-#include "line.h"
#include "../arch/processor.h"
#include "../common/xml.h"
#include "../format/executable.h"
diff --git a/src/analysis/exporter-int.h b/src/analysis/exporter-int.h
deleted file mode 100644
index ec75bcc..0000000
--- a/src/analysis/exporter-int.h
+++ /dev/null
@@ -1,70 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * exporter-int.h - prototypes pour la traduction humaine des lignes de rendus
- *
- * Copyright (C) 2009-2010 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_EXPORTER_INT_H
-#define _ANALYSIS_EXPORTER_INT_H
-
-
-#include "exporter.h"
-
-
-
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-typedef void (* add_text_fc) (GContentExporter *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un texte GTK le contenu de la ligne de rendu. */
-typedef void (* export_buffer_fc) (GContentExporter *, GBufferLine *, GRenderingOptions *);
-
-
-
-/* Exportation de contenu (instance) */
-struct _GContentExporter
-{
- GObject parent; /* A laisser en premier */
-
- add_text_fc add_text; /* Remplissage simple */
- export_buffer_fc export_buffer; /* Constitution du texte GLib */
-
-};
-
-
-/* Exportation de contenu (classe) */
-struct _GContentExporterClass
-{
- GObjectClass parent; /* A laisser en premier */
-
- PangoContext *context; /* Contexte graphique Pango */
- PangoAttrList *attribs[RTT_COUNT]; /* Décorateurs pour tampons */
-
-};
-
-
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-void g_content_exporter_insert_text(GContentExporter *, FILE *, const char *, size_t, RenderingTagType);
-
-/* Ajoute du texte à un tampon de code via l'instance spécifiée. */
-void g_content_exporter_insert_into_buffer(GContentExporter *, GBufferLine *, BufferLineColumn, const char *, size_t, RenderingTagType);
-
-
-
-#endif /* _ANALYSIS_EXPORTER_INT_H */
diff --git a/src/analysis/exporter.c b/src/analysis/exporter.c
deleted file mode 100644
index 40e9fe1..0000000
--- a/src/analysis/exporter.c
+++ /dev/null
@@ -1,281 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * exporter.c - traduction humaine des lignes de rendus
- *
- * Copyright (C) 2009-2010 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/>.
- */
-
-
-#include "exporter.h"
-
-
-#include "exporter-int.h"
-
-
-
-/* Indique le type défini pour une exportation de contenu. */
-G_DEFINE_TYPE(GContentExporter, g_content_exporter, G_TYPE_OBJECT);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des lignes de représentation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_content_exporter_class_init(GContentExporterClass *klass)
-{
- GdkScreen *screen; /* Ecran pour GDK */
- PangoFontDescription *font_desc; /* Police de caractère */
- PangoAttribute *attrib; /* Propriété de rendu */
-
- /* Exportation vers un tampon de code */
-
- screen = gdk_screen_get_default();
-
- font_desc = pango_font_description_from_string("mono 10");
-
- klass->context = gdk_pango_context_get_for_screen(screen);
-
- pango_context_set_font_description(klass->context, font_desc);
- pango_context_set_base_dir(klass->context, PANGO_DIRECTION_LTR);
- pango_context_set_language(klass->context, gtk_get_default_language());
-
- /* RTT_RAW */
-
- klass->attribs[RTT_RAW] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(0, 0, 0);
- pango_attr_list_insert(klass->attribs[RTT_RAW], attrib);
-
- /* RTT_COMMENT */
-
- klass->attribs[RTT_COMMENT] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(14335, 45311, 23551);
- pango_attr_list_insert(klass->attribs[RTT_COMMENT], attrib);
-
- /* RTT_RAW_CODE */
-
- klass->attribs[RTT_RAW_CODE] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(48895, 48895, 48895);
- pango_attr_list_insert(klass->attribs[RTT_RAW_CODE], attrib);
-
- /* RTT_INSTRUCTION */
-
- klass->attribs[RTT_INSTRUCTION] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(0, 0, 0);
- pango_attr_list_insert(klass->attribs[RTT_INSTRUCTION], attrib);
-
- /* RTT_IMMEDIATE */
-
- klass->attribs[RTT_IMMEDIATE] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(41215, 8447, 61695);
- pango_attr_list_insert(klass->attribs[RTT_IMMEDIATE], attrib);
-
- /* RTT_REGISTER */
-
- klass->attribs[RTT_REGISTER] = pango_attr_list_new();
-
- //attrib = pango_attr_foreground_new(23551, 23551, 51455);
- attrib = pango_attr_foreground_new(16895, 16895, 53759);
- pango_attr_list_insert(klass->attribs[RTT_REGISTER], attrib);
-
- /* RTT_HOOK */
-
- klass->attribs[RTT_HOOK] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(0, 0, 0);
- pango_attr_list_insert(klass->attribs[RTT_HOOK], attrib);
-
- attrib = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
- pango_attr_list_insert(klass->attribs[RTT_HOOK], attrib);
-
- /* RTT_SIGNS */
-
- klass->attribs[RTT_SIGNS] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(0, 0, 0);
- pango_attr_list_insert(klass->attribs[RTT_SIGNS], attrib);
-
- attrib = pango_attr_weight_new(PANGO_WEIGHT_SEMIBOLD);
- pango_attr_list_insert(klass->attribs[RTT_SIGNS], attrib);
-
- /* RTT_LTGT */
-
- klass->attribs[RTT_LTGT] = pango_attr_list_new();
-
- /* RTT_SECTION */
-
- klass->attribs[RTT_SECTION] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(51200, 2560, 2560);
- pango_attr_list_insert(klass->attribs[RTT_SECTION], attrib);
-
- /*
- attrib = pango_attr_foreground_new(56832, 26880, 43008);
- pango_attr_list_insert(klass->attribs[RTT_SECTION], attrib);
-
- attrib = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
- pango_attr_list_insert(klass->attribs[RTT_SECTION], attrib);
- */
-
- /* RTT_SEGMENT */
-
- klass->attribs[RTT_SEGMENT] = pango_attr_list_new();
-
- /* RTT_STRING */
-
- klass->attribs[RTT_STRING] = pango_attr_list_new();
-
- attrib = pango_attr_foreground_new(52224, 32256, 0);
- pango_attr_list_insert(klass->attribs[RTT_STRING], attrib);
-
- /* RTT_VAR_NAME */
-
- klass->attribs[RTT_VAR_NAME] = pango_attr_list_new();
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : exporter = instance à initialiser. *
-* *
-* Description : Initialise une instance de ligne de représentation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_content_exporter_init(GContentExporter *exporter)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : exporter = instance sachant exporter son contenu. *
-* stream = flux ouvert en écriture. *
-* text = texte à insérer dans l'existant. *
-* length = taille du texte à traiter. *
-* tag = type de décorateur à utiliser. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_content_exporter_insert_text(GContentExporter *exporter, FILE *stream, const char *text, size_t length, RenderingTagType tag)
-{
- size_t ret; /* Quantité d'octets écrite */
-
- ret = fwrite(text, sizeof(char), length, stream);
- if (ret != length) perror("fwrite");
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : exporter = instance sachant exporter son contenu. *
-* buffer = espace où placer ledit contenu. *
-* column = colonne de la ligne visée par l'insertion. *
-* text = texte à insérer dans l'existant. *
-* length = taille du texte à traiter. *
-* type = type de décorateur à utiliser. *
-* *
-* Description : Ajoute du texte à un tampon de code via l'instance spécifiée.*
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_content_exporter_insert_into_buffer(GContentExporter *exporter, GBufferLine *buffer, BufferLineColumn column, const char *text, size_t length, RenderingTagType type)
-{
- GContentExporterClass *class; /* Stockage de briques de base */
- GBufferSegment *segment; /* Portion de texte à ajouter */
-
- class = G_CONTENT_EXPORTER_GET_CLASS(exporter);
-
- segment = g_buffer_segment_new(class->context, class->attribs[type], text, length);
- g_buffer_line_add_segment(buffer, column, segment);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : exporter = instance sachant exporter son contenu. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_content_exporter_add_text(GContentExporter *exporter, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- if (exporter->add_text != NULL)
- exporter->add_text(exporter, options, rendering, stream);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : exporter = instance sachant exporter son contenu. *
-* line = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_content_exporter_to_buffer(GContentExporter *exporter, GBufferLine *line, GRenderingOptions *options)
-{
- if (exporter->export_buffer != NULL)
- exporter->export_buffer(exporter, line, options);
-
-}
diff --git a/src/analysis/exporter.h b/src/analysis/exporter.h
deleted file mode 100644
index 1c87c2d..0000000
--- a/src/analysis/exporter.h
+++ /dev/null
@@ -1,70 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * exporter.h - prototypes pour la traduction humaine des lignes de rendus
- *
- * Copyright (C) 2009-2010 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_EXPORTER_H
-#define _ANALYSIS_EXPORTER_H
-
-
-#include <glib-object.h>
-#include <stdio.h>
-#include <gtk/gtktextbuffer.h>
-
-
-#include "roptions.h"
-#include "../glibext/gbufferline.h"
-
-
-
-#define G_TYPE_CONTENT_EXPORTER g_content_exporter_get_type()
-#define G_CONTENT_EXPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_content_exporter_get_type(), GContentExporter))
-#define G_IS_CONTENT_EXPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_content_exporter_get_type()))
-#define G_CONTENT_EXPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_CONTENT_EXPORTER, GContentExporterClass))
-#define G_IS_CONTENT_EXPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_CONTENT_EXPORTER))
-#define G_CONTENT_EXPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_CONTENT_EXPORTER, GContentExporterClass))
-
-
-/* Exportation de contenu (instance) */
-typedef struct _GContentExporter GContentExporter;
-
-/* Exportation de contenu (classe) */
-typedef struct _GContentExporterClass GContentExporterClass;
-
-
-
-/* Indique le type défini pour une exportation de contenu. */
-GType g_content_exporter_get_type(void);
-
-/* Définit et/ou renvoie le singleton pour les marques de texte. */
-GtkTextTagTable *_get_gtk_tag_table(GtkTextTagTable *);
-
-#define get_gtk_tag_table() _get_gtk_tag_table(NULL)
-
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-void g_content_exporter_add_text(GContentExporter *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-void g_content_exporter_to_buffer(GContentExporter *, GBufferLine *, GRenderingOptions *);
-
-
-
-#endif /* _ANALYSIS_EXPORTER_H */
diff --git a/src/analysis/line-int.h b/src/analysis/line-int.h
deleted file mode 100644
index 5027a1a..0000000
--- a/src/analysis/line-int.h
+++ /dev/null
@@ -1,86 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line-int.h - prototypes pour l'interface des représentations des lignes de rendu
- *
- * Copyright (C) 2009-2010 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_LINE_INT_H
-#define _ANALYSIS_LINE_INT_H
-
-
-#include "line.h"
-
-
-#include "exporter-int.h"
-#include "../common/dllist.h"
-
-
-
-/* Ligne de représentation générique (instance) */
-struct _GRenderingLine
-{
- GContentExporter parent; /* A laisser en premier */
-
- DL_LIST_ITEM(link); /* Maillon de liste chaînée */
-
- vmpa_t offset; /* Position en mémoire/physique*/
- off_t length; /* Nombre d'adresses associées */
-
- char *comment; /* Texte à afficher */
-
- RenderingLineType type; /* Type de représentation */
- RenderingLineFlag flags; /* Extension d'informations */
-
- GRenderingLine **from; /* Origines des références */
- size_t from_count; /* Nombre de ces origines */
- GRenderingLine **to; /* Eventuelles lignes visées */
- InstructionLinkType *links_type; /* Type des liens de dest. */
- size_t to_count; /* Nombre de ces destinations */
-
-};
-
-
-#define lines_list_last(head) dl_list_last(head, GRenderingLine, link)
-#define lines_list_next_iter(iter, head) dl_list_next_iter(iter, head, GRenderingLine, link)
-#define lines_list_prev_iter(iter, head) dl_list_prev_iter(iter, head, GRenderingLine, link)
-#define lines_list_add_before(new, head, pos) dl_list_add_before(new, head, pos, link)
-#define lines_list_add_tail(new, head) dl_list_add_tail(new, head, GRenderingLine, link)
-#define lines_list_del(item, head) dl_list_del(item, head, GRenderingLine, link)
-#define lines_list_merge(head1, head2) dl_list_merge(head1, head2, GRenderingLine, link)
-#define lines_list_for_each(pos, head) dl_list_for_each(pos, head, GRenderingLine, link)
-#define lines_list_for_each_safe(pos, head, next) dl_list_for_each_safe(pos, head, next, GRenderingLine, link)
-
-
-/* Ligne de représentation générique (classe) */
-struct _GRenderingLineClass
-{
- GContentExporterClass parent; /* A laisser en premier */
-
- GtkStyle *style; /* Style GTK commun aux lignes */
-
- /* Signaux */
-
- void (* rendering_line_flags_changed) (GRenderingLine *);
-
-};
-
-
-
-#endif /* _ANALYSIS_LINE_INT_H */
diff --git a/src/analysis/line.c b/src/analysis/line.c
deleted file mode 100644
index 560b683..0000000
--- a/src/analysis/line.c
+++ /dev/null
@@ -1,717 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line.c - représentation des lignes de rendu
- *
- * Copyright (C) 2009-2010 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/>.
- */
-
-
-#include "line.h"
-
-
-#include "line-int.h"
-
-
-
-#include <malloc.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/param.h>
-
-
-#include "line_code.h"
-#include "../common/dllist.h"
-
-
-
-/* ------------------------ TRAITEMENT INDIVIDUEL DES LIGNES ------------------------ */
-
-
-/* Initialise la classe des lignes de représentation. */
-static void g_rendering_line_class_init(GRenderingLineClass *);
-
-/* Initialise une instance de ligne de représentation. */
-static void g_rendering_line_init(GRenderingLine *);
-
-/* Etablit un lien entre deux lignes de représentation. */
-static void g_rendering_line_add_link_reference(GRenderingLine *, GRenderingLine *);
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* TRAITEMENT INDIVIDUEL DES LIGNES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/* Indique le type définit pour une ligne de représentation. */
-G_DEFINE_TYPE(GRenderingLine, g_rendering_line, G_TYPE_CONTENT_EXPORTER);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des lignes de représentation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_rendering_line_class_init(GRenderingLineClass *klass)
-{
- klass->style = gtk_style_new();
-
- g_signal_new("rendering-line-flags-changed",
- G_TYPE_RENDERING_LINE,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GRenderingLineClass, rendering_line_flags_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0, NULL);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = instance à initialiser. *
-* *
-* Description : Initialise une instance de ligne de représentation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_rendering_line_init(GRenderingLine *line)
-{
- DL_LIST_ITEM_INIT(&line->link);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* *
-* Description : Fournit l'adresse physique ou en mémoire d'une ligne. *
-* *
-* Retour : Position physique ou en mémoire associée à la ligne. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-vmpa_t get_rendering_line_address(const GRenderingLine *line)
-{
- return line->offset;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* *
-* Description : Fournit la longueur du code représenté par une ligne. *
-* *
-* Retour : Taille du code représenté (0 si aucun). *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-off_t get_rendering_line_length(const GRenderingLine *line)
-{
- return line->length;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* *
-* Description : Fournit le commentaire associé à la ligne s'il existe. *
-* *
-* Retour : Chaîne de caractères ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const char *get_rendering_line_comment(const GRenderingLine *line)
-{
- return line->comment;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* comment = nouveau commentaire à insérer ou NULL. *
-* *
-* Description : Définit ou supprime un commentaire pour la ligne indiquée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void set_rendering_line_comment(GRenderingLine *line, const char *comment)
-{
- if (line->comment != NULL)
- free(line->comment);
-
- if (comment == NULL) line->comment = NULL;
- else line->comment = strdup(comment);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* *
-* Description : Fournit le type d'une ligne. *
-* *
-* Retour : Type de la ligne fournie. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-RenderingLineType get_rendering_line_type(const GRenderingLine *line)
-{
- return line->type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à mettre à jour. *
-* flag = extension d'information à ajouter. *
-* *
-* Description : Ajoute une information supplémentaire à une ligne. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_add_flag(GRenderingLine *line, RenderingLineFlag flag)
-{
- line->flags |= flag;
-
- g_signal_emit_by_name(line, "rendering-line-flags-changed");
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à mettre à jour. *
-* flag = extension d'information à retirer. *
-* *
-* Description : Retire une information supplémentaire sur d'une ligne. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_remove_flag(GRenderingLine *line, RenderingLineFlag flag)
-{
- line->flags &= ~flag;
-
- g_signal_emit_by_name(line, "rendering-line-flags-changed");
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à mettre à jour. *
-* flag = extension d'information à ajouter ou retirer. *
-* *
-* Description : Bascule l'état d'une information sur d'une ligne. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_toggle_flag(GRenderingLine *line, RenderingLineFlag flag)
-{
- line->flags = (line->flags & ~flag) | (line->flags ^ flag);
-
- g_signal_emit_by_name(line, "rendering-line-flags-changed");
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* *
-* Description : Fournit les informations supplémentaires d'une ligne. *
-* *
-* Retour : Extensions d'informations courantes. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-RenderingLineFlag g_rendering_line_get_flags(const GRenderingLine *line)
-{
- return line->flags;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* src = ligne visée par la liaison (côté origine). *
-* *
-* Description : Etablit un lien entre deux lignes de représentation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_add_link_reference(GRenderingLine *line, GRenderingLine *src)
-{
- line->from = (GRenderingLine **)realloc(line->from, ++line->from_count * sizeof(GRenderingLine *));
-
- line->from[line->from_count - 1] = src;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* dest = ligne visée par la liaison (côté destination). *
-* type = type de lien à construire. *
-* *
-* Description : Etablit un lien entre deux lignes de représentation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_link_with(GRenderingLine *line, GRenderingLine *dest, InstructionLinkType type)
-{
- g_rendering_line_add_link_reference(dest, line);
-
- line->to_count++;
-
- line->to = (GRenderingLine **)realloc(line->to, line->to_count * sizeof(GRenderingLine *));
- line->links_type = (InstructionLinkType *)realloc(line->links_type, line->to_count * sizeof(InstructionLinkType));
-
- line->to[line->to_count - 1] = dest;
- line->links_type[line->to_count - 1] = type;
-
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* *
-* Description : Indique si la ligne a une ou plusieurs origines. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_rendering_line_has_sources(const GRenderingLine *line)
-{
- return (line->from_count > 0);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* *
-* Description : Indique si la ligne a une suite autre que la ligne suivante. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_rendering_line_has_destinations(const GRenderingLine *line)
-{
- return (line->to_count > 1 || (line->to_count == 1 && line->links_type[0] != ILT_CALL));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne dont les informations sont à consulter. *
-* lines = liste des lignes de destination. [OUT] *
-* types = liste des types de liens présents. [OUT] *
-* *
-* Description : Fournit la ligne de code de destination du lien de la ligne. *
-* *
-* Retour : Ligne à l'autre extrémité du lien. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-size_t g_rendering_line_get_destinations(const GRenderingLine *line, GRenderingLine ***lines, InstructionLinkType **types)
-{
- *lines = line->to;
- *types = line->links_type;
-
- return line->to_count;
-
-}
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* TRAITEMENT DES LIGNES PAR GROUPE */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : lines = liste de lignes à compléter, ou NULL. *
-* line = nouvelle ligne à intégrer à l'ensemble. *
-* *
-* Description : Ajoute une ligne à un ensemble existant. *
-* *
-* Retour : - *
-* *
-* Remarques : La ligne est considérée comme étant insérée au bon endroit. *
-* *
-******************************************************************************/
-
-void g_rendering_line_add_to_lines(GRenderingLine **lines, GRenderingLine *line)
-{
- lines_list_add_tail(line, lines);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : lines = liste de lignes à compléter, ou NULL. *
-* line = nouvelle ligne à intégrer à l'ensemble. *
-* first = position de la ligne en cas d'adresse partagée. *
-* *
-* Description : Insère une ligne dans un ensemble existant. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_insert_into_lines(GRenderingLine **lines, GRenderingLine *line, bool first)
-{
- GRenderingLine *iter; /* Boucle de parcours */
-
- lines_list_for_each(iter, *lines)
- {
- if (first && iter->offset >= line->offset) break;
- else if (!first)
- {
- /* TODO */;
- }
-
- }
-
- if (iter == NULL)
- lines_list_add_tail(line, lines);
-
- else
- {
- if (first)
- lines_list_add_before(line, lines, iter);
- else
- /* TODO */;
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : lines = liste de lignes à compléter, ou NULL. *
-* new = nouvelles lignes à intégrer à l'ensemble. *
-* *
-* Description : Insère des lignes dans un ensemble existant. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_insert_lines(GRenderingLine **lines, GRenderingLine **new)
-{
- GRenderingLine *iter; /* Boucle de parcours */
- GRenderingLine *next; /* Ligne suivante à traiter */
-
- lines_list_for_each_safe(iter, new, next)
- {
- lines_list_del(iter, new);
- g_rendering_line_insert_into_lines(lines, iter, true);
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : lines = liste de lignes à traiter. *
-* start = borne inférieure de l'intervalle (incluse). *
-* end = borne supérieure de l'intervalle (incluse). *
-* *
-* Description : Supprime une série de lignes comprises dans un intervalle. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_remove_range(GRenderingLine **lines, vmpa_t start, vmpa_t end)
-{
- GRenderingLine *first; /* Première ligne à traiter */
- GRenderingLine *last; /* Dernière ligne à traiter */
- GRenderingLine *iter; /* Boucle de parcours */
- GRenderingLine *next; /* Ligne suivante à traiter */
-
- first = g_rendering_line_find_by_address(*lines, NULL, start);
- last = g_rendering_line_find_by_address(*lines, NULL, end);
-
- for (iter = first; iter != NULL; iter = next)
- {
- next = g_rendering_line_get_next_iter(*lines, iter, last);
-
- lines_list_del(iter, lines);
- g_object_unref(G_OBJECT(iter));
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : lines1 = première liste à fusionner. *
-* lines2 = seconde liste à intégrer à la première. *
-* *
-* Description : Fusionne deux listes de lignes de rendu. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_rendering_line_merge(GRenderingLine **lines1, GRenderingLine **lines2)
-{
- lines_list_merge(lines1, lines2);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : lines = liste de lignes de représentation à actualiser. *
-* : iter = position actuelle dans la liste. *
-* last = dernière élément imposé du parcours ou NULL. *
-* *
-* Description : Fournit l'élement suivant un autre pour un parcours. *
-* *
-* Retour : Elément suivant ou NULL si aucun. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *g_rendering_line_get_next_iter(GRenderingLine *lines, const GRenderingLine *iter, const GRenderingLine *last)
-{
- GRenderingLine *result; /* Elément suivant à renvoyer */
-
- if (iter == NULL) iter = lines;
-
- if (iter == last) result = NULL;
- else result = lines_list_next_iter(iter, lines);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : lines = liste de lignes de représentation à actualiser. *
-* : iter = position actuelle dans la liste. *
-* last = dernière élément imposé du parcours ou NULL. *
-* *
-* Description : Fournit l'élement précédant un autre pour un parcours. *
-* *
-* Retour : Elément suivant ou NULL si aucun. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *g_rendering_line_get_prev_iter(GRenderingLine *lines, const GRenderingLine *iter, const GRenderingLine *last)
-{
- GRenderingLine *result; /* Elément suivant à renvoyer */
-
- if (iter == NULL)
- {
- if (last != NULL) iter = last;
- else iter = lines_list_last(lines);
- }
-
- if (iter == lines) result = NULL;
- else result = lines_list_prev_iter(iter, lines);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : lines = liste de lignes de représentation à actualiser. *
-* last = dernière élément imposé du parcours ou NULL. *
-* *
-* Description : Fournit le dernier élément d'une liste de lignes. *
-* *
-* Retour : Dernier élément de la liste. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *g_rendering_line_get_last_iter(GRenderingLine *lines, GRenderingLine *last)
-{
- return (last != NULL ? last : lines_list_last(lines));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : lines = liste de lignes à parcourir. *
-* last = dernière élément imposé du parcours ou NULL. *
-* addr = position en mémoire ou physique à chercher. *
-* *
-* Description : Recherche une ligne d'après sa position en mémoire/physique. *
-* *
-* Retour : Ligne représentant l'adresse donnée, NULL si aucune trouvée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *g_rendering_line_find_by_address(GRenderingLine *lines, const GRenderingLine *last, vmpa_t addr)
-{
- GRenderingLine *result; /* Trouvaille à retourner */
-
- lines_list_for_each(result, lines)
- {
- if (result->offset <= addr && addr < (result->offset + result->length)) break;
-
- if (result == last)
- {
- result = NULL;
- break;
- }
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : start = première ligne de l'ensemble à parcourir. *
-* last = dernière élément imposé du parcours ou NULL. *
-* *
-* Description : Donne la première ligne de code correspondant à une adresse. *
-* *
-* Retour : Ligne de code pour l'adresse donnée, NULL si aucune trouvée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *g_rendering_line_loop_for_code(GRenderingLine *start, const GRenderingLine *last)
-{
- GRenderingLine *result; /* Trouvaille à retourner */
- vmpa_t reference; /* Adresse à conserver */
-
- result = start;
- reference = start->offset;
-
- lines_list_for_each(result, start)
- {
- if (G_IS_CODE_LINE(result)) break;
-
- if (result->offset != reference)
- {
- result = NULL;
- break;
- }
-
- if (result == last)
- {
- result = NULL;
- break;
- }
-
- }
-
- return result;
-
-}
diff --git a/src/analysis/line.h b/src/analysis/line.h
deleted file mode 100644
index 39b3f24..0000000
--- a/src/analysis/line.h
+++ /dev/null
@@ -1,151 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line.h - prototypes pour la représentation des lignes de rendu
- *
- * Copyright (C) 2009-2010 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_LINE_H
-#define _ANALYSIS_LINE_H
-
-
-#include <gtk/gtk.h>
-
-
-#include "roptions.h"
-
-
-
-/* ------------------------ TRAITEMENT INDIVIDUEL DES LIGNES ------------------------ */
-
-
-/* Définitions des types de ligne */
-typedef enum _RenderingLineType
-{
- RLT_PROLOGUE, /* Description de l'analyse */
- RLT_PROTOTYPE, /* Prototype de fonction */
- RLT_CODE /* Code en langage machine */
-
-} RenderingLineType;
-
-/* Image à afficher en marge de ligne */
-typedef enum _RenderingLineFlag
-{
- RLF_NONE = (0 << 0), /* Ligne commune */
- RLF_ENTRY_POINT = (1 << 0), /* Point d'entrée du prgm. */
- RLF_BREAK_POINT = (1 << 1), /* Point d'arrêt */
- RLF_RUNNING_BP = (1 << 2) /* Point d'arrêt activé */
-
-} RenderingLineFlag;
-
-
-#define G_TYPE_RENDERING_LINE g_rendering_line_get_type()
-#define G_RENDERING_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_rendering_line_get_type(), GRenderingLine))
-#define G_IS_RENDERING_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_rendering_line_get_type()))
-#define G_RENDERING_LINE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_rendering_line_get_type(), GRenderingLineIface))
-#define G_RENDERING_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_RENDERING_LINE, GRenderingLineClass))
-
-
-/* Ligne de représentation générique (instance) */
-typedef struct _GRenderingLine GRenderingLine;
-
-/* Ligne de représentation générique (classe) */
-typedef struct _GRenderingLineClass GRenderingLineClass;
-
-
-/* Indique le type définit pour une ligne de représentation. */
-GType g_rendering_line_get_type(void);
-
-/* Fournit l'adresse physique ou en mémoire d'une ligne. */
-vmpa_t get_rendering_line_address(const GRenderingLine *);
-
-/* Fournit la longueur du code représenté par une ligne. */
-off_t get_rendering_line_length(const GRenderingLine *);
-
-/* Fournit le commentaire associé à la ligne s'il existe. */
-const char *get_rendering_line_comment(const GRenderingLine *);
-
-/* Définit ou supprime un commentaire pour la ligne indiquée. */
-void set_rendering_line_comment(GRenderingLine *, const char *);
-
-/* Fournit le type d'une ligne. */
-RenderingLineType get_rendering_line_type(const GRenderingLine *);
-
-/* Ajoute une information supplémentaire à une ligne. */
-void g_rendering_line_add_flag(GRenderingLine *, RenderingLineFlag);
-
-/* Retire une information supplémentaire d'une ligne. */
-void g_rendering_line_remove_flag(GRenderingLine *, RenderingLineFlag);
-
-/* Bascule l'état d'une information sur d'une ligne. */
-void g_rendering_line_toggle_flag(GRenderingLine *, RenderingLineFlag);
-
-/* Fournit les informations supplémentaires d'une ligne. */
-RenderingLineFlag g_rendering_line_get_flags(const GRenderingLine *);
-
-/* Etablit un lien entre deux lignes de représentation. */
-void g_rendering_line_link_with(GRenderingLine *, GRenderingLine *, InstructionLinkType);
-
-/* Indique si la ligne a une ou plusieurs origines. */
-bool g_rendering_line_has_sources(const GRenderingLine *);
-
-/* Indique si la ligne a une suite autre que la ligne suivante. */
-bool g_rendering_line_has_destinations(const GRenderingLine *);
-
-/* Fournit la ligne de code de destination du lien de la ligne. */
-size_t g_rendering_line_get_destinations(const GRenderingLine *, GRenderingLine ***, InstructionLinkType **);
-
-
-
-/* ------------------------ TRAITEMENT DES LIGNES PAR GROUPE ------------------------ */
-
-
-/* Ajoute une ligne à un ensemble existant. */
-void g_rendering_line_add_to_lines(GRenderingLine **, GRenderingLine *);
-
-/* Insère une ligne dans un ensemble existant. */
-void g_rendering_line_insert_into_lines(GRenderingLine **, GRenderingLine *, bool);
-
-/* Insère des lignes dans un ensemble existant. */
-void g_rendering_line_insert_lines(GRenderingLine **, GRenderingLine **);
-
-/* Supprime une série de lignes comprises dans un intervalle. */
-void g_rendering_line_remove_range(GRenderingLine **, vmpa_t, vmpa_t);
-
-/* Fusionne deux listes de lignes de rendu. */
-void g_rendering_line_merge(GRenderingLine **, GRenderingLine **);
-
-/* Fournit l'élement suivant un autre pour un parcours. */
-GRenderingLine *g_rendering_line_get_next_iter(GRenderingLine *, const GRenderingLine *, const GRenderingLine *);
-
-/* Fournit l'élement précédant un autre pour un parcours. */
-GRenderingLine *g_rendering_line_get_prev_iter(GRenderingLine *, const GRenderingLine *, const GRenderingLine *);
-
-/* Fournit le dernier élément d'une liste de lignes. */
-GRenderingLine *g_rendering_line_get_last_iter(GRenderingLine *, GRenderingLine *);
-
-/* Recherche une ligne d'après sa position en mémoire/physique. */
-GRenderingLine *g_rendering_line_find_by_address(GRenderingLine *, const GRenderingLine *, vmpa_t);
-
-/* Donne la première ligne de code correspondant à une adresse. */
-GRenderingLine *g_rendering_line_loop_for_code(GRenderingLine *, const GRenderingLine *);
-
-
-
-#endif /* _ANALYSIS_LINE_H */
diff --git a/src/analysis/line_code.c b/src/analysis/line_code.c
deleted file mode 100644
index 6a1ed51..0000000
--- a/src/analysis/line_code.c
+++ /dev/null
@@ -1,334 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line_code.c - représentation des lignes de code binaire.
- *
- * Copyright (C) 2009-2010 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/>.
- */
-
-
-#include "line_code.h"
-
-
-#include <malloc.h>
-#include <string.h>
-
-
-#include "line-int.h"
-#include "../format/format.h"
-
-
-
-/* Ligne de représentation de code binaire (instance) */
-struct _GCodeLine
-{
- GRenderingLine parent; /* Instance parente */
-
- GArchInstruction *instr; /* Instruction représentée */
- const GRenderingOptions *options; /* Options de représentation */
-
-};
-
-
-/* Ligne de représentation de code binaire (classe) */
-struct _GCodeLineClass
-{
- GRenderingLineClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des lignes de code binaire. */
-static void g_code_line_class_init(GCodeLineClass *);
-
-/* Initialise la classe des lignes de code binaire. */
-static void g_code_line_init(GCodeLine *);
-
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_code_line_add_text(GCodeLine *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_code_line_to_buffer(GCodeLine *, GBufferLine *, GRenderingOptions *);
-
-
-
-/* Indique le type définit par la GLib pour la ligne. */
-G_DEFINE_TYPE(GCodeLine, g_code_line, G_TYPE_RENDERING_LINE);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des lignes de code binaire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_code_line_class_init(GCodeLineClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = instance à initialiser. *
-* *
-* Description : Initialise la classe des lignes de code binaire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_code_line_init(GCodeLine *line)
-{
- GContentExporter *exporter_parent; /* Instance parente #1 */
- GRenderingLine *line_parent; /* Instance parente #2 */
-
- exporter_parent = G_CONTENT_EXPORTER(line);
-
- exporter_parent->add_text = (add_text_fc)g_code_line_add_text;
- exporter_parent->export_buffer = (export_buffer_fc)g_code_line_to_buffer;
-
- line_parent = G_RENDERING_LINE(line);
-
- line_parent->type = RLT_CODE;
-
-}
-
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de représentation à représenter. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_code_line_add_text(GCodeLine *line, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- GContentExporter *exporter; /* Autre vision de la ligne #1 */
- GRenderingLine *basic; /* Autre vision de la ligne #2 */
- bool show_address; /* Affichage de l'adresse ? */
- bool show_code; /* Affichage du code brut ? */
- MemoryDataSize msize; /* Taille du bus d'adresses */
- char address[VMPA_MAX_SIZE]; /* Adresse au format texte */
- size_t len; /* Taille de l'élément inséré */
- const bin_t *content; /* Contenu binaire global */
- off_t bin_offset; /* Début de l'instruction */
- off_t bin_len; /* Taille d'instruction */
- char *bin_code; /* Tampon du code binaire */
- off_t i; /* Boucle de parcours */
-
- exporter = G_CONTENT_EXPORTER(line);
- basic = G_RENDERING_LINE(line);
-
- show_address = g_rendering_options_has_to_show_address(options, rendering);
- show_code = g_rendering_options_has_to_show_code(options, rendering);
-
- /* Eventuelle adresse virtuelle ou physique */
-
- if (show_address)
- {
- msize = g_arch_processor_get_memory_size(g_rendering_options_get_processor(options));
-
- len = vmpa_to_string(G_RENDERING_LINE(line)->offset, msize, address);
-
- g_content_exporter_insert_text(exporter, stream, address, len, RTT_NONE);
- g_content_exporter_insert_text(exporter, stream, "\t", 1, RTT_NONE);
-
- }
-
- /* Eventuel code brut */
-
- if (show_code)
- {
- content = g_binary_format_get_content(G_BIN_FORMAT(g_rendering_options_get_format(options)), NULL);
- g_arch_instruction_get_location(line->instr, &bin_offset, &bin_len, NULL);
-
- bin_code = (char *)calloc(bin_len * 3, sizeof(char));
-
- for (i = 0; i < bin_len; i++)
- {
- if ((i + 1) < bin_len)
- snprintf(&bin_code[i * (2 + 1)], 4, "%02hhx ", content[bin_offset + i]);
- else
- snprintf(&bin_code[i * (2 + 1)], 3, "%02hhx", content[bin_offset + i]);
- }
-
- g_content_exporter_insert_text(exporter, stream, bin_code, bin_len * 3 - 1, RTT_RAW_CODE);
-
- free(bin_code);
-
- g_content_exporter_insert_text(exporter, stream, "\t", 1, RTT_NONE);
-
- }
-
- /* Instruction proprement dite */
-
- g_content_exporter_add_text(G_CONTENT_EXPORTER(line->instr), options, rendering, stream);
-
- /* Commentaire ? */
-
- if (basic->comment != NULL)
- {
- g_content_exporter_insert_text(exporter, stream, "\t", 1, RTT_NONE);
- g_content_exporter_insert_text(exporter, stream, "; ", 2, RTT_COMMENT);
- g_content_exporter_insert_text(exporter, stream, basic->comment,
- strlen(basic->comment), RTT_COMMENT);
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de représentation à représenter. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_code_line_to_buffer(GCodeLine *line, GBufferLine *buffer, GRenderingOptions *options)
-{
- GContentExporter *exporter; /* Autre vision de la ligne #1 */
- GRenderingLine *basic; /* Autre vision de la ligne #2 */
- MemoryDataSize msize; /* Taille du bus d'adresses */
- char address[VMPA_MAX_SIZE]; /* Adresse au format texte */
- size_t len; /* Taille de l'élément inséré */
- const bin_t *content; /* Contenu binaire global */
- off_t bin_offset; /* Début de l'instruction */
- off_t bin_len; /* Taille d'instruction */
- char *bin_code; /* Tampon du code binaire */
- off_t i; /* Boucle de parcours */
-
- exporter = G_CONTENT_EXPORTER(line);
- basic = G_RENDERING_LINE(line);
-
- /* Eventuelle adresse virtuelle ou physique */
-
- msize = g_arch_processor_get_memory_size(g_rendering_options_get_processor(line->options));
-
- len = vmpa_to_string(G_RENDERING_LINE(line)->offset, msize, address);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ADDRESS, address, len, RTT_RAW);
-
- /* Eventuel code brut */
-
- content = g_binary_format_get_content(G_BIN_FORMAT(g_rendering_options_get_format(line->options)), NULL);
- g_arch_instruction_get_location(line->instr, &bin_offset, &bin_len, NULL);
-
- bin_code = (char *)calloc(bin_len * 3, sizeof(char));
-
- for (i = 0; i < bin_len; i++)
- {
- if ((i + 1) < bin_len)
- snprintf(&bin_code[i * (2 + 1)], 4, "%02hhx ", content[bin_offset + i]);
- else
- snprintf(&bin_code[i * (2 + 1)], 3, "%02hhx", content[bin_offset + i]);
- }
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_BINARY,
- bin_code, bin_len * 3 - 1, RTT_RAW_CODE);
-
- free(bin_code);
-
- /* Instruction proprement dite */
-
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(line->instr), buffer, options);
-
- /* Commentaire ? */
-
- if (basic->comment != NULL)
- {
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_COMMENTS, "; ", 2, RTT_COMMENT);
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_COMMENTS,
- basic->comment, strlen(basic->comment), RTT_COMMENT);
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : offset = emplacement physique ou en mémoire. *
-* instr = instruction à représenter. *
-* options = paramétrage du rendu. *
-* *
-* Description : Crée une ligne de code binaire. *
-* *
-* Retour : Adresse de la structure mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *g_code_line_new(uint64_t offset, GArchInstruction *instr, const GRenderingOptions *options)
-{
- GCodeLine *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_CODE_LINE, NULL);
-
- G_RENDERING_LINE(result)->offset = offset;
- g_arch_instruction_get_location(instr, NULL, &G_RENDERING_LINE(result)->length, NULL);
-
- result->instr = instr;
- result->options = options;
-
- return G_RENDERING_LINE(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = line de rendu à consulter. *
-* *
-* Description : Fournit l'instruction associée à la ligne de code binaire. *
-* *
-* Retour : Adresse de l'instruction associée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GArchInstruction *g_code_line_get_instruction(const GCodeLine *line)
-{
- return line->instr;
-
-}
diff --git a/src/analysis/line_code.h b/src/analysis/line_code.h
deleted file mode 100644
index 326d183..0000000
--- a/src/analysis/line_code.h
+++ /dev/null
@@ -1,62 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line_code.h - prototypes pour la représentation de code binaire
- *
- * Copyright (C) 2009 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_LINE_CODE_H
-#define _ANALYSIS_LINE_CODE_H
-
-
-#include <glib-object.h>
-
-
-#include "line.h"
-#include "../arch/processor.h"
-
-
-
-#define G_TYPE_CODE_LINE (g_code_line_get_type())
-#define G_CODE_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_CODE_LINE, GCodeLine))
-#define G_IS_CODE_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_CODE_LINE))
-#define G_CODE_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_CODE_LINE, GCodeLineClass))
-#define G_IS_CODE_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_CODE_LINE))
-#define G_CODE_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_CODE_LINE, GCodeLineClass))
-
-
-/* Ligne de représentation de code binaire (instance) */
-typedef struct _GCodeLine GCodeLine;
-
-/* Ligne de représentation de code binaire (classe) */
-typedef struct _GCodeLineClass GCodeLineClass;
-
-
-/* Indique le type définit par la GLib pour la ligne. */
-GType g_code_line_get_type(void);
-
-/* Crée une ligne de code binaire. */
-GRenderingLine *g_code_line_new(uint64_t, GArchInstruction *, const GRenderingOptions *);
-
-/* Fournit l'instruction associée à la ligne de code binaire. */
-GArchInstruction *g_code_line_get_instruction(const GCodeLine *);
-
-
-
-#endif /* _ANALYSIS_LINE_CODE_H */
diff --git a/src/analysis/line_comment.c b/src/analysis/line_comment.c
deleted file mode 100644
index 2156ce4..0000000
--- a/src/analysis/line_comment.c
+++ /dev/null
@@ -1,248 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line_comment.c - représentation des lignes commentaires entières
- *
- * Copyright (C) 2009-2010 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/>.
- */
-
-
-#include "line_comment.h"
-
-
-#include <malloc.h>
-#include <string.h>
-
-
-#include "line-int.h"
-
-
-
-/* Ligne de représentation de commentaires entière (instance) */
-struct _GCommentLine
-{
- GRenderingLine parent; /* Instance parente */
-
- char *comment; /* Texte à afficher */
- const GRenderingOptions *options; /* Options de représentation */
-
-};
-
-
-/* Ligne de représentation de commentaires entière (classe) */
-struct _GCommentLineClass
-{
- GRenderingLineClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des lignes de commentaires entière. */
-static void g_comment_line_class_init(GCommentLineClass *);
-
-/* Initialise la classe des lignes de commentaires entière. */
-static void g_comment_line_init(GCommentLine *);
-
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_comment_line_add_text(GCommentLine *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_comment_line_to_buffer(GCommentLine *, GBufferLine *, GRenderingOptions *);
-
-
-/* Indique le type définit par la GLib pour la ligne. */
-G_DEFINE_TYPE(GCommentLine, g_comment_line, G_TYPE_RENDERING_LINE);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des lignes de commentaires entière. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_comment_line_class_init(GCommentLineClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = instance à initialiser. *
-* *
-* Description : Initialise la classe des lignes de commentaires entière. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_comment_line_init(GCommentLine *line)
-{
- GContentExporter *exporter_parent; /* Instance parente #1 */
- GRenderingLine *line_parent; /* Instance parente #2 */
-
- exporter_parent = G_CONTENT_EXPORTER(line);
-
- exporter_parent->add_text = (add_text_fc)g_comment_line_add_text;
- exporter_parent->export_buffer = (export_buffer_fc)g_comment_line_to_buffer;
-
- line_parent = G_RENDERING_LINE(line);
-
- line_parent->type = RLT_PROTOTYPE/* TODO */;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de représentation à actualiser. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_comment_line_add_text(GCommentLine *line, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- GContentExporter *exporter; /* Autre vision de la ligne */
- bool show_address; /* Affichage de l'adresse ? */
- bool show_code; /* Affichage du code brut ? */
- MemoryDataSize msize; /* Taille du bus d'adresses */
- char address[VMPA_MAX_SIZE]; /* Adresse au format texte */
- size_t len; /* Taille de l'élément inséré */
-
- exporter = G_CONTENT_EXPORTER(line);
-
- show_address = g_rendering_options_has_to_show_address(options, rendering);
- show_code = g_rendering_options_has_to_show_code(options, rendering);
-
- /* Eventuelle adresse virtuelle ou physique */
-
- if (show_address)
- {
- msize = g_arch_processor_get_memory_size(g_rendering_options_get_processor(options));
-
- len = vmpa_to_string(G_RENDERING_LINE(line)->offset, msize, address);
-
- g_content_exporter_insert_text(exporter, stream, address, len, RTT_NONE);
- g_content_exporter_insert_text(exporter, stream, "\t", 1, RTT_NONE);
-
- }
-
- /* Eventuel code brut (sauté) */
-
- if (show_code)
- g_content_exporter_insert_text(exporter, stream, "\t", 1, RTT_NONE);
-
- /* Commentaire proprement dit */
-
- g_content_exporter_insert_text(exporter, stream, "; ", 2, RTT_COMMENT);
-
- len = strlen(line->comment);
-
- g_content_exporter_insert_text(exporter, stream, line->comment, len, RTT_COMMENT);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de représentation à représenter. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_comment_line_to_buffer(GCommentLine *line, GBufferLine *buffer, GRenderingOptions *options)
-{
- GContentExporter *exporter; /* Autre vision de la ligne */
- MemoryDataSize msize; /* Taille du bus d'adresses */
- char address[VMPA_MAX_SIZE]; /* Adresse au format texte */
- size_t len; /* Taille de l'élément inséré */
-
- exporter = G_CONTENT_EXPORTER(line);
-
- g_buffer_line_start_merge_at(buffer, BLC_ASSEMBLY_HEAD);
-
- /* Eventuelle adresse virtuelle ou physique */
-
- msize = g_arch_processor_get_memory_size(g_rendering_options_get_processor(line->options));
-
- len = vmpa_to_string(G_RENDERING_LINE(line)->offset, msize, address);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ADDRESS, address, len, RTT_RAW);
-
- /* Commentaire ? */
-
- len = strlen(line->comment);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_COMMENTS, "; ", 2, RTT_COMMENT);
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_COMMENTS,
- line->comment, len, RTT_COMMENT);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : offset = emplacement physique ou en mémoire. *
-* comment = texte à afficher au final. *
-* options = paramétrage du rendu. *
-* *
-* Description : Crée une ligne de commentaires entière. *
-* *
-* Retour : Adresse de la structure mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *g_comment_line_new(uint64_t offset, const char *comment, const GRenderingOptions *options)
-{
- GCommentLine *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_COMMENT_LINE, NULL);
-
- G_RENDERING_LINE(result)->offset = offset;
-
- result->comment = strdup(comment);
- result->options = options;
-
- return G_RENDERING_LINE(result);
-
-}
diff --git a/src/analysis/line_comment.h b/src/analysis/line_comment.h
deleted file mode 100644
index 20aa16f..0000000
--- a/src/analysis/line_comment.h
+++ /dev/null
@@ -1,58 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line_comment.h - prototypes pour la représentation des lignes commentaires entières
- *
- * Copyright (C) 2009 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_LINE_COMMENT_H
-#define _ANALYSIS_LINE_COMMENT_H
-
-
-#include <glib-object.h>
-
-
-#include "line.h"
-
-
-
-#define G_TYPE_COMMENT_LINE (g_comment_line_get_type())
-#define G_COMMENT_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_COMMENT_LINE, GCommentLine))
-#define G_IS_COMMENT_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_COMMENT_LINE))
-#define G_COMMENT_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_COMMENT_LINE, GCommentLineClass))
-#define G_IS_COMMENT_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_COMMENT_LINE))
-#define G_COMMENT_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_COMMENT_LINE, GCommentLineClass))
-
-
-/* Ligne de représentation de commentaires entière (instance) */
-typedef struct _GCommentLine GCommentLine;
-
-/* Ligne de représentation de commentaires entière (classe) */
-typedef struct _GCommentLineClass GCommentLineClass;
-
-
-/* Indique le type définit par la GLib pour la ligne. */
-GType g_comment_line_get_type(void);
-
-/* Crée une ligne de commentaires entière. */
-GRenderingLine *g_comment_line_new(uint64_t, const char *, const GRenderingOptions *);
-
-
-
-#endif /* _ANALYSIS_LINE_COMMENT_H */
diff --git a/src/analysis/line_prologue.c b/src/analysis/line_prologue.c
deleted file mode 100644
index 508ddfc..0000000
--- a/src/analysis/line_prologue.c
+++ /dev/null
@@ -1,202 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line_prologue.c - représentation des lignes d'en-tête de désassemblage
- *
- * Copyright (C) 2009-2010 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/>.
- */
-
-
-#include "line_prologue.h"
-
-
-#include <malloc.h>
-#include <string.h>
-
-
-#include "line-int.h"
-
-
-
-/* Ligne de représentation de descriptions initiales (instance) */
-struct _GPrologueLine
-{
- GRenderingLine parent; /* Instance parente */
-
- char *comment; /* Texte à afficher */
-
-};
-
-
-/* Ligne de représentation de descriptions initiales (classe) */
-struct _GPrologueLineClass
-{
- GRenderingLineClass parent; /* Classe parente */
-
-};
-
-
-/* Initialise la classe des lignes de descriptions initiales. */
-static void g_prologue_line_class_init(GPrologueLineClass *);
-
-/* Initialise la classe des lignes de descriptions initiales. */
-static void g_prologue_line_init(GPrologueLine *);
-
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_prologue_line_add_text(GPrologueLine *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_prologue_line_to_buffer(GPrologueLine *, GBufferLine *, GRenderingOptions *);
-
-
-/* Indique le type définit par la GLib pour la ligne. */
-G_DEFINE_TYPE(GPrologueLine, g_prologue_line, G_TYPE_RENDERING_LINE);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des lignes de descriptions initiales. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_prologue_line_class_init(GPrologueLineClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = instance à initialiser. *
-* *
-* Description : Initialise la classe des lignes de descriptions initiales. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_prologue_line_init(GPrologueLine *line)
-{
- GContentExporter *exporter_parent; /* Instance parente #1 */
- GRenderingLine *line_parent; /* Instance parente #2 */
-
- exporter_parent = G_CONTENT_EXPORTER(line);
-
- exporter_parent->add_text = (add_text_fc)g_prologue_line_add_text;
- exporter_parent->export_buffer = (export_buffer_fc)g_prologue_line_to_buffer;
-
- line_parent = G_RENDERING_LINE(line);
-
- line_parent->type = RLT_PROLOGUE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de représentation à actualiser. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_prologue_line_add_text(GPrologueLine *line, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- GContentExporter *exporter; /* Autre vision de la ligne */
- size_t len; /* Taille de l'élément inséré */
-
- exporter = G_CONTENT_EXPORTER(line);
-
- len = strlen(line->comment);
-
- g_content_exporter_insert_text(exporter, stream, "; ", 2, RTT_COMMENT);
- g_content_exporter_insert_text(exporter, stream, line->comment, len, RTT_COMMENT);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : line = ligne de représentation à représenter. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_prologue_line_to_buffer(GPrologueLine *line, GBufferLine *buffer, GRenderingOptions *options)
-{
- GContentExporter *exporter; /* Autre vision de la ligne */
- size_t len; /* Taille de l'élément inséré */
-
- exporter = G_CONTENT_EXPORTER(line);
-
- g_buffer_line_start_merge_at(buffer, BLC_ADDRESS);
-
- len = strlen(line->comment);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_COMMENTS, "; ", 2, RTT_COMMENT);
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_COMMENTS,
- line->comment, len, RTT_COMMENT);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : comment = texte à afficher au final. *
-* *
-* Description : Crée une des lignes de descriptions initiales. *
-* *
-* Retour : Adresse de la structure mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *g_prologue_line_new(const char *comment)
-{
- GPrologueLine *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_PROLOGUE_LINE, NULL);
-
- result->comment = strdup(comment);
-
- return G_RENDERING_LINE(result);
-
-}
diff --git a/src/analysis/line_prologue.h b/src/analysis/line_prologue.h
deleted file mode 100644
index c5ebb15..0000000
--- a/src/analysis/line_prologue.h
+++ /dev/null
@@ -1,60 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * line_prologue.h - prototypes pour la représentation des lignes d'en-tête de désassemblage
- *
- * Copyright (C) 2009 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_LINE_PROLOGUE_H
-#define _ANALYSIS_LINE_PROLOGUE_H
-
-
-#include <glib-object.h>
-
-
-#include "line.h"
-
-
-
-#define G_TYPE_PROLOGUE_LINE (g_prologue_line_get_type())
-#define G_PROLOGUE_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_PROLOGUE_LINE, GPrologueLine))
-#define G_IS_PROLOGUE_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_PROLOGUE_LINE))
-#define G_PROLOGUE_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PROLOGUE_LINE, GPrologueLineClass))
-#define G_IS_PROLOGUE_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_PROLOGUE_LINE))
-#define G_PROLOGUE_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PROLOGUE_LINE, GPrologueLineClass))
-
-
-
-/* Ligne de représentation de descriptions initiales (instance) */
-typedef struct _GPrologueLine GPrologueLine;
-
-/* Ligne de représentation de descriptions initiales (classe) */
-typedef struct _GPrologueLineClass GPrologueLineClass;
-
-
-
-/* Indique le type définit par la GLib pour la ligne. */
-GType g_prologue_line_get_type(void);
-
-/* Crée une des lignes de descriptions initiales. */
-GRenderingLine *g_prologue_line_new(const char *);
-
-
-
-#endif /* _ANALYSIS_LINE_PROLOGUE_H */
diff --git a/src/arch/dalvik/register.c b/src/arch/dalvik/register.c
index 6e709f9..b2023b5 100644
--- a/src/arch/dalvik/register.c
+++ b/src/arch/dalvik/register.c
@@ -61,7 +61,7 @@ static void g_dalvik_register_init(GDalvikRegister *);
/* Indique le type défini pour une représentation d'un registre Dalvik. */
-G_DEFINE_TYPE(GDalvikRegister, g_dalvik_register, G_TYPE_CONTENT_EXPORTER);
+G_DEFINE_TYPE(GDalvikRegister, g_dalvik_register, G_TYPE_ARCH_OPERAND);
/******************************************************************************
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
index 72faf4c..e8f0212 100644
--- a/src/arch/immediate.c
+++ b/src/arch/immediate.c
@@ -90,12 +90,6 @@ static void g_imm_operand_init(GImmOperand *);
/* Construit la chaîne de caractères correspondant à l'opérande. */
static size_t g_imm_operand_to_string(const GImmOperand *, AsmSyntax, char [VMPA_MAX_SIZE]);
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_imm_operand_add_text(const GImmOperand *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_imm_operand_to_buffer(const GImmOperand *, GBufferLine *, GRenderingOptions *);
-
/* Traduit un opérande en version humainement lisible. */
static void g_imm_operand_print(const GImmOperand *, GBufferLine *, AsmSyntax);
@@ -138,13 +132,7 @@ static void g_imm_operand_class_init(GImmOperandClass *klass)
static void g_imm_operand_init(GImmOperand *operand)
{
- GContentExporter *parent; /* Instance parente #1 */
- GArchOperand *arch; /* Instance parente #2 */
-
- parent = G_CONTENT_EXPORTER(operand);
-
- parent->add_text = (add_text_fc)g_imm_operand_add_text;
- parent->export_buffer = (export_buffer_fc)g_imm_operand_to_buffer;
+ GArchOperand *arch; /* Instance parente */
arch = G_ARCH_OPERAND(operand);
@@ -722,62 +710,6 @@ static size_t g_imm_operand_to_string(const GImmOperand *operand, AsmSyntax synt
/******************************************************************************
* *
-* Paramètres : operand = opérande à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_imm_operand_add_text(const GImmOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- char value[VMPA_MAX_SIZE]; /* Chaîne à imprimer */
- size_t len; /* Taille de l'élément inséré */
-
- len = g_imm_operand_to_string(operand, g_rendering_options_get_syntax(options), value);
-
- g_content_exporter_insert_text(G_CONTENT_EXPORTER(operand), stream, value, len, RTT_IMMEDIATE);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = opérande à transcrire. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_imm_operand_to_buffer(const GImmOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
-{
- AsmSyntax syntax; /* Choix de l'exportation */
- char value[VMPA_MAX_SIZE]; /* Chaîne à imprimer */
- size_t len; /* Taille de l'élément inséré */
-
- syntax = (options == NULL ? ASX_COUNT : g_rendering_options_get_syntax(options));
- len = g_imm_operand_to_string(operand, syntax, value);
-
- g_content_exporter_insert_into_buffer(G_CONTENT_EXPORTER(operand), buffer, BLC_ASSEMBLY,
- value, len, RTT_IMMEDIATE);
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : operand = opérande à traiter. *
* line = ligne tampon où imprimer l'opérande donné. *
* syntax = type de représentation demandée. *
diff --git a/src/arch/instruction-int.h b/src/arch/instruction-int.h
index 83a2eef..e323d6c 100644
--- a/src/arch/instruction-int.h
+++ b/src/arch/instruction-int.h
@@ -28,7 +28,6 @@
#include "archbase.h"
#include "instruction.h"
#include "translate.h"
-#include "../analysis/exporter-int.h"
#include "../common/dllist.h"
@@ -49,7 +48,7 @@ typedef bool (* is_instruction_return_fc) (const GArchInstruction *);
/* Définition générique d'une instruction d'architecture (instance) */
struct _GArchInstruction
{
- GContentExporter parent; /* A laisser en premier */
+ GObject parent; /* A laisser en premier */
DL_LIST_ITEM(flow); /* Maillon de liste chaînée */
@@ -79,7 +78,7 @@ struct _GArchInstruction
/* Définition générique d'une instruction d'architecture (classe) */
struct _GArchInstructionClass
{
- GContentExporterClass parent; /* A laisser en premier */
+ GObjectClass parent; /* A laisser en premier */
};
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 240ffbe..b553aec 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -38,12 +38,6 @@ static void g_arch_instruction_class_init(GArchInstructionClass *);
/* Initialise une instance d'opérande d'architecture. */
static void g_arch_instruction_init(GArchInstruction *);
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_arch_instruction_add_text(const GArchInstruction *, GRenderingOptions *, MainRendering, FILE *) __attribute__ ((deprecated));
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_arch_instruction_to_buffer(const GArchInstruction *, GBufferLine *, GRenderingOptions *) __attribute__ ((deprecated));
-
/* --------------------- CONVERSIONS DU FORMAT DES INSTRUCTIONS --------------------- */
@@ -55,7 +49,7 @@ static void _g_arch_instruction_print(const GArchInstruction *, GCodeBuffer *, M
/* Indique le type défini pour une instruction d'architecture. */
-G_DEFINE_TYPE(GArchInstruction, g_arch_instruction, G_TYPE_CONTENT_EXPORTER);
+G_DEFINE_TYPE(GArchInstruction, g_arch_instruction, G_TYPE_OBJECT);
/******************************************************************************
@@ -90,13 +84,6 @@ static void g_arch_instruction_class_init(GArchInstructionClass *klass)
static void g_arch_instruction_init(GArchInstruction *instr)
{
- GContentExporter *parent; /* Instance parente */
-
- parent = G_CONTENT_EXPORTER(instr);
-
- parent->add_text = (add_text_fc)g_arch_instruction_add_text;
- parent->export_buffer = (export_buffer_fc)g_arch_instruction_to_buffer;
-
DL_LIST_ITEM_INIT(&instr->flow);
}
@@ -104,114 +91,6 @@ static void g_arch_instruction_init(GArchInstruction *instr)
/******************************************************************************
* *
-* Paramètres : instr = instruction à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_arch_instruction_add_text(const GArchInstruction *instr, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- GContentExporter *exporter; /* Autre vision de l'objet */
- const char *key; /* Mot clef principal */
- size_t klen; /* Taille de ce mot clef */
- size_t i; /* Boucle de parcours */
-
- exporter = G_CONTENT_EXPORTER(instr);
-
- key = instr->get_text(instr,
- g_rendering_options_get_format(options),
- g_rendering_options_get_syntax(options));
- klen = strlen(key);
-
- g_content_exporter_insert_text(exporter, stream, key, klen, RTT_INSTRUCTION);
-
- if (instr->operands_count > 0)
- {
- g_content_exporter_insert_text(exporter, stream, "\t", 1, RTT_NONE);
-
- g_content_exporter_add_text(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[0]),
- options, rendering, stream);
-
- for (i = 1; i < instr->operands_count; i++)
- {
- g_content_exporter_insert_text(exporter, stream, ",", 1, RTT_NONE/* FIXME */);
-
- g_content_exporter_insert_text(exporter, stream, " ", 1, RTT_NONE);
-
- g_content_exporter_add_text(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[i]),
- options, rendering, stream);
-
- }
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : instr = instruction d'assemblage à représenter. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_arch_instruction_to_buffer(const GArchInstruction *instr, GBufferLine *buffer, GRenderingOptions *options)
-{
- GContentExporter *exporter; /* Autre vision de l'objet */
- const char *key; /* Mot clef principal */
- size_t klen; /* Taille de ce mot clef */
- size_t i; /* Boucle de parcours */
-
- exporter = G_CONTENT_EXPORTER(instr);
-
- key = instr->get_text(instr,
- g_rendering_options_get_format(options),
- g_rendering_options_get_syntax(options));
- klen = strlen(key);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY_HEAD,
- key, klen, RTT_INSTRUCTION);
-
- if (instr->operands_count > 0)
- {
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[0]),
- buffer, options);
-
- for (i = 1; i < instr->operands_count; i++)
- {
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- ",", 1, RTT_NONE/* FIXME */);
-
- g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
- " ", 1, RTT_NONE);
-
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[i]),
- buffer, options);
-
- }
-
- }
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : instr = instruction quelconque à modifier. *
* offset = position physique dans le code binaire. *
* length = taille de l'instruction. *
@@ -385,53 +264,6 @@ void g_arch_instruction_detach_operand(GArchInstruction *instr, GArchOperand *op
}
-/******************************************************************************
-* *
-* Paramètres : instr = instruction à traiter. *
-* format = format du binaire manipulé. *
-* syntax = type de représentation demandée. *
-* *
-* Description : Traduit une instruction en version humainement lisible. *
-* *
-* Retour : Chaîne de caractères à libérer de la mémoire. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-char *g_arch_instruction_get_text(const GArchInstruction *instr, const GExeFormat *format, AsmSyntax syntax)
-{
- char *result; /* Chaîne à retourner */
- size_t i; /* Boucle de parcours */
- char *opstr; /* Chaîne d'opérande */
- return strdup("");
- if (instr->operands_count == 0)
- result = strdup(instr->get_text(instr, format, syntax));
-
- else
- {
- result = g_arch_operand_get_text(G_ARCH_INSTRUCTION(instr)->operands[0], format, syntax);
-
- for (i = 1; i < instr->operands_count; i++)
- {
- result = stradd(result, ", ");
-
- opstr = g_arch_operand_get_text(G_ARCH_INSTRUCTION(instr)->operands[i], format, syntax);
- result = stradd(result, opstr);
- free(opstr);
-
- }
-
- result = strprep(result, "\t");
- result = strprep(result, instr->get_text(instr, format, syntax));
-
- }
-
- return result;
-
-}
-
-
/* ---------------------------------------------------------------------------------- */
/* DEFINITION DES LIAISONS ENTRE INSTRUCTIONS */
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index bf78bfd..efd2b75 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -87,9 +87,6 @@ void g_arch_instruction_replace_operand(GArchInstruction *, GArchOperand *, cons
/* Détache un opérande liée d'une instruction. */
void g_arch_instruction_detach_operand(GArchInstruction *, GArchOperand *);
-/* Traduit une instruction en version humainement lisible. */
-char *g_arch_instruction_get_text(const GArchInstruction *, const GExeFormat *, AsmSyntax) __attribute__ ((deprecated));
-
/* ------------------- DEFINITION DES LIAISONS ENTRE INSTRUCTIONS ------------------- */
diff --git a/src/arch/jvm/operand.c b/src/arch/jvm/operand.c
index b0f2fa0..11458a9 100644
--- a/src/arch/jvm/operand.c
+++ b/src/arch/jvm/operand.c
@@ -87,9 +87,6 @@ static void g_jvm_ref_operand_class_init(GJvmRefOperandClass *);
/* Initialise une instance d'opérande de référence pour la JVM. */
static void g_jvm_ref_operand_init(GJvmRefOperand *);
-/* Traduit un opérande en version humainement lisible. */
-static char *g_jvm_ref_operand_get_text(const GJvmRefOperand *, const exe_format *, AsmSyntax);
-
@@ -188,11 +185,6 @@ static void g_jvm_ref_operand_class_init(GJvmRefOperandClass *klass)
static void g_jvm_ref_operand_init(GJvmRefOperand *operand)
{
- GArchOperand *parent; /* Instance parente */
-
- parent = G_ARCH_OPERAND(operand);
-
- parent->get_text = (get_operand_text_fc)g_jvm_ref_operand_get_text;
}
@@ -236,6 +228,7 @@ GArchOperand *g_jvm_ref_operand_new(const bin_t *data, off_t *pos, off_t len, Jv
}
+#if 0
/******************************************************************************
* *
* Paramètres : operand = opérande à traiter. *
@@ -273,7 +266,7 @@ static char *g_jvm_ref_operand_get_text(const GJvmRefOperand *operand, const exe
return result;
}
-
+#endif
diff --git a/src/arch/mips/operand.c b/src/arch/mips/operand.c
index c470e74..a976543 100644
--- a/src/arch/mips/operand.c
+++ b/src/arch/mips/operand.c
@@ -88,9 +88,6 @@ static void g_mips_register_operand_class_init(GMipsRegisterOperandClass *);
/* Initialise une instance d'opérande de registre MIPS. */
static void g_mips_register_operand_init(GMipsRegisterOperand *);
-/* Traduit un opérande en version humainement lisible. */
-static char *g_mips_register_operand_get_text(const GMipsRegisterOperand *, const GExeFormat *, AsmSyntax);
-
/* -------------------------- OPERANDES DE CONTENU MEMOIRE -------------------------- */
@@ -121,9 +118,6 @@ static void g_mips_mem_content_operand_class_init(GMipsMemContentOperandClass *)
/* Initialise une instance d'opérande MIPS de contenu mémoire. */
static void g_mips_mem_content_operand_init(GMipsMemContentOperand *);
-/* Traduit un opérande en version humainement lisible. */
-static char *g_mips_mem_content_operand_get_text(const GMipsMemContentOperand *, const GExeFormat *, AsmSyntax);
-
/* ----------------------------- OPERANDES DE DECALLAGE ----------------------------- */
@@ -153,9 +147,6 @@ static void g_mips_offset_operand_class_init(GMipsOffsetOperandClass *);
/* Initialise une instance d'opérande MIPS de décallage. */
static void g_mips_offset_operand_init(GMipsOffsetOperand *);
-/* Traduit un opérande en version humainement lisible. */
-static char *g_mips_offset_operand_get_text(const GMipsOffsetOperand *, const GExeFormat *, AsmSyntax);
-
/* ---------------------------------------------------------------------------------- */
@@ -245,11 +236,6 @@ static void g_mips_register_operand_class_init(GMipsRegisterOperandClass *klass)
static void g_mips_register_operand_init(GMipsRegisterOperand *operand)
{
- GArchOperand *parent; /* Instance parente */
-
- parent = G_ARCH_OPERAND(operand);
-
- parent->get_text = (get_operand_text_fc)g_mips_register_operand_get_text;
}
@@ -287,6 +273,7 @@ GArchOperand *g_mips_register_operand_new(bin_t index)
}
+#if 0
/******************************************************************************
* *
* Paramètres : operand = opérande à traiter. *
@@ -310,6 +297,7 @@ static char *g_mips_register_operand_get_text(const GMipsRegisterOperand *operan
return result;
}
+#endif
/******************************************************************************
@@ -373,11 +361,6 @@ static void g_mips_mem_content_operand_class_init(GMipsMemContentOperandClass *k
static void g_mips_mem_content_operand_init(GMipsMemContentOperand *operand)
{
- GArchOperand *parent; /* Instance parente */
-
- parent = G_ARCH_OPERAND(operand);
-
- parent->get_text = (get_operand_text_fc)g_mips_mem_content_operand_get_text;
}
@@ -417,6 +400,7 @@ GArchOperand *g_mips_mem_content_operand_new(bin_t index, int16_t offset)
}
+#if 0
/******************************************************************************
* *
* Paramètres : operand = opérande à traiter. *
@@ -443,15 +427,18 @@ static char *g_mips_mem_content_operand_get_text(const GMipsMemContentOperand *o
if (g_imm_operand_is_negative(operand->offset)) result = stradd(result, "-");
else result = stradd(result, "+");
+ /* FIXME !
tmp = g_arch_operand_get_text(G_ARCH_OPERAND(operand->offset), format, syntax);
result = stradd(result, tmp);
free(tmp);
+ */
result = stradd(result, "]");
return result;
}
+#endif
@@ -496,11 +483,6 @@ static void g_mips_offset_operand_class_init(GMipsOffsetOperandClass *klass)
static void g_mips_offset_operand_init(GMipsOffsetOperand *operand)
{
- GArchOperand *parent; /* Instance parente */
-
- parent = G_ARCH_OPERAND(operand);
-
- parent->get_text = (get_operand_text_fc)g_mips_offset_operand_get_text;
}
@@ -530,6 +512,7 @@ GArchOperand *g_mips_offset_operand_new(int16_t offset)
}
+#if 0
/******************************************************************************
* *
* Paramètres : operand = opérande à traiter. *
@@ -546,9 +529,10 @@ GArchOperand *g_mips_offset_operand_new(int16_t offset)
static char *g_mips_offset_operand_get_text(const GMipsOffsetOperand *operand, const GExeFormat *format, AsmSyntax syntax)
{
- return g_arch_operand_get_text(G_ARCH_OPERAND(operand->offset), format, syntax);
+ return strdup("");/* FIXME g_arch_operand_get_text(G_ARCH_OPERAND(operand->offset), format, syntax); */
}
+#endif
diff --git a/src/arch/operand-int.h b/src/arch/operand-int.h
index 9bb9da1..d9ebde0 100644
--- a/src/arch/operand-int.h
+++ b/src/arch/operand-int.h
@@ -26,7 +26,6 @@
#include "operand.h"
-#include "../analysis/exporter-int.h"
@@ -34,19 +33,15 @@
typedef bool (* operand_compare_fc) (const GArchOperand *, const GArchOperand *);
/* Traduit un opérande en version humainement lisible. */
-typedef char * (* get_operand_text_fc) (const GArchOperand *, const GExeFormat *, AsmSyntax);
-
-/* Traduit un opérande en version humainement lisible. */
typedef void (* operand_print_fc) (const GArchOperand *, GBufferLine *, AsmSyntax);
/* Définition générique d'un opérande d'architecture (instance) */
struct _GArchOperand
{
- GContentExporter parent; /* A laisser en premier */
+ GObject parent; /* A laisser en premier */
operand_compare_fc compare; /* Comparaison d'opérandes */
- get_operand_text_fc get_text; /* Texte humain équivalent */
operand_print_fc print; /* Texte humain équivalent */
};
@@ -55,7 +50,7 @@ struct _GArchOperand
/* Définition générique d'un opérande d'architecture (classe) */
struct _GArchOperandClass
{
- GContentExporterClass parent; /* A laisser en premier */
+ GObjectClass parent; /* A laisser en premier */
};
diff --git a/src/arch/operand.c b/src/arch/operand.c
index 43d0027..e98683e 100644
--- a/src/arch/operand.c
+++ b/src/arch/operand.c
@@ -37,7 +37,7 @@ static void g_arch_operand_init(GArchOperand *);
/* Indique le type défini pour un opérande d'architecture. */
-G_DEFINE_TYPE(GArchOperand, g_arch_operand, G_TYPE_CONTENT_EXPORTER);
+G_DEFINE_TYPE(GArchOperand, g_arch_operand, G_TYPE_OBJECT);
@@ -79,21 +79,27 @@ static void g_arch_operand_init(GArchOperand *operand)
/******************************************************************************
* *
-* Paramètres : operand = opérande à traiter. *
-* format = format du binaire manipulé. *
-* syntax = type de représentation demandée. *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
* *
-* Description : Traduit un opérande en version humainement lisible. *
+* Description : Compare un opérande avec un autre. *
* *
-* Retour : Chaîne de caractères à libérer de la mémoire. *
+* Retour : Bilan de la comparaison. *
* *
* Remarques : - *
* *
******************************************************************************/
-char *g_arch_operand_get_text(const GArchOperand *operand, const GExeFormat *format, AsmSyntax syntax)
+bool g_arch_operand_compare(const GArchOperand *a, const GArchOperand *b)
{
- return operand->get_text(operand, format, syntax);
+ bool result; /* Bilan à faire remonter */
+
+ result = (G_OBJECT_TYPE(G_OBJECT(a)) == G_OBJECT_TYPE(G_OBJECT(b)));
+
+ if (result)
+ result = a->compare(a, b);
+
+ return result;
}
@@ -117,30 +123,3 @@ void g_arch_operand_print(const GArchOperand *operand, GBufferLine *line, AsmSyn
return operand->print(operand, line, syntax);
}
-
-
-/******************************************************************************
-* *
-* Paramètres : a = premier opérande à consulter. *
-* b = second opérande à consulter. *
-* *
-* Description : Compare un opérande avec un autre. *
-* *
-* Retour : Bilan de la comparaison. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool g_arch_operand_compare(const GArchOperand *a, const GArchOperand *b)
-{
- bool result; /* Bilan à faire remonter */
-
- result = (G_OBJECT_TYPE(G_OBJECT(a)) == G_OBJECT_TYPE(G_OBJECT(b)));
-
- if (result)
- result = a->compare(a, b);
-
- return result;
-
-}
diff --git a/src/arch/operand.h b/src/arch/operand.h
index 6eac263..c0cd767 100644
--- a/src/arch/operand.h
+++ b/src/arch/operand.h
@@ -28,7 +28,6 @@
#include <glib-object.h>
-#include "../format/executable.h" /* FIXME : remme ! */
#include "../glibext/gbufferline.h"
@@ -49,15 +48,12 @@ typedef struct _GArchOperandClass GArchOperandClass;
/* Indique le type défini pour un opérande d'architecture. */
GType g_arch_operand_get_type(void);
-/* Traduit un opérande en version humainement lisible. */
-char *g_arch_operand_get_text(const GArchOperand *, const GExeFormat *, AsmSyntax);
+/* Compare un opérande avec un autre. */
+bool g_arch_operand_compare(const GArchOperand *, const GArchOperand *);
/* Traduit un opérande en version humainement lisible. */
void g_arch_operand_print(const GArchOperand *, GBufferLine *, AsmSyntax);
-/* Compare un opérande avec un autre. */
-bool g_arch_operand_compare(const GArchOperand *, const GArchOperand *);
-
#endif /* _ARCH_OPERAND_H */
diff --git a/src/arch/x86/Makefile.am b/src/arch/x86/Makefile.am
index b7b72d6..e657699 100644
--- a/src/arch/x86/Makefile.am
+++ b/src/arch/x86/Makefile.am
@@ -5,7 +5,7 @@ libarchx86_la_SOURCES = \
instruction.h instruction.c \
operand.h operand.c \
processor.h processor.c \
- registers.h registers.c
+ register.h register.c
libarchx86_la_LIBADD = \
opcodes/libarchx86opcodes.la \
diff --git a/src/arch/x86/operands/data.c b/src/arch/x86/operands/data.c
index 22f16b7..32b9bcd 100644
--- a/src/arch/x86/operands/data.c
+++ b/src/arch/x86/operands/data.c
@@ -24,7 +24,7 @@
#include "data.h"
-#include "../registers.h"
+#include "../register.h"
#include "../../operand-int.h"
@@ -53,12 +53,6 @@ static void g_x86_data_operand_class_init(GX86DataOperandClass *);
/* Initialise une instance d'opérande x86 pointant des données. */
static void g_x86_data_operand_init(GX86DataOperand *);
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_x86_data_operand_add_text(const GX86DataOperand *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_x86_data_operand_to_buffer(const GX86DataOperand *, GBufferLine *, GRenderingOptions *);
-
/* Indique le type défini par la GLib pour un opérande x86 de manipulation de données. */
@@ -97,12 +91,6 @@ static void g_x86_data_operand_class_init(GX86DataOperandClass *klass)
static void g_x86_data_operand_init(GX86DataOperand *operand)
{
- GContentExporter *parent; /* Instance parente */
-
- parent = G_CONTENT_EXPORTER(operand);
-
- parent->add_text = (add_text_fc)g_x86_data_operand_add_text;
- parent->export_buffer = (export_buffer_fc)g_x86_data_operand_to_buffer;
}
@@ -134,6 +122,7 @@ GArchOperand *g_x86_data_operand_new(MemoryDataSize size, bool dest)
}
+#if 0
/******************************************************************************
* *
* Paramètres : operand = opérande à transcrire. *
@@ -205,3 +194,4 @@ static void g_x86_data_operand_to_buffer(const GX86DataOperand *operand, GBuffer
"]", 1, RTT_HOOK);
}
+#endif
diff --git a/src/arch/x86/operands/modrm.c b/src/arch/x86/operands/modrm.c
index 892d5dc..e23f499 100644
--- a/src/arch/x86/operands/modrm.c
+++ b/src/arch/x86/operands/modrm.c
@@ -59,12 +59,6 @@ static void g_x86_mod_rm_operand_class_init(GX86ModRMOperandClass *);
/* Initialise une instance d'opérande x86 de type ModRM. */
static void g_x86_mod_rm_operand_init(GX86ModRMOperand *);
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_x86_mod_rm_operand_add_text(const GX86ModRMOperand *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_x86_mod_rm_operand_to_buffer(const GX86ModRMOperand *, GBufferLine *, GRenderingOptions *);
-
/* Indique le type défini par la GLib pour un opérande x86 de type ModRM. */
@@ -103,12 +97,6 @@ static void g_x86_mod_rm_operand_class_init(GX86ModRMOperandClass *klass)
static void g_x86_mod_rm_operand_init(GX86ModRMOperand *operand)
{
- GContentExporter *parent; /* Instance parente */
-
- parent = G_CONTENT_EXPORTER(operand);
-
- parent->add_text = (add_text_fc)g_x86_mod_rm_operand_add_text;
- parent->export_buffer = (export_buffer_fc)g_x86_mod_rm_operand_to_buffer;
}
@@ -215,7 +203,7 @@ GArchOperand *g_x86_mod_rm_operand_new(const bin_t *data, off_t *pos, off_t len,
}
-
+#if 0
/******************************************************************************
* *
* Paramètres : operand = opérande à transcrire. *
@@ -374,6 +362,7 @@ static void g_x86_mod_rm_operand_to_buffer(const GX86ModRMOperand *operand, GBuf
}
}
+#endif
/******************************************************************************
diff --git a/src/arch/x86/operands/modrm.h b/src/arch/x86/operands/modrm.h
index 89a274f..428d481 100644
--- a/src/arch/x86/operands/modrm.h
+++ b/src/arch/x86/operands/modrm.h
@@ -28,7 +28,7 @@
#include <glib-object.h>
-#include "../registers.h"
+#include "../register.h"
#include "../../immediate.h"
#include "../../operand.h"
#include "../../../common/endianness.h"
diff --git a/src/arch/x86/operands/moffs.c b/src/arch/x86/operands/moffs.c
index 3754e79..4d3c57b 100644
--- a/src/arch/x86/operands/moffs.c
+++ b/src/arch/x86/operands/moffs.c
@@ -52,12 +52,6 @@ static void g_x86_moffs_operand_class_init(GX86MOffsOperandClass *);
/* Initialise une instance d'opérande d'emplacement mémoire x86. */
static void g_x86_moffs_operand_init(GX86MOffsOperand *);
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_x86_moffs_operand_add_text(const GX86MOffsOperand *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_x86_moffs_operand_to_buffer(const GX86MOffsOperand *, GBufferLine *, GRenderingOptions *);
-
/* Indique le type défini par la GLib pour un opérande d'emplacement mémoire x86. */
@@ -96,12 +90,6 @@ static void g_x86_moffs_operand_class_init(GX86MOffsOperandClass *klass)
static void g_x86_moffs_operand_init(GX86MOffsOperand *operand)
{
- GContentExporter *parent; /* Instance parente */
-
- parent = G_CONTENT_EXPORTER(operand);
-
- parent->add_text = (add_text_fc)g_x86_moffs_operand_add_text;
- parent->export_buffer = (export_buffer_fc)g_x86_moffs_operand_to_buffer;
}
@@ -141,6 +129,7 @@ GArchOperand *g_x86_moffs_operand_new(const bin_t *data, off_t *pos, off_t len,
}
+#if 0
/******************************************************************************
* *
* Paramètres : operand = opérande à transcrire. *
@@ -187,3 +176,4 @@ static void g_x86_moffs_operand_to_buffer(const GX86MOffsOperand *operand, GBuff
g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->offset), buffer, options);
}
+#endif
diff --git a/src/arch/x86/operands/register.c b/src/arch/x86/operands/register.c
index a70ea60..4ca695f 100644
--- a/src/arch/x86/operands/register.c
+++ b/src/arch/x86/operands/register.c
@@ -52,11 +52,11 @@ static void g_x86_register_operand_class_init(GX86RegisterOperandClass *);
/* Initialise une instance d'opérande de registre x86. */
static void g_x86_register_operand_init(GX86RegisterOperand *);
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_x86_register_operand_add_text(const GX86RegisterOperand *, GRenderingOptions *, MainRendering, FILE *);
+/* Compare un opérande avec un autre. */
+static bool g_x86_register_operand_compare(const GX86RegisterOperand *, const GX86RegisterOperand *);
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_x86_register_operand_to_buffer(const GX86RegisterOperand *, GBufferLine *, GRenderingOptions *);
+/* Traduit un opérande en version humainement lisible. */
+static void g_x86_register_operand_print(const GX86RegisterOperand *, GBufferLine *, AsmSyntax);
@@ -96,12 +96,12 @@ static void g_x86_register_operand_class_init(GX86RegisterOperandClass *klass)
static void g_x86_register_operand_init(GX86RegisterOperand *operand)
{
- GContentExporter *parent; /* Instance parente */
+ GArchOperand *parent; /* Instance parente */
- parent = G_CONTENT_EXPORTER(operand);
+ parent = G_ARCH_OPERAND(operand);
- parent->add_text = (add_text_fc)g_x86_register_operand_add_text;
- parent->export_buffer = (export_buffer_fc)g_x86_register_operand_to_buffer;
+ parent->compare = (operand_compare_fc)g_x86_register_operand_compare;
+ parent->print = (operand_print_fc)g_x86_register_operand_print;
}
@@ -224,33 +224,31 @@ GArchOperand *g_x86_register_operand_new_from_index(bin_t index, MemoryDataSize
/******************************************************************************
* *
-* Paramètres : operand = opérande à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
+* Description : Compare un opérande avec un autre. *
* *
-* Retour : - *
+* Retour : Bilan de la comparaison. *
* *
* Remarques : - *
* *
******************************************************************************/
-static void g_x86_register_operand_add_text(const GX86RegisterOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
+static bool g_x86_register_operand_compare(const GX86RegisterOperand *a, const GX86RegisterOperand *b)
{
- g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->reg), options, rendering, stream);
+ return g_x86_register_compare(a->reg, b->reg);
}
/******************************************************************************
* *
-* Paramètres : operand = opérande à transcrire. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
+* Paramètres : operand = opérande à traiter. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
+* Description : Traduit un opérande en version humainement lisible. *
* *
* Retour : - *
* *
@@ -258,8 +256,8 @@ static void g_x86_register_operand_add_text(const GX86RegisterOperand *operand,
* *
******************************************************************************/
-static void g_x86_register_operand_to_buffer(const GX86RegisterOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
+static void g_x86_register_operand_print(const GX86RegisterOperand *operand, GBufferLine *line, AsmSyntax syntax)
{
- g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->reg), buffer, options);
+ g_x86_pool_operand_print(operand->reg, line, syntax);
}
diff --git a/src/arch/x86/operands/register.h b/src/arch/x86/operands/register.h
index 11bc87e..e679410 100644
--- a/src/arch/x86/operands/register.h
+++ b/src/arch/x86/operands/register.h
@@ -28,7 +28,7 @@
#include <glib-object.h>
-#include "../registers.h"
+#include "../register.h"
#include "../../operand.h"
#include "../../../common/endianness.h"
diff --git a/src/arch/x86/operands/relative.c b/src/arch/x86/operands/relative.c
index 3235a0d..cd69748 100644
--- a/src/arch/x86/operands/relative.c
+++ b/src/arch/x86/operands/relative.c
@@ -51,12 +51,6 @@ static void g_x86_relative_operand_class_init(GX86RelativeOperandClass *);
/* Initialise une instance d'opérande x86 d'adresse relative. */
static void g_x86_relative_operand_init(GX86RelativeOperand *);
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_x86_relative_operand_add_text(const GX86RelativeOperand *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_x86_relative_operand_to_buffer(const GX86RelativeOperand *, GBufferLine *, GRenderingOptions *);
-
/* Indique le type défini par la GLib pour un opérande x86 d'adresse relative. */
@@ -95,12 +89,6 @@ static void g_x86_relative_operand_class_init(GX86RelativeOperandClass *klass)
static void g_x86_relative_operand_init(GX86RelativeOperand *operand)
{
- GContentExporter *parent; /* Instance parente */
-
- parent = G_CONTENT_EXPORTER(operand);
-
- parent->add_text = (add_text_fc)g_x86_relative_operand_add_text;
- parent->export_buffer = (export_buffer_fc)g_x86_relative_operand_to_buffer;
}
@@ -159,6 +147,7 @@ GArchOperand *g_x86_relative_operand_new(const bin_t *data, off_t *pos, off_t le
}
+#if 0
/******************************************************************************
* *
* Paramètres : operand = opérande à transcrire. *
@@ -200,6 +189,7 @@ static void g_x86_relative_operand_to_buffer(const GX86RelativeOperand *operand,
g_content_exporter_to_buffer(G_CONTENT_EXPORTER(operand->immediate), buffer, options);
}
+#endif
/******************************************************************************
diff --git a/src/arch/x86/registers.c b/src/arch/x86/register.c
index e0a4df1..53b9b2e 100644
--- a/src/arch/x86/registers.c
+++ b/src/arch/x86/register.c
@@ -1,6 +1,6 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
- * registers.c - aides auxiliaires relatives aux registres x86
+ * register.c - aides auxiliaires relatives aux registres x86
*
* Copyright (C) 2009-2010 Cyrille Bagard
*
@@ -21,7 +21,7 @@
*/
-#include "registers.h"
+#include "register.h"
#include <stdio.h>
@@ -109,26 +109,23 @@ struct _GX86RegisterClass
#define MAX_REGNAME_LEN 5
-/* Construit la chaîne de caractères correspondant à l'opérande. */
-static void g_x86_register_to_string(const GX86Register *, AsmSyntax, char [MAX_REGNAME_LEN], size_t *);
+/* Initialise la classe des registres x86. */
+static void g_x86_register_class_init(GX86RegisterClass *);
-/* Ajoute du texte simple à un fichier ouvert en écriture. */
-static void g_x86_register_add_text(const GX86Register *, GRenderingOptions *, MainRendering, FILE *);
-
-/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
-static void g_x86_register_to_buffer(const GX86Register *, GBufferLine *, GRenderingOptions *);
+/* Initialise une instance de registre x86. */
+static void g_x86_register_init(GX86Register *);
/* Indique le type défini pour une représentation d'un registre x86. */
-G_DEFINE_TYPE(GX86Register, g_x86_register, G_TYPE_CONTENT_EXPORTER);
+G_DEFINE_TYPE(GX86Register, g_x86_register, G_TYPE_ARCH_OPERAND);
/******************************************************************************
* *
* Paramètres : klass = classe à initialiser. *
* *
-* Description : Initialise la classe des lignes de représentation. *
+* Description : Initialise la classe des registres x86. *
* *
* Retour : - *
* *
@@ -146,7 +143,7 @@ static void g_x86_register_class_init(GX86RegisterClass *klass)
* *
* Paramètres : reg = instance à initialiser. *
* *
-* Description : Initialise une instance de ligne de représentation. *
+* Description : Initialise une instance de registre x86. *
* *
* Retour : - *
* *
@@ -156,12 +153,6 @@ static void g_x86_register_class_init(GX86RegisterClass *klass)
static void g_x86_register_init(GX86Register *reg)
{
- GContentExporter *parent; /* Instance parente */
-
- parent = G_CONTENT_EXPORTER(reg);
-
- parent->add_text = (add_text_fc)g_x86_register_add_text;
- parent->export_buffer = (export_buffer_fc)g_x86_register_to_buffer;
}
@@ -235,22 +226,65 @@ GX86Register *g_x86_register_new(MemoryDataSize size, bin_t value)
gxrn_error:
- /* FIXME free(result); */
+ g_object_unref(G_OBJECT(result));
return NULL;
}
+/******************************************************************************
+* *
+* Paramètres : a = premier opérande à consulter. *
+* b = second opérande à consulter. *
+* *
+* Description : Compare un registre avec un autre. *
+* *
+* Retour : Bilan de la comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_x86_register_compare(const GX86Register *a, const GX86Register *b)
+{
+ bool result; /* Bilan à retourner */
+
+ if (a->size != b->size)
+ return false;
+
+ switch (a->size)
+ {
+ case MDS_8_BITS:
+ result = (a->reg.reg8 == b->reg.reg8);
+ break;
+
+ case MDS_16_BITS:
+ result = (a->reg.reg16 == b->reg.reg16);
+ break;
+
+ case MDS_32_BITS:
+ result = (a->reg.reg32 == b->reg.reg32);
+ break;
+
+ default:
+ result = false;
+ break;
+
+ }
+
+ return result;
+
+}
+
/******************************************************************************
* *
-* Paramètres : operand = opérande à transcrire. *
-* syntax = type de représentation demandée. *
-* key = description humaine du registre. [OUT] *
-* klen = nombre de caractères utilisés. [OUT] *
+* Paramètres : reg = registre à transcrire. *
+* line = ligne tampon où imprimer l'opérande donné. *
+* syntax = type de représentation demandée. *
* *
-* Description : Construit la chaîne de caractères correspondant à l'opérande.*
+* Description : Traduit un registre en version humainement lisible. *
* *
* Retour : - *
* *
@@ -258,9 +292,10 @@ GX86Register *g_x86_register_new(MemoryDataSize size, bin_t value)
* *
******************************************************************************/
-static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax, char key[MAX_REGNAME_LEN], size_t *klen)
+void g_x86_pool_operand_print(const GX86Register *reg, GBufferLine *line, AsmSyntax syntax)
{
- *klen = 0;
+ char key[MAX_REGNAME_LEN]; /* Mot clef principal */
+ size_t klen; /* Taille de ce mot clef */
switch (syntax)
{
@@ -268,7 +303,7 @@ static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax,
switch (reg->size)
{
case MDS_8_BITS:
- *klen = 2;
+ klen = 2;
switch (reg->reg.reg8)
{
case X86_REG8_AL:
@@ -302,7 +337,7 @@ static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax,
break;
case MDS_16_BITS:
- *klen = 2;
+ klen = 2;
switch (reg->reg.reg16)
{
case X86_REG16_AX:
@@ -336,7 +371,7 @@ static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax,
break;
case MDS_32_BITS:
- *klen = 3;
+ klen = 3;
switch (reg->reg.reg32)
{
case X86_REG32_EAX:
@@ -371,6 +406,7 @@ static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax,
break;
default:
+ klen = 0;
break;
}
@@ -380,7 +416,7 @@ static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax,
switch (reg->size)
{
case MDS_8_BITS:
- *klen = 3;
+ klen = 3;
switch (reg->reg.reg8)
{
case X86_REG8_AL:
@@ -414,7 +450,7 @@ static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax,
break;
case MDS_16_BITS:
- *klen = 3;
+ klen = 3;
switch (reg->reg.reg16)
{
case X86_REG16_AX:
@@ -448,7 +484,7 @@ static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax,
break;
case MDS_32_BITS:
- *klen = 4;
+ klen = 4;
switch (reg->reg.reg32)
{
case X86_REG32_EAX:
@@ -482,70 +518,19 @@ static void g_x86_register_to_string(const GX86Register *reg, AsmSyntax syntax,
break;
default:
+ klen = 0;
break;
}
break;
default:
+ klen = 0;
break;
}
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = registre X86 à transcrire. *
-* options = options de rendu. *
-* rendering = support effectif final des lignes de code. *
-* stream = flux ouvert en écriture. *
-* *
-* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_register_add_text(const GX86Register *reg, GRenderingOptions *options, MainRendering rendering, FILE *stream)
-{
- char key[MAX_REGNAME_LEN]; /* Mot clef principal */
- size_t klen; /* Taille de ce mot clef */
-
- g_x86_register_to_string(reg, g_rendering_options_get_syntax(options), key, &klen);
-
- g_content_exporter_insert_text(G_CONTENT_EXPORTER(reg), stream,
- key, klen, RTT_REGISTER);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = registre X86 à transcrire. *
-* buffer = espace où placer ledit contenu. *
-* options = options de rendu. *
-* *
-* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_x86_register_to_buffer(const GX86Register *reg, GBufferLine *buffer, GRenderingOptions *options)
-{
- char key[MAX_REGNAME_LEN]; /* Mot clef principal */
- size_t klen; /* Taille de ce mot clef */
-
- g_x86_register_to_string(reg, g_rendering_options_get_syntax(options), key, &klen);
-
- g_content_exporter_insert_into_buffer(G_CONTENT_EXPORTER(reg), buffer, BLC_ASSEMBLY,
- key, klen, RTT_REGISTER);
+ g_buffer_line_insert_text(line, BLC_ASSEMBLY, key, klen, RTT_REGISTER);
}
diff --git a/src/arch/x86/registers.h b/src/arch/x86/register.h
index 18bced7..5491c08 100644
--- a/src/arch/x86/registers.h
+++ b/src/arch/x86/register.h
@@ -1,6 +1,6 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
- * registers.h - prototypes pour les aides auxiliaires relatives aux registres x86
+ * register.h - prototypes pour les aides auxiliaires relatives aux registres x86
*
* Copyright (C) 2009 Cyrille Bagard
*
@@ -21,8 +21,8 @@
*/
-#ifndef _ARCH_X86_REGISTERS_H
-#define _ARCH_X86_REGISTERS_H
+#ifndef _ARCH_X86_REGISTER_H
+#define _ARCH_X86_REGISTER_H
#include <glib-object.h>
@@ -30,6 +30,7 @@
#include "../archbase.h"
+#include "../../glibext/gbufferline.h"
@@ -54,6 +55,12 @@ GType g_x86_register_get_type(void);
/* Crée une réprésentation de registre x86. */
GX86Register *g_x86_register_new(MemoryDataSize, bin_t);
+/* Compare un registre avec un autre. */
+bool g_x86_register_compare(const GX86Register *, const GX86Register *);
+
+/* Traduit un registre en version humainement lisible. */
+void g_x86_pool_operand_print(const GX86Register *, GBufferLine *, AsmSyntax);
+
/* Indique si le registre correspond à ebp ou similaire. */
bool g_x86_register_is_base_pointer(const GX86Register *);
@@ -62,4 +69,4 @@ bool g_x86_register_is_stack_pointer(const GX86Register *);
-#endif /* _ARCH_X86_REGISTERS_H */
+#endif /* _ARCH_X86_REGISTER_H */
diff --git a/src/dialogs/add_shellcode.c b/src/dialogs/add_shellcode.c
index 65e081b..ab59b36 100644
--- a/src/dialogs/add_shellcode.c
+++ b/src/dialogs/add_shellcode.c
@@ -35,7 +35,7 @@
-#include "../analysis/binary.h" // A garder ?
+#include "../analysis/roptions.h" // A garder ?
#ifndef _
diff --git a/src/dialogs/export.h b/src/dialogs/export.h
index 3274b12..fc7e1bd 100644
--- a/src/dialogs/export.h
+++ b/src/dialogs/export.h
@@ -25,6 +25,9 @@
#define _DIALOGS_EXPORT_H
+#include <gtk/gtkwindow.h>
+
+
#include "../analysis/binary.h"
diff --git a/src/gui/panels/log.c b/src/gui/panels/log.c
index 0baa3a4..e0be732 100644
--- a/src/gui/panels/log.c
+++ b/src/gui/panels/log.c
@@ -28,6 +28,9 @@
#include <malloc.h>
#include <stdarg.h>
#include <stdio.h>
+#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtktreestore.h>
+#include <gtk/gtktreeview.h>
diff --git a/src/gui/panels/panel-int.h b/src/gui/panels/panel-int.h
index def1934..c0f9e34 100644
--- a/src/gui/panels/panel-int.h
+++ b/src/gui/panels/panel-int.h
@@ -29,6 +29,7 @@
#include "panel.h"
+#include <gtk/gtkbin.h>
#include <gtk/gtkwidget.h>
diff --git a/src/gui/tb/toolbar.c b/src/gui/tb/toolbar.c
index fda1b7b..50f8968 100644
--- a/src/gui/tb/toolbar.c
+++ b/src/gui/tb/toolbar.c
@@ -25,6 +25,9 @@
#include "toolbar.h"
+#include <gtk/gtkcontainer.h>
+
+
#include "../editem-int.h"
diff --git a/src/project.h b/src/project.h
index 0665ec0..384d1aa 100644
--- a/src/project.h
+++ b/src/project.h
@@ -25,6 +25,7 @@
#define _PROJECT_H
+#include <gtk/gtkrecentmanager.h>
#include <gtk/gtkwidget.h>