summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-07-26 22:40:17 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-07-26 22:40:17 (GMT)
commitfd2abec30a224279c62a7ab4892d95e56cb08dff (patch)
tree2cfcc70115749267fb0f1bc96511dfb61935203f /src
parent3155a05a21a52a173b8a711c402426392eb53c2a (diff)
Moved the openida_binary structure to a GOpenidaBinary GLib object.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@103 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src')
-rw-r--r--src/analysis/binary.c138
-rw-r--r--src/analysis/binary.h54
-rw-r--r--src/debug/debugger-int.h2
-rw-r--r--src/debug/debuggers.c2
-rw-r--r--src/debug/debuggers.h2
-rw-r--r--src/debug/ptrace/options.c4
-rw-r--r--src/debug/ptrace/options.h2
-rw-r--r--src/debug/ptrace/ptrace.c4
-rw-r--r--src/editor.c26
-rw-r--r--src/gtkext/gtkbinview-int.h2
-rw-r--r--src/gtkext/gtkbinview.c2
-rw-r--r--src/gtkext/gtkbinview.h2
-rw-r--r--src/gtkext/gtkgraphview.c6
-rw-r--r--src/plugins/plugin-def.h2
-rw-r--r--src/plugins/plugin.c2
-rw-r--r--src/plugins/plugin.h2
-rw-r--r--src/project.c33
-rw-r--r--src/project.h8
18 files changed, 162 insertions, 131 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index a24c3d3..c0c6e7c 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -54,18 +54,17 @@
-extern bool find_line_info(const uint8_t *content, off_t *size);
-
-
-/* Description d'un fichier binaire */
-struct _openida_binary
+/* Description de fichier binaire (instance) */
+struct _GOpenidaBinary
{
+ GObject parent; /* A laisser en premier */
+
char *filename; /* Fichier chargé en mémoire */
off_t bin_length; /* Taille des données brutes */
- uint8_t *bin_data; /* Données binaires brutes */
+ bin_t *bin_data; /* Données binaires brutes */
exe_format *format; /* Format du binaire */
GArchProcessor *proc; /* Architecture du binaire */
@@ -75,30 +74,80 @@ struct _openida_binary
};
+/* Description de fichier binaire (classe) */
+struct _GOpenidaBinaryClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+/* Initialise la classe des descriptions de fichier binaire. */
+static void g_openida_binary_class_init(GOpenidaBinaryClass *);
-/* Charge en mémoire le contenu d'un fichier à partir d'XML. */
-openida_binary *load_binary_file_from_xml(xmlXPathObjectPtr);
+/* Initialise une description de fichier binaire. */
+static void g_openida_binary_init(GOpenidaBinary *);
/* Charge en mémoire le contenu d'un fichier. */
-uint8_t *map_binary_file(const char *, off_t *);
+bin_t *map_binary_file(const char *, off_t *);
/* Construit la description d'introduction du désassemblage. */
GRenderingLine *build_binary_prologue(const char *, const uint8_t *, off_t);
/* Procède au désassemblage basique d'un contenu binaire. */
-void disassemble_openida_binary(openida_binary *);
+void disassemble_openida_binary(GOpenidaBinary *);
/* Etablit les liens entres les différentes lignes de code. */
-void establish_links_in_openida_binary(const openida_binary *);
+void establish_links_in_openida_binary(const GOpenidaBinary *);
/* S'assure que toutes les routines ont une taille définie. */
-void limit_all_routines_in_openida_binary(const openida_binary *);
+void limit_all_routines_in_openida_binary(const GOpenidaBinary *);
/* Cherche l'adresse de fin d'une routine. */
vmpa_t find_best_ending_address_for_routine(GRenderingLine *, size_t, const vmpa_t *, const off_t *, size_t);
+/* Indique le type défini pour une description de fichier binaire. */
+G_DEFINE_TYPE(GOpenidaBinary, g_openida_binary, G_TYPE_OBJECT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des descriptions de fichier binaire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_openida_binary_class_init(GOpenidaBinaryClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : line = instance à initialiser. *
+* *
+* Description : Initialise une description de fichier binaire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_openida_binary_init(GOpenidaBinary *line)
+{
+
+}
+
+
/******************************************************************************
* *
* Paramètres : filename = nom du fichier à charger. *
@@ -111,11 +160,11 @@ vmpa_t find_best_ending_address_for_routine(GRenderingLine *, size_t, const vmpa
* *
******************************************************************************/
-openida_binary *load_binary_file(const char *filename)
+GOpenidaBinary *g_openida_binary_new_from_file(const char *filename)
{
- openida_binary *result; /* Adresse à retourner */
+ GOpenidaBinary *result; /* Adresse à retourner */
- result = (openida_binary *)calloc(1, sizeof(openida_binary));
+ result = g_object_new(G_TYPE_OPENIDA_BINARY, NULL);
result->filename = strdup(filename);
@@ -158,7 +207,7 @@ openida_binary *load_binary_file(const char *filename)
lbf_error:
- unload_binary_file(result);
+ //unload_binary_file(result);
return NULL;
@@ -178,9 +227,9 @@ openida_binary *load_binary_file(const char *filename)
* *
******************************************************************************/
-openida_binary *g_binary_file_new_from_xml(xmlXPathContextPtr context, const char *path)
+GOpenidaBinary *g_openida_binary_new_from_xml(xmlXPathContextPtr context, const char *path)
{
- openida_binary *result; /* Adresse à retourner */
+ GOpenidaBinary *result; /* Adresse à retourner */
size_t access_len; /* Taille d'un chemin interne */
char *access; /* Chemin pour une sous-config.*/
char *filename; /* Chemin du binaire à charger */
@@ -202,7 +251,7 @@ openida_binary *g_binary_file_new_from_xml(xmlXPathContextPtr context, const cha
if (filename != NULL)
{
- result = load_binary_file(filename);
+ result = g_openida_binary_new_from_file(filename);
free(filename);
}
@@ -226,7 +275,7 @@ openida_binary *g_binary_file_new_from_xml(xmlXPathContextPtr context, const cha
* *
******************************************************************************/
-bool g_openida_binary_save(const openida_binary *binary, xmlDocPtr xdoc, xmlXPathContextPtr context, const char *path)
+bool g_openida_binary_save(const GOpenidaBinary *binary, xmlDocPtr xdoc, xmlXPathContextPtr context, const char *path)
{
bool result; /* Bilan à faire remonter */
char *access; /* Chemin d'accès à un élément */
@@ -249,38 +298,17 @@ bool g_openida_binary_save(const openida_binary *binary, xmlDocPtr xdoc, xmlXPat
/******************************************************************************
* *
-* Paramètres : binary = élément binaire à supprimer de la mémoire. *
-* *
-* Description : Décharge de la mémoire le contenu d'un fichier. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void unload_binary_file(openida_binary *binary)
-{
- free(binary->filename);
-
- free(binary);
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : binary = élément binaire à consulter. *
* *
-* Description : Fournit le fichier correspondant à l'élément binaire. *
+* Description : Fournit une description humaine d'un élément binaire. *
* *
-* Retour : Nom de fichier avec chemin absolu. *
+* Retour : Chaîne de caractères humainenement lisible de représentation.*
* *
* Remarques : - *
* *
******************************************************************************/
-const char *openida_binary_get_filename(const openida_binary *binary)
+const char *g_openida_binary_to_string(const GOpenidaBinary *binary)
{
return binary->filename;
@@ -291,15 +319,15 @@ const char *openida_binary_get_filename(const openida_binary *binary)
* *
* Paramètres : binary = élément binaire à consulter. *
* *
-* Description : Fournit une description humaine d'un élément binaire. *
+* Description : Fournit le fichier correspondant à l'élément binaire. *
* *
-* Retour : Chaîne de caractères humainenement lisible de représentation.*
+* Retour : Nom de fichier avec chemin absolu. *
* *
* Remarques : - *
* *
******************************************************************************/
-const char *openida_binary_to_string(const openida_binary *binary)
+const char *g_openida_binary_get_filename(const GOpenidaBinary *binary)
{
return binary->filename;
@@ -319,7 +347,7 @@ const char *openida_binary_to_string(const openida_binary *binary)
* *
******************************************************************************/
-uint8_t *get_openida_binary_data(const openida_binary *binary, off_t *length)
+bin_t *g_openida_binary_get_data(const GOpenidaBinary *binary, off_t *length)
{
*length = binary->bin_length;
@@ -340,7 +368,7 @@ uint8_t *get_openida_binary_data(const openida_binary *binary, off_t *length)
* *
******************************************************************************/
-exe_format *get_openida_binary_format(const openida_binary *binary)
+exe_format *g_openida_binary_get_format(const GOpenidaBinary *binary)
{
return binary->format;
@@ -359,7 +387,7 @@ exe_format *get_openida_binary_format(const openida_binary *binary)
* *
******************************************************************************/
-GRenderingOptions *get_openida_binary_options(const openida_binary *binary)
+GRenderingOptions *g_openida_binary_get_options(const GOpenidaBinary *binary)
{
return binary->options;
@@ -378,7 +406,7 @@ GRenderingOptions *get_openida_binary_options(const openida_binary *binary)
* *
******************************************************************************/
-GRenderingLine *get_openida_binary_lines(const openida_binary *binary)
+GRenderingLine *g_openida_binary_get_lines(const GOpenidaBinary *binary)
{
return binary->lines;
@@ -407,7 +435,7 @@ GRenderingLine *get_openida_binary_lines(const openida_binary *binary)
* *
******************************************************************************/
-uint8_t *map_binary_file(const char *filename, off_t *length)
+bin_t *map_binary_file(const char *filename, off_t *length)
{
uint8_t *result; /* Données à retourner */
int fd; /* Fichier ouvert en lecture */
@@ -535,7 +563,7 @@ GRenderingLine *build_binary_prologue(const char *filename, const uint8_t *data,
* *
******************************************************************************/
-void disassemble_openida_binary(openida_binary *binary)
+void disassemble_openida_binary(GOpenidaBinary *binary)
{
@@ -658,7 +686,7 @@ void disassemble_openida_binary(openida_binary *binary)
* *
******************************************************************************/
-void establish_links_in_openida_binary(const openida_binary *binary)
+void establish_links_in_openida_binary(const GOpenidaBinary *binary)
{
GBinRoutine **routines; /* Liste des routines trouvées */
size_t routines_count; /* Nombre de ces routines */
@@ -754,7 +782,7 @@ void establish_links_in_openida_binary(const openida_binary *binary)
* *
******************************************************************************/
-void limit_all_routines_in_openida_binary(const openida_binary *binary)
+void limit_all_routines_in_openida_binary(const GOpenidaBinary *binary)
{
GBinRoutine **routines; /* Liste des routines trouvées */
size_t routines_count; /* Nombre de ces routines */
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index cf47492..ad0429f 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -21,10 +21,11 @@
*/
-#ifndef _BINARY_H
-#define _BINARY_H
+#ifndef _ANALYSIS_BINARY_H
+#define _ANALYSIS_BINARY_H
+#include <glib-object.h>
#include <stdbool.h>
@@ -35,49 +36,50 @@
-/* Description d'un fichier binaire */
-typedef struct _openida_binary openida_binary;
+#define G_TYPE_OPENIDA_BINARY g_openida_binary_get_type()
+#define G_OPENIDA_BINARY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_openida_binary_get_type(), GOpenidaBinary))
+#define G_IS_OPENIDA_BINARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_openida_binary_get_type()))
+#define G_OPENIDA_BINARY_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_openida_binary_get_type(), GOpenidaBinaryIface))
+#define G_OPENIDA_BINARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_OPENIDA_BINARY, GOpenidaBinaryClass))
+/* Description de fichier binaire (instance) */
+typedef struct _GOpenidaBinary GOpenidaBinary;
+
+/* Description de fichier binaire (classe) */
+typedef struct _GOpenidaBinaryClass GOpenidaBinaryClass;
+
+
+/* Indique le type défini pour une description de fichier binaire. */
+GType g_openida_binary_get_type(void);
+
/* Charge en mémoire le contenu d'un fichier. */
-openida_binary *load_binary_file(const char *);
+GOpenidaBinary *g_openida_binary_new_from_file(const char *);
/* Charge en mémoire le contenu d'un fichier à partir d'XML. */
-openida_binary *g_binary_file_new_from_xml(xmlXPathContextPtr, const char *);
+GOpenidaBinary *g_openida_binary_new_from_xml(xmlXPathContextPtr, const char *);
/* Ecrit une sauvegarde du binaire dans un fichier XML. */
-bool g_openida_binary_save(const openida_binary *, xmlDocPtr, xmlXPathContextPtr, const char *);
-
-/* Décharge de la mémoire le contenu d'un fichier. */
-void unload_binary_file(openida_binary *);
+bool g_openida_binary_save(const GOpenidaBinary *, xmlDocPtr, xmlXPathContextPtr, const char *);
/* Fournit une description humaine d'un élément binaire. */
-const char *openida_binary_to_string(const openida_binary *);
+const char *g_openida_binary_to_string(const GOpenidaBinary *);
/* Fournit le fichier correspondant à l'élément binaire. */
-const char *openida_binary_get_filename(const openida_binary *);
+const char *g_openida_binary_get_filename(const GOpenidaBinary *);
/* Fournit les détails du contenu binaire chargé en mémoire. */
-uint8_t *get_openida_binary_data(const openida_binary *, off_t *);
+bin_t *g_openida_binary_get_data(const GOpenidaBinary *, off_t *);
/* Fournit le format de fichier reconnu dans le contenu binaire. */
-exe_format *get_openida_binary_format(const openida_binary *);
+exe_format *g_openida_binary_get_format(const GOpenidaBinary *);
/* Fournit les options d'affichage définies pour le binaire. */
-GRenderingOptions *get_openida_binary_options(const openida_binary *);
+GRenderingOptions *g_openida_binary_get_options(const GOpenidaBinary *);
/* Fournit les lignes de rendu issues du désassemblage. */
-GRenderingLine *get_openida_binary_lines(const openida_binary *);
-
-
-
-
-
-
-
-
-
+GRenderingLine *g_openida_binary_get_lines(const GOpenidaBinary *);
-#endif /* _BINARY_H */
+#endif /* _ANALYSIS_BINARY_H */
diff --git a/src/debug/debugger-int.h b/src/debug/debugger-int.h
index 1b47a03..3ba594a 100644
--- a/src/debug/debugger-int.h
+++ b/src/debug/debugger-int.h
@@ -47,7 +47,7 @@ struct _GBinaryDebugger
{
GObject parent; /* A laisser en premier */
- openida_binary *binary; /* Cible à traiter */
+ GOpenidaBinary *binary; /* Cible à traiter */
basic_debugger_fc run; /* Démarre le débogueur */
basic_debugger_fc pause; /* Met en pause le débogueur */
diff --git a/src/debug/debuggers.c b/src/debug/debuggers.c
index a9537c3..c9af67a 100644
--- a/src/debug/debuggers.c
+++ b/src/debug/debuggers.c
@@ -98,7 +98,7 @@ static void g_binary_debugger_init(GBinaryDebugger *debugger)
* *
******************************************************************************/
-GBinaryDebugger *g_new_binary_debugger(DebuggerType type, openida_binary *binary)
+GBinaryDebugger *g_new_binary_debugger(DebuggerType type, GOpenidaBinary *binary)
{
GBinaryDebugger *result;
diff --git a/src/debug/debuggers.h b/src/debug/debuggers.h
index 03c3164..90db12f 100644
--- a/src/debug/debuggers.h
+++ b/src/debug/debuggers.h
@@ -72,7 +72,7 @@ typedef struct _GBinaryDebuggerClass GBinaryDebuggerClass;
GType g_binary_debugger_get_type(void);
/* Crée un nouveau débogueur. */
-GBinaryDebugger *g_new_binary_debugger(DebuggerType, openida_binary *);
+GBinaryDebugger *g_new_binary_debugger(DebuggerType, GOpenidaBinary *);
/* Démarre une procédure de débogage. */
void g_binary_debugger_run(GBinaryDebugger *);
diff --git a/src/debug/ptrace/options.c b/src/debug/ptrace/options.c
index 6aa8a1c..4123e3f 100644
--- a/src/debug/ptrace/options.c
+++ b/src/debug/ptrace/options.c
@@ -65,13 +65,13 @@ struct _ptrace_options
* *
******************************************************************************/
-ptrace_options *create_ptrace_options_from_binary(const openida_binary *binary)
+ptrace_options *create_ptrace_options_from_binary(const GOpenidaBinary *binary)
{
ptrace_options *result;
result = (ptrace_options *)calloc(1, sizeof(ptrace_options));
- result->filename = strdup(openida_binary_get_filename(binary));
+ result->filename = strdup(g_openida_binary_get_filename(binary));
result->argv = (char **)calloc(2, sizeof(char *));
diff --git a/src/debug/ptrace/options.h b/src/debug/ptrace/options.h
index bc25abf..5d02617 100644
--- a/src/debug/ptrace/options.h
+++ b/src/debug/ptrace/options.h
@@ -40,7 +40,7 @@ typedef struct _ptrace_options ptrace_options;
/* Etablit les options par défaut pour un binaire donné. */
-ptrace_options *create_ptrace_options_from_binary(const openida_binary *);
+ptrace_options *create_ptrace_options_from_binary(const GOpenidaBinary *);
/* Lance le processus à déboguer via ptrace(). */
bool run_ptrace_options_process(const ptrace_options *);
diff --git a/src/debug/ptrace/ptrace.c b/src/debug/ptrace/ptrace.c
index 8840ce6..a5c065e 100644
--- a/src/debug/ptrace/ptrace.c
+++ b/src/debug/ptrace/ptrace.c
@@ -300,7 +300,7 @@ void *ptrace_thread(GPtraceDebugger *debugger)
gdk_threads_enter();
log_variadic_message(LMT_PROCESS, _("Starting to debug %s..."),
- openida_binary_get_filename(G_BINARY_DEBUGGER(debugger)->binary));
+ g_openida_binary_get_filename(G_BINARY_DEBUGGER(debugger)->binary));
gdk_flush ();
gdk_threads_leave();
@@ -376,7 +376,7 @@ void *ptrace_thread(GPtraceDebugger *debugger)
}
log_variadic_message(LMT_PROCESS, _("Finished to debug %s..."),
- openida_binary_get_filename(G_BINARY_DEBUGGER(debugger)->binary));
+ g_openida_binary_get_filename(G_BINARY_DEBUGGER(debugger)->binary));
break;
diff --git a/src/editor.c b/src/editor.c
index 49c255b..76c8181 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -755,7 +755,7 @@ void mcb_view_change_support(GtkRadioMenuItem *menuitem, GObject *ref)
GSList *group; /* Liste de menus radio */
GSList *iter; /* Boucle de parcours */
BinaryView view; /* Nouvelle vue à présenter */
- openida_binary *binary; /* Edition courante */
+ GOpenidaBinary *binary; /* Edition courante */
GtkBinView *binview; /* Afficheur effectif de code */
GtkWidget *panel; /* Nouveau support à utiliser */
GtkDockPanel *dpanel; /* Support de panneaux */
@@ -772,13 +772,13 @@ void mcb_view_change_support(GtkRadioMenuItem *menuitem, GObject *ref)
view = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(iter->data), "kind_of_view"));
- binary = (openida_binary *)g_object_get_data(ref, "current_binary");
+ binary = (GOpenidaBinary *)g_object_get_data(ref, "current_binary");
panel = get_view_for_openida_project_binary(get_current_openida_project(), binary, view, &binview);
g_object_set_data(ref, "binview", binview);
dpanel = GTK_DOCK_PANEL(g_object_get_data(ref, "binpanel"));
- ditem = gtk_dock_panel_item_from_name(dpanel, openida_binary_to_string(binary));
+ ditem = gtk_dock_panel_item_from_name(dpanel, g_openida_binary_to_string(binary));
gtk_dock_panel_replace_item_content(dpanel, ditem, panel);
@@ -859,7 +859,7 @@ void mcb_project_add_binary(GtkMenuItem *menuitem, gpointer data)
{
GtkWidget *dialog; /* Boîte à afficher */
gchar *filename; /* Nom du fichier à intégrer */
- openida_binary *binary; /* Représentation chargée */
+ GOpenidaBinary *binary; /* Représentation chargée */
dialog = gtk_file_chooser_dialog_new (_("Open a binary file"), GTK_WINDOW(data),
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -871,7 +871,7 @@ void mcb_project_add_binary(GtkMenuItem *menuitem, gpointer data)
{
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- binary = load_binary_file(filename);
+ binary = g_openida_binary_new_from_file(filename);
if (binary != NULL)
{
@@ -903,12 +903,12 @@ void mcb_project_add_binary(GtkMenuItem *menuitem, gpointer data)
void mcb_project_remove_binary(GtkMenuItem *menuitem, gpointer data)
{
- openida_binary *binary; /* Représentation chargée */
+ GOpenidaBinary *binary; /* Représentation chargée */
binary = g_object_get_data(G_OBJECT(menuitem), "binary");
detach_binary_to_openida_project(get_current_openida_project(), binary);
- unload_binary_file(binary);
+ //unload_binary_file(binary);
reload_menu_project(G_OBJECT(data));
@@ -965,7 +965,7 @@ void reload_menu_project(GObject *ref)
GList *list; /* Liste des éléments en place */
GList *iter; /* Boucle de parcours #1 */
size_t count; /* Nombre de binaires attachés */
- const openida_binary **binaries; /* Liste de ces binaires */
+ const GOpenidaBinary **binaries; /* Liste de ces binaires */
size_t i; /* Boucle de parcours #2 */
const char *desc; /* Description à afficher */
GtkWidget *submenuitem; /* Sous-menu à ajouter */
@@ -988,7 +988,7 @@ void reload_menu_project(GObject *ref)
for (i = 0; i < count; i++)
{
- desc = openida_binary_to_string(binaries[i]);
+ desc = g_openida_binary_to_string(binaries[i]);
submenuitem = qck_create_menu_item(NULL, NULL, desc, G_CALLBACK(mcb_project_remove_binary), ref);
g_object_set_data(G_OBJECT(submenuitem), "binary", binaries[i]);
@@ -1007,7 +1007,7 @@ void debugger_stopped_cb(GBinaryDebugger *debugger, uint64_t last, uint64_t cur,
GObject *ref;
- openida_binary *binary;
+ GOpenidaBinary *binary;
GRenderingLine *line;
@@ -1025,7 +1025,7 @@ void debugger_stopped_cb(GBinaryDebugger *debugger, uint64_t last, uint64_t cur,
if (last != cur)
{
- line = g_rendering_line_find_by_address(get_openida_binary_lines(binary), NULL/* FIXME */, last);
+ line = g_rendering_line_find_by_address(g_openida_binary_get_lines(binary), NULL/* FIXME */, last);
if (line != NULL)
g_rendering_line_remove_flag(line, RLF_RUNNING_BP);
@@ -1035,7 +1035,7 @@ void debugger_stopped_cb(GBinaryDebugger *debugger, uint64_t last, uint64_t cur,
printf("bp at 0x%016llx\n", cur);
- line = g_rendering_line_find_by_address(get_openida_binary_lines(binary), NULL/* FIXME */, cur);
+ line = g_rendering_line_find_by_address(g_openida_binary_get_lines(binary), NULL/* FIXME */, cur);
if (line != NULL)
g_rendering_line_add_flag(line, RLF_RUNNING_BP);
@@ -1081,7 +1081,7 @@ void debugger_stopped_cb(GBinaryDebugger *debugger, uint64_t last, uint64_t cur,
void mcb_debug_start(GtkCheckMenuItem *menuitem, gpointer data)
{
- openida_binary *binary; /* Binaire à analyser */
+ GOpenidaBinary *binary; /* Binaire à analyser */
GBinaryDebugger *debugger; /* Débogueur offrant l'analyse */
diff --git a/src/gtkext/gtkbinview-int.h b/src/gtkext/gtkbinview-int.h
index cea40a1..0e38c57 100644
--- a/src/gtkext/gtkbinview-int.h
+++ b/src/gtkext/gtkbinview-int.h
@@ -51,7 +51,7 @@ struct _GtkBinView
bool show_border; /* Affichage d'une bordure ? */
- openida_binary *binary; /* Contenu binaire affiché */
+ GOpenidaBinary *binary; /* Contenu binaire affiché */
GRenderingLine *lines; /* Contenu à représenter */
GRenderingLine *last; /* Dernière ligne associée */
diff --git a/src/gtkext/gtkbinview.c b/src/gtkext/gtkbinview.c
index f0470bc..802a115 100644
--- a/src/gtkext/gtkbinview.c
+++ b/src/gtkext/gtkbinview.c
@@ -235,7 +235,7 @@ void gtk_bin_view_show_border(GtkBinView *view, bool show)
* *
******************************************************************************/
-void gtk_bin_view_set_rendering_lines(GtkBinView *view, openida_binary *binary, GRenderingLine *lines, GRenderingLine *last)
+void gtk_bin_view_set_rendering_lines(GtkBinView *view, GOpenidaBinary *binary, GRenderingLine *lines, GRenderingLine *last)
{
view->binary = binary;
diff --git a/src/gtkext/gtkbinview.h b/src/gtkext/gtkbinview.h
index e443161..945eefb 100644
--- a/src/gtkext/gtkbinview.h
+++ b/src/gtkext/gtkbinview.h
@@ -57,7 +57,7 @@ void gtk_bin_view_show_border(GtkBinView *, bool);
/* Définit les lignes à associer à la représentation. */
-void gtk_bin_view_set_rendering_lines(GtkBinView *, openida_binary *, GRenderingLine *, GRenderingLine *);
+void gtk_bin_view_set_rendering_lines(GtkBinView *, GOpenidaBinary *, GRenderingLine *, GRenderingLine *);
/* Fournit la liste des lignes associées à la représentation. */
GRenderingLine *gtk_bin_view_get_lines(const GtkBinView *);
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index 7a17aa5..fcf3976 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -78,7 +78,7 @@ static void gtk_graph_view_define_main_address(GtkGraphView *, vmpa_t);
static bool gtk_graph_view_get_address_coordinates(const GtkGraphView *, vmpa_t, gint *, gint *);
/* Définit la liste complète des éléments du futur graphique. */
-static GtkBinView **gtk_graph_view_load_nodes(openida_binary *, GRenderingLine *, GRenderingLine *, size_t *);
+static GtkBinView **gtk_graph_view_load_nodes(GOpenidaBinary *, GRenderingLine *, GRenderingLine *, size_t *);
/* Détermine le type du composant d'affichage en graphique. */
@@ -318,7 +318,7 @@ static void gtk_graph_view_define_main_address(GtkGraphView *view, vmpa_t addr)
{
gtk_graph_view_reset(view);
- format = get_openida_binary_format(GTK_BIN_VIEW(view)->binary);
+ format = g_openida_binary_get_format(GTK_BIN_VIEW(view)->binary);
routines = get_all_exe_routines(format, &routines_count);
for (i = 0; i < routines_count; i++)
@@ -402,7 +402,7 @@ static bool gtk_graph_view_get_address_coordinates(const GtkGraphView *view, vmp
* *
******************************************************************************/
-static GtkBinView **gtk_graph_view_load_nodes(openida_binary *binary, GRenderingLine *first, GRenderingLine *last, size_t *count)
+static GtkBinView **gtk_graph_view_load_nodes(GOpenidaBinary *binary, GRenderingLine *first, GRenderingLine *last, size_t *count)
{
GtkBinView **result; /* Liste à retourner */
GRenderingLine *begin; /* Début d'un groupe de lignes */
diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h
index 44dd3fa..f8f8fe3 100644
--- a/src/plugins/plugin-def.h
+++ b/src/plugins/plugin-def.h
@@ -47,7 +47,7 @@ typedef enum _PluginAction
typedef PluginAction (* get_plugin_action_fc) (void);
/* Exécute une action définie sur un binaire chargé. */
-typedef bool (* execute_action_on_binary_fc) (openida_binary *, PluginAction);
+typedef bool (* execute_action_on_binary_fc) (GOpenidaBinary *, PluginAction);
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 0165dfa..cde1ab5 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -211,7 +211,7 @@ PluginAction g_plugin_module_get_action(const GPluginModule *plugin)
* *
******************************************************************************/
-bool g_plugin_module_execute_action_on_binary(const GPluginModule *plugin, openida_binary *binary, PluginAction action)
+bool g_plugin_module_execute_action_on_binary(const GPluginModule *plugin, GOpenidaBinary *binary, PluginAction action)
{
return plugin->exec_on_bin(binary, action);
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index 032f699..ddfb0c6 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -58,7 +58,7 @@ GPluginModule *g_plugin_module_new(const gchar *, GObject *);
PluginAction g_plugin_module_get_action(const GPluginModule *);
/* Exécute une action définie sur un binaire chargé. */
-bool g_plugin_module_execute_action_on_binary(const GPluginModule *, openida_binary *, PluginAction);
+bool g_plugin_module_execute_action_on_binary(const GPluginModule *, GOpenidaBinary *, PluginAction);
diff --git a/src/project.c b/src/project.c
index 1a72bd6..40ddb14 100644
--- a/src/project.c
+++ b/src/project.c
@@ -42,7 +42,7 @@
/* Conservation d'un binaire chargé */
typedef struct _loaded_binary
{
- openida_binary *binary; /* Binaire en question */
+ GOpenidaBinary *binary; /* Binaire en question */
GtkWidget *views[BVW_COUNT]; /* Composants pour l'affichage */
@@ -50,7 +50,7 @@ typedef struct _loaded_binary
/* Met en place un nouveau binaire pour un projet. */
-loaded_binary *load_openida_binary(openida_binary *);
+loaded_binary *load_openida_binary(GOpenidaBinary *);
/* Fournit un support d'affichage donné pour un binaire chargé. */
GtkWidget *get_loaded_binary_view(const loaded_binary *, BinaryView);
@@ -89,7 +89,7 @@ struct openida_project
* *
******************************************************************************/
-loaded_binary *load_openida_binary(openida_binary *binary)
+loaded_binary *load_openida_binary(GOpenidaBinary *binary)
{
loaded_binary *result; /* Structure à renvoyer */
BinaryView i; /* Boucle de parcours */
@@ -115,7 +115,8 @@ loaded_binary *load_openida_binary(openida_binary *binary)
break;
}
- gtk_bin_view_set_rendering_lines(GTK_BIN_VIEW(view), binary, get_openida_binary_lines(binary), NULL);
+ gtk_bin_view_set_rendering_lines(GTK_BIN_VIEW(view), binary,
+ g_openida_binary_get_lines(binary), NULL);
gtk_widget_show(view);
@@ -235,7 +236,7 @@ openida_project *g_openida_project_new_from_xml(const char *filename)
unsigned int i; /* Boucle de parcours */
size_t access_len; /* Taille d'un chemin interne */
char *access; /* Chemin pour une sous-config.*/
- openida_binary *binary; /* Représentation à intégrer */
+ GOpenidaBinary *binary; /* Représentation à intégrer */
if (!open_xml_file(filename, &xdoc, &context)) return NULL;
@@ -253,7 +254,7 @@ openida_project *g_openida_project_new_from_xml(const char *filename)
access = calloc(access_len, sizeof(char));
snprintf(access, access_len, "/OpenIDAProject/Binaries/Binary[position()=%u]", i + 1);
- binary = g_binary_file_new_from_xml(context, access);
+ binary = g_openida_binary_new_from_xml(context, access);
free(access);
@@ -392,7 +393,7 @@ bool has_storing_filename(const openida_project *project)
* *
******************************************************************************/
-void attach_binary_to_openida_project(openida_project *project, openida_binary *binary)
+void attach_binary_to_openida_project(openida_project *project, GOpenidaBinary *binary)
{
project->binaries = (loaded_binary **)realloc(project->binaries,
++project->binaries_count * sizeof(loaded_binary *));
@@ -415,7 +416,7 @@ void attach_binary_to_openida_project(openida_project *project, openida_binary *
* *
******************************************************************************/
-void detach_binary_to_openida_project(openida_project *project, openida_binary *binary)
+void detach_binary_to_openida_project(openida_project *project, GOpenidaBinary *binary)
{
#if 0
size_t i; /* Boucle de parcours */
@@ -424,10 +425,10 @@ void detach_binary_to_openida_project(openida_project *project, openida_binary *
if (project->binaries[i] == binary) break;
if ((i + 1) < project->binaries_count)
- memmove(&project->binaries[i], &project->binaries[i + 1], (project->binaries_count - i - 1) * sizeof(openida_binary *));
+ memmove(&project->binaries[i], &project->binaries[i + 1], (project->binaries_count - i - 1) * sizeof(GOpenidaBinary *));
- project->binaries = (openida_binary **)realloc(project->binaries,
- --project->binaries_count * sizeof(openida_binary *));
+ project->binaries = (GOpenidaBinary **)realloc(project->binaries,
+ --project->binaries_count * sizeof(GOpenidaBinary *));
#endif
}
@@ -447,7 +448,7 @@ void detach_binary_to_openida_project(openida_project *project, openida_binary *
* *
******************************************************************************/
-GtkWidget *get_view_for_openida_project_binary(const openida_project *project, const openida_binary *binary, BinaryView view, GtkBinView **binview)
+GtkWidget *get_view_for_openida_project_binary(const openida_project *project, const GOpenidaBinary *binary, BinaryView view, GtkBinView **binview)
{
GtkWidget *result; /* Composant GTK à retourner */
size_t i; /* Boucle de parcours */
@@ -480,7 +481,7 @@ GtkWidget *get_view_for_openida_project_binary(const openida_project *project, c
* *
******************************************************************************/
-const openida_binary **get_openida_project_binaries(const openida_project *project, size_t *count)
+const GOpenidaBinary **get_openida_project_binaries(const openida_project *project, size_t *count)
{
*count = project->binaries_count;
@@ -620,7 +621,7 @@ void display_openida_project(const openida_project *project, GObject *ref)
{
GtkDockPanel *dpanel; /* Support de panneaux */
size_t i; /* Boucle de parcours */
- openida_binary *binary;
+ GOpenidaBinary *binary;
GtkWidget *view; /* Affichage du code binaire */
GtkDockItem *ditem; /* Panneau avec ses infos. */
GtkBinView *binview; /* Affichage à faire défiler */
@@ -633,7 +634,7 @@ void display_openida_project(const openida_project *project, GObject *ref)
view = get_loaded_binary_view(project->binaries[i], BVW_BLOCK);
- ditem = gtk_dock_item_new(openida_binary_to_string(binary), view);
+ ditem = gtk_dock_item_new(g_openida_binary_to_string(binary), view);
gtk_dock_panel_add_item(dpanel, ditem);
}
@@ -648,7 +649,7 @@ void display_openida_project(const openida_project *project, GObject *ref)
g_object_set_data(ref, "binview", binview);
- reload_symbols_panel_content(get_panel(PNT_SYMBOLS), get_openida_binary_format(binary));
+ reload_symbols_panel_content(get_panel(PNT_SYMBOLS), g_openida_binary_get_format(binary));
}
diff --git a/src/project.h b/src/project.h
index 9142ecb..68ddf16 100644
--- a/src/project.h
+++ b/src/project.h
@@ -76,16 +76,16 @@ bool has_storing_filename(const openida_project *);
/* Attache un fichier donné à un projet donné. */
-void attach_binary_to_openida_project(openida_project *, openida_binary *);
+void attach_binary_to_openida_project(openida_project *, GOpenidaBinary *);
/* Détache un fichier donné à un projet donné. */
-void detach_binary_to_openida_project(openida_project *, openida_binary *);
+void detach_binary_to_openida_project(openida_project *, GOpenidaBinary *);
/* Fournit un support d'affichage donné pour un binaire chargé. */
-GtkWidget *get_view_for_openida_project_binary(const openida_project *, const openida_binary *, BinaryView, GtkBinView **);
+GtkWidget *get_view_for_openida_project_binary(const openida_project *, const GOpenidaBinary *, BinaryView, GtkBinView **);
/* Fournit l'ensemble des binaires associés à un projet. */
-const openida_binary **get_openida_project_binaries(const openida_project *, size_t *);
+const GOpenidaBinary **get_openida_project_binaries(const openida_project *, size_t *);