summaryrefslogtreecommitdiff
path: root/src/panels
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-09-13 23:11:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-09-13 23:11:24 (GMT)
commit1c4da24a1d4b96d58fee08e2be21198b22e7eef6 (patch)
treea0723bd1948395413fa5a7a37a9405567e32c015 /src/panels
parent18134387d5cb025703af8e1d07e0152784e31efc (diff)
Improved the editor window refreshing when several binaries are loaded.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@114 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/panels')
-rwxr-xr-xsrc/panels/Makefile.am22
-rw-r--r--src/panels/glimpse.c131
-rw-r--r--src/panels/glimpse.h60
-rw-r--r--src/panels/log.c220
-rw-r--r--src/panels/log.h56
-rw-r--r--src/panels/panel-int.h70
-rw-r--r--src/panels/panel.c257
-rw-r--r--src/panels/panel.h116
-rw-r--r--src/panels/registers.c236
-rw-r--r--src/panels/registers.h47
-rw-r--r--src/panels/strings.c150
-rw-r--r--src/panels/strings.h44
-rw-r--r--src/panels/symbols.c284
-rw-r--r--src/panels/symbols.h60
14 files changed, 1753 insertions, 0 deletions
diff --git a/src/panels/Makefile.am b/src/panels/Makefile.am
new file mode 100755
index 0000000..2ab4bad
--- /dev/null
+++ b/src/panels/Makefile.am
@@ -0,0 +1,22 @@
+
+noinst_LTLIBRARIES = libpanels.la
+
+libpanels_la_SOURCES = \
+ glimpse.h glimpse.c \
+ log.h log.c \
+ panel-int.h \
+ panel.h panel.c \
+ registers.h registers.c \
+ strings.h strings.c \
+ symbols.h symbols.c
+
+libpanels_la_LDFLAGS =
+
+
+INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
+
+AM_CPPFLAGS =
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+
+SUBDIRS =
diff --git a/src/panels/glimpse.c b/src/panels/glimpse.c
new file mode 100644
index 0000000..c284238
--- /dev/null
+++ b/src/panels/glimpse.c
@@ -0,0 +1,131 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * glimpse.c - panneau d'aperçu de graphiques
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "glimpse.h"
+
+
+#include "panel-int.h"
+
+
+
+
+#define _(str) str
+
+
+
+
+/* Panneau d'aperçu de graphiques (instance) */
+struct _GGlimpsePanel
+{
+ GEditorPanel parent; /* A laisser en premier */
+
+};
+
+
+
+/* Panneau d'aperçu de graphiques (classe) */
+struct _GGlimpsePanelClass
+{
+ GEditorPanelClass parent; /* A laisser en premier */
+
+};
+
+
+
+/* Initialise la classe des panneaux d'aperçu de graphiques. */
+static void g_glimpse_panel_class_init(GGlimpsePanelClass *);
+
+/* Initialise une instance de panneau d'aperçu de graphiques. */
+static void g_glimpse_panel_init(GGlimpsePanel *);
+
+
+
+
+/* Indique le type définit pour un panneau d'aperçu de graphiques. */
+G_DEFINE_TYPE(GGlimpsePanel, g_glimpse_panel, G_TYPE_EDITOR_PANEL);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des panneaux d'aperçu de graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_glimpse_panel_class_init(GGlimpsePanelClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = instance à initialiser. *
+* *
+* Description : Initialise une instance de panneau d'aperçu de graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_glimpse_panel_init(GGlimpsePanel *panel)
+{
+ GEditorPanel *base; /* Version basique d'instance */
+
+ base = G_EDITOR_PANEL(panel);
+
+ base->name = _("Glimpse");
+ base->widget = qck_create_button(NULL, NULL, "test", NULL, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un panneau d'aperçu de graphiques. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GEditorPanel *g_glimpse_panel_new(void)
+{
+ GEditorPanel *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_GLIMPSE_PANEL, NULL);
+
+ return G_EDITOR_PANEL(result);
+
+}
diff --git a/src/panels/glimpse.h b/src/panels/glimpse.h
new file mode 100644
index 0000000..5370569
--- /dev/null
+++ b/src/panels/glimpse.h
@@ -0,0 +1,60 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * glimpse.h - prototypes pour le panneau d'aperçu de graphiques
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PANEL_GLIMPSE_H
+#define _PANEL_GLIMPSE_H
+
+
+#include <glib-object.h>
+
+
+#include "panel.h"
+
+
+
+#define G_TYPE_GLIMPSE_PANEL g_glimpse_panel_get_type()
+#define G_GLIMPSE_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_glimpse_panel_get_type(), GGlimpsePanel))
+#define G_IS_GLIMPSE_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_glimpse_panel_get_type()))
+#define G_GLIMPSE_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_GLIMPSE_PANEL, GGlimpsePanelClass))
+#define G_IS_GLIMPSE_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_GLIMPSE_PANEL))
+#define G_GLIMPSE_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_GLIMPSE_PANEL, GGlimpsePanelClass))
+
+
+/* Panneau d'aperçu de graphiques (instance) */
+typedef struct _GGlimpsePanel GGlimpsePanel;
+
+/* Panneau d'aperçu de graphiques (classe) */
+typedef struct _GGlimpsePanelClass GGlimpsePanelClass;
+
+
+
+/* Indique le type définit pour un panneau d'aperçu de graphiques. */
+GType g_glimpse_panel_get_type(void);
+
+/* Crée un panneau d'aperçu de graphiques. */
+GEditorPanel *g_glimpse_panel_new(void);
+
+
+
+#endif /* _PANEL_GLIMPSE_H */
diff --git a/src/panels/log.c b/src/panels/log.c
new file mode 100644
index 0000000..b13119a
--- /dev/null
+++ b/src/panels/log.c
@@ -0,0 +1,220 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * log.c - panneau d'affichage des messages système
+ *
+ * Copyright (C) 2006-2007 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 "log.h"
+
+
+#include <malloc.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+
+#include "panel.h"
+
+
+
+/* Colonnes de la liste des messages */
+typedef enum _LogColumn
+{
+ LGC_PICTURE, /* Image de représentation */
+ LGC_STRING, /* Chaîne de caractères */
+
+ LGC_COUNT /* Nombre de colonnes */
+
+} LogColumn;
+
+
+#define _(str) str
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit le panneau d'affichage des messages système. *
+* *
+* Retour : Adresse du panneau mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *build_log_panel(void)
+{
+ GtkWidget *result; /* Panneau à retourner */
+ GtkTreeStore *store; /* Modèle de gestion */
+ GtkWidget *treeview; /* Affichage de la liste */
+ GtkCellRenderer *renderer; /* Moteur de rendu de colonne */
+ GtkTreeViewColumn *column; /* Colonne de la liste */
+
+ result = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(result);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN);
+
+ store = gtk_tree_store_new(LGC_COUNT, G_TYPE_STRING, G_TYPE_STRING);
+ g_object_set_data(G_OBJECT(result), "store", store);
+
+ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
+ gtk_widget_show(treeview);
+ gtk_container_add(GTK_CONTAINER(result), treeview);
+
+ g_object_unref(G_OBJECT(store));
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_visible(column, FALSE);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+ gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column);
+
+ column = gtk_tree_view_column_new();
+
+ renderer = gtk_cell_renderer_pixbuf_new();
+ gtk_tree_view_column_pack_start(column, renderer, FALSE);
+ gtk_tree_view_column_add_attribute(column, renderer, "stock-id", LGC_PICTURE);
+
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_column_pack_start(column, renderer, TRUE);
+ gtk_tree_view_column_add_attribute(column, renderer, "text", LGC_STRING);
+
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = espèce du message à ajouter. *
+* msg = message à faire apparaître à l'écran. *
+* *
+* Description : Affiche un message dans le journal des messages système. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void log_simple_message(LogMessageType type, const char *msg)
+{
+ GtkWidget *panel; /* Panneau à traiter */
+ GtkTreeStore *store; /* Modèle de gestion */
+ GtkTreeIter iter; /* Point d'insertion */
+
+ panel = get_panel(PNT_LOG);
+ store = g_object_get_data(G_OBJECT(panel), "store");
+
+ gtk_tree_store_append(store, &iter, NULL);
+
+ switch (type)
+ {
+ case LMT_INFO:
+ gtk_tree_store_set(store, &iter,
+ LGC_PICTURE, "gtk-info",
+ LGC_STRING, msg,
+ -1);
+ break;
+
+ case LMT_BAD_BINARY:
+ gtk_tree_store_set(store, &iter,
+ LGC_PICTURE, "gtk-dialog-warning",
+ LGC_STRING, msg,
+ -1);
+ break;
+
+ case LMT_PROCESS:
+ gtk_tree_store_set(store, &iter,
+ LGC_PICTURE, "gtk-execute",
+ LGC_STRING, msg,
+ -1);
+ break;
+
+ default:
+ gtk_tree_store_set(store, &iter,
+ LGC_STRING, msg,
+ -1);
+ break;
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = espèce du message à ajouter. *
+* fmt = format du message à faire apparaître à l'écran. *
+* ... = éventuels arguments venant compléter le message. *
+* *
+* Description : Affiche un message dans le journal des messages système. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void log_variadic_message(LogMessageType type, const char *fmt, ...)
+{
+ size_t len; /* Taille tampon disponible */
+ char *buffer; /* Tampon du msg reconstitué */
+ int ret; /* Bilan d'une impression */
+ char *ptr; /* Nouvelle allocation */
+ va_list ap; /* Liste d'arguments variable */
+
+ len = 100;
+ buffer = calloc(len, sizeof(char));
+
+ while (buffer != NULL)
+ {
+ va_start(ap, fmt);
+ ret = vsnprintf(buffer, len, fmt, ap);
+ va_end(ap);
+
+ if (ret >= 0 && ret < len) break;
+
+ else
+ {
+ if (ret > -1) len += 1; /* glibc 2.1 */
+ else len *= 2; /* glibc 2.0 */
+
+ if ((ptr = realloc(buffer, len)) == NULL)
+ {
+ free(buffer);
+ buffer = NULL;
+ }
+ else buffer = ptr;
+
+ }
+
+ }
+
+ log_simple_message(type, buffer);
+
+ free(buffer);
+
+}
diff --git a/src/panels/log.h b/src/panels/log.h
new file mode 100644
index 0000000..5ea95cc
--- /dev/null
+++ b/src/panels/log.h
@@ -0,0 +1,56 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * log.h - prototypes pour le panneau d'affichage des messages système
+ *
+ * Copyright (C) 2006-2007 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 _PANEL_LOG_H
+#define _PANEL_LOG_H
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Type de messages disponibles */
+typedef enum _LogMessageType
+{
+ LMT_INFO, /* Information sur l'exécution */
+ LMT_BAD_BINARY, /* Binaire malformé */
+ LMT_PROCESS, /* Début de tâche quelconque */
+
+ LMT_COUNT
+
+} LogMessageType;
+
+
+/* Construit le panneau d'affichage des messages système. */
+GtkWidget *build_log_panel(void);
+
+/* Affiche un message dans le journal des messages système. */
+void log_simple_message(LogMessageType, const char *);
+
+/* Affiche un message dans le journal des messages système. */
+void log_variadic_message(LogMessageType, const char *, ...);
+
+
+
+#endif /* _PANEL_LOG_H */
diff --git a/src/panels/panel-int.h b/src/panels/panel-int.h
new file mode 100644
index 0000000..417665f
--- /dev/null
+++ b/src/panels/panel-int.h
@@ -0,0 +1,70 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * panels.h - prototypes pour les définitions internes liées aux panneaux
+ *
+ * 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PANEL_PANELS_INT_H
+#define _PANEL_PANELS_INT_H
+
+
+#include "panel.h"
+
+
+
+#include "../common/dllist.h"
+
+
+
+/* Réagit à un changement d'affichage principal de contenu. */
+typedef void (* reload_for_new_view_fc) (GEditorPanel *, GtkBinView *, bool);
+
+
+/* Panneaux à présenter dans l'éditeur (instance) */
+struct _GEditorPanel
+{
+ GObject parent; /* A laisser en premier */
+
+ DL_LIST_ITEM(link); /* Maillon de liste chaînée */
+
+ const char *name; /* Nom du panneau */
+
+ reload_for_new_view_fc reload_view; /* Rechargement dû à une vue */
+
+ GtkWidget *widget; /* Composant GTK d'affichage */
+
+};
+
+
+#define panels_list_add_tail(new, head) dl_list_add_tail(new, head, GEditorPanel, link)
+#define panels_list_for_each(pos, head) dl_list_for_each(pos, head, GEditorPanel, link)
+
+
+/* Panneaux à présenter dans l'éditeur (classe) */
+struct _GEditorPanelClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+
+#endif /* _PANEL_PANELS_INT_H */
diff --git a/src/panels/panel.c b/src/panels/panel.c
new file mode 100644
index 0000000..6258de8
--- /dev/null
+++ b/src/panels/panel.c
@@ -0,0 +1,257 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * panels.h - gestion des différents panneaux
+ *
+ * Copyright (C) 2006-2007 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 "panel.h"
+
+
+#include "glimpse.h"
+#include "panel-int.h"
+#include "symbols.h"
+#include "../gtkext/gtkdockpanel.h"
+
+
+
+
+
+/* Initialise la classe des panneaux d'éditeur. */
+static void g_editor_panel_class_init(GEditorPanelClass *);
+
+/* Initialise une instance de panneau d'éditeur. */
+static void g_editor_panel_init(GEditorPanel *);
+
+
+/* -------------- */
+
+
+static GEditorPanel *panels_list = NULL;
+
+
+
+
+/* Indique le type défini pour un panneau d'éditeur. */
+G_DEFINE_TYPE(GEditorPanel, g_editor_panel, G_TYPE_OBJECT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des panneaux d'éditeur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_editor_panel_class_init(GEditorPanelClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = instance à initialiser. *
+* *
+* Description : Initialise une instance de panneau d'éditeur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_editor_panel_init(GEditorPanel *panel)
+{
+ DL_LIST_ITEM_INIT(&panel->link);
+
+}
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = espace de référencements global. *
+* binary = nouveau binaire actif. *
+* *
+* Description : Répercute sur les panneaux un nouveau binaire actif. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void change_current_binary_in_panels(GObject *ref, GOpenidaBinary *binary)
+{
+
+
+}
+
+
+
+
+
+
+
+
+/* -------------- */
+/* -------------- */
+/* -------------- */
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Procède au chargement de tous les panneaux internes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void init_internal_panels(void)
+{
+ GEditorPanel *panel; /* Nouveau panneau chargé */
+
+ panel = g_symbols_panel_new();
+ panels_list_add_tail(panel, &panels_list);
+
+ panel = g_glimpse_panel_new();
+ panels_list_add_tail(panel, &panels_list);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : top = espace courant d'affichage principal. *
+* *
+* Description : Incruste tous les panneaux dans la fenêtre de l'éditeur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void place_all_panels_in_editor(GtkWidget *top)
+{
+ GEditorPanel *iter; /* Boucle de parcours */
+ GtkDockItem *ditem; /* Panneau avec ses infos. */
+
+ panels_list_for_each(iter, panels_list)
+ {
+ ditem = gtk_dock_item_new(iter->name, iter->widget);
+ gtk_dock_panel_add_item(GTK_DOCK_PANEL(top), ditem);
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : view = nouvelle visualisation de désassemblage. *
+* same = changement de binaire ou de vue ? *
+* *
+* Description : Lance une actualisation du fait d'un changement de vue. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void notify_panels_of_view_change(GtkBinView *view, bool same)
+{
+ GEditorPanel *iter; /* Boucle de parcours */
+
+ panels_list_for_each(iter, panels_list)
+ if (iter->reload_view != NULL)
+ iter->reload_view(iter, view, same);
+
+}
+
+
+
+
+
+
+
+#include "log.h"
+#include "registers.h"
+#include "strings.h"
+
+
+
+static GtkWidget *panel_list[PNT_COUNT];
+
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = espace de référencements global. *
+* *
+* Description : Procède au chargement de tous les panneaux. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void init_panels(GObject *ref)
+{
+ panel_list[PNT_LOG] = build_log_panel();
+ panel_list[PNT_REGISTERS] = build_registers_panel();
+ panel_list[PNT_STRINGS] = build_strings_panel(ref);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : id = identifiant du panneau visé. *
+* *
+* Description : Fournit la référence d'un panneau donné. *
+* *
+* Retour : Adresse du composant GTK en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *get_panel(PanelType id)
+{
+ return (id < PNT_COUNT ? panel_list[id] : NULL);
+
+}
diff --git a/src/panels/panel.h b/src/panels/panel.h
new file mode 100644
index 0000000..1a94ebc
--- /dev/null
+++ b/src/panels/panel.h
@@ -0,0 +1,116 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * panels.h - prototypes pour la gestion des différents panneaux
+ *
+ * Copyright (C) 2006-2007 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 _PANEL_PANELS_H
+#define _PANEL_PANELS_H
+
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+
+
+#include "../analysis/binary.h"
+#include "../gtkext/gtkbinview.h"
+
+
+
+
+
+
+
+
+#define G_TYPE_EDITOR_PANEL g_editor_panel_get_type()
+#define G_EDITOR_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_editor_panel_get_type(), GEditorPanel))
+#define G_IS_EDITOR_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_editor_panel_get_type()))
+#define G_EDITOR_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_EDITOR_PANEL, GEditorPanelClass))
+#define G_IS_EDITOR_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_EDITOR_PANEL))
+#define G_EDITOR_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_EDITOR_PANEL, GEditorPanelClass))
+
+
+/* Panneaux à présenter dans l'éditeur (instance) */
+typedef struct _GEditorPanel GEditorPanel;
+
+/* Panneaux à présenter dans l'éditeur (classe) */
+typedef struct _GEditorPanelClass GEditorPanelClass;
+
+
+
+/* Indique le type défini pour un panneau d'éditeur. */
+GType g_editor_panel_get_type(void);
+
+
+
+
+
+/* Répercute sur les panneaux un nouveau binaire actif. */
+void change_current_binary_in_panels(GObject *, GOpenidaBinary *);
+
+
+
+
+
+/* Procède au chargement de tous les panneaux internes. */
+void init_internal_panels(void);
+
+/* Incruste tous les panneaux dans la fenêtre de l'éditeur. */
+void place_all_panels_in_editor(GtkWidget *);
+
+/* Lance une actualisation du fait d'un changement de vue. */
+void notify_panels_of_view_change(GtkBinView *, bool);
+
+
+
+
+
+
+
+
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Liste de tous les panneaux */
+typedef enum _PanelType
+{
+ PNT_LOG, /* Messages système */
+ PNT_REGISTERS, /* Registres d'architecture */
+ PNT_STRINGS, /* Chaînes de carac. trouvées */
+ PNT_GLIMPSE, /* Aperçu d'un graphique */
+
+ PNT_COUNT
+
+} PanelType;
+
+
+/* Procède au chargement de tous les panneaux. */
+void init_panels(GObject *);
+
+/* Fournit la référence d'un panneau donné. */
+GtkWidget *get_panel(PanelType);
+
+
+
+#endif /* _PANEL_PANELS_H */
diff --git a/src/panels/registers.c b/src/panels/registers.c
new file mode 100644
index 0000000..1f9c8e5
--- /dev/null
+++ b/src/panels/registers.c
@@ -0,0 +1,236 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * registers.c - panneau d'affichage des registres d'architecture
+ *
+ * Copyright (C) 2006-2007 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 "registers.h"
+
+
+#include "../gtkext/easygtk.h"
+
+
+
+#define _(str) str
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit le panneau d'affichage des registres. *
+* *
+* Retour : Adresse du panneau mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *build_registers_panel(void)
+{
+ GtkWidget *result; /* Panneau à retourner */
+
+
+ GtkWidget *vbox1;
+ GtkWidget *label1;
+ GtkWidget *table1;
+ GtkWidget *label3;
+ GtkWidget *label4;
+ GtkWidget *label5;
+ GtkWidget *label6;
+ GtkWidget *label7;
+ GtkWidget *label8;
+ GtkWidget *label9;
+ GtkWidget *label10;
+ GtkWidget *label11;
+ GtkWidget *label12;
+ GtkWidget *label13;
+ GtkWidget *label14;
+ GtkWidget *label15;
+ GtkWidget *label16;
+ GtkWidget *entry1;
+ GtkWidget *entry2;
+ GtkWidget *entry3;
+ GtkWidget *entry4;
+ GtkWidget *entry6;
+ GtkWidget *entry5;
+ GtkWidget *entry7;
+ GtkWidget *label2;
+
+ GtkWidget *label; /* Etiquette textuelle */
+ GtkWidget *alignment; /* Décallage de contenu */
+ GtkWidget *entry; /* Zone de saisie */
+
+
+
+ result = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(result);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN);
+
+
+
+
+ vbox1 = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox1);
+ gtk_container_add (GTK_CONTAINER (result), vbox1);
+
+ label1 = gtk_label_new (_("Registers:"));
+ gtk_widget_show (label1);
+ gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);
+ gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
+
+
+ alignment = qck_create_padded_alignment(0, 0, 8, 0);
+ gtk_box_pack_start(GTK_BOX(vbox1), alignment, FALSE, TRUE, 0);
+
+ table1 = gtk_table_new(7, 3, FALSE);
+ gtk_widget_show(table1);
+ gtk_container_add(GTK_CONTAINER(alignment), table1);
+
+ label = qck_create_label(NULL, NULL, "eax: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "eax", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "ebx: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "ebx", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "ecx: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "ecx", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "edx: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "edx", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 3, 4, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "esi: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 4, 5, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "esi", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 4, 5, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "edi: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 5, 6, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "edi", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 5, 6, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "ebp: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 6, 7, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "ebp", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 6, 7, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "esp: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 7, 8, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "esp", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 7, 8, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "eip: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 8, 9, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "eip", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 8, 9, GTK_FILL, 0, 0, 0);
+
+
+
+
+ label2 = gtk_label_new (_("Segments:"));
+ gtk_widget_show (label2);
+ gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0);
+ gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
+
+
+
+
+ return result;
+
+}
+
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = panneau contenant les champs utiles. *
+* values = liste des registres avec leur valeur. *
+* count = taille de cette liste. *
+* *
+* Description : Met à jour l'affichage des valeurs de registre. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void refresh_registers_panel_with_registers(GtkWidget *panel, register_value *values, size_t count)
+{
+ GObject *ref; /* Espace de référencement */
+ size_t i; /* Boucle de parcours */
+ GtkEntry *entry; /* Zone de texte */
+ char buffer[32];
+
+ ref = G_OBJECT(panel);
+
+ for (i = 0; i < count; i++)
+ {
+ entry = GTK_ENTRY(g_object_get_data(ref, values[i].name));
+ if (entry == NULL) continue;
+
+ snprintf(buffer, 32, "%08llx", values[i].value);
+
+ gtk_entry_set_text(entry, buffer);
+
+
+
+
+
+ }
+
+
+
+}
diff --git a/src/panels/registers.h b/src/panels/registers.h
new file mode 100644
index 0000000..7110414
--- /dev/null
+++ b/src/panels/registers.h
@@ -0,0 +1,47 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * registers.h - prototypes pour le panneau d'affichage des registres d'architecture
+ *
+ * Copyright (C) 2006-2007 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 _PANEL_REGISTERS_H
+#define _PANEL_REGISTERS_H
+
+
+#include <gtk/gtk.h>
+
+
+#include "../debug/debuggers.h"
+
+
+
+/* Construit le panneau d'affichage des registres. */
+GtkWidget *build_registers_panel(void);
+
+
+
+/* Met à jour l'affichage des valeurs de registre. */
+void refresh_registers_panel_with_registers(GtkWidget *, register_value *, size_t);
+
+
+
+
+#endif /* _PANEL_REGISTERS_H */
diff --git a/src/panels/strings.c b/src/panels/strings.c
new file mode 100644
index 0000000..1d09593
--- /dev/null
+++ b/src/panels/strings.c
@@ -0,0 +1,150 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * strings.c - panneau d'affichage des chaînes de caractères
+ *
+ * Copyright (C) 2006-2007 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 "strings.h"
+
+
+#include "../format/format.h"
+
+
+
+/* Colonnes de la liste des symboles */
+typedef enum _StringsColumn
+{
+ STC_ADDRESS, /* Adresse mémoire du symbole */
+ STC_STRING, /* Désignation humaine */
+
+ STC_COUNT /* Nombre de colonnes */
+
+} StringsColumn;
+
+
+#define _(str) str
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = adresse de l'espace de référencements. *
+* *
+* Description : Construit le panneau d'affichage des symboles. *
+* *
+* Retour : Adresse du panneau mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *build_strings_panel(GObject *ref)
+{
+ GtkWidget *result; /* Panneau à retourner */
+ GtkTreeStore *store; /* Modèle de gestion */
+ GtkWidget *treeview; /* Affichage de la liste */
+ GtkCellRenderer *renderer; /* Moteur de rendu de colonne */
+ GtkTreeViewColumn *column; /* Colonne de la liste */
+ GtkTreeSelection *select; /* Sélection dans la liste */
+
+ result = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(result);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN);
+
+ store = gtk_tree_store_new(STC_COUNT, G_TYPE_STRING, G_TYPE_STRING);
+ g_object_set_data(G_OBJECT(result), "store", store);
+
+ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+ gtk_widget_show(treeview);
+ gtk_container_add(GTK_CONTAINER(result), treeview);
+
+ g_object_unref(G_OBJECT(store));
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+ gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Address"), renderer, "text", STC_ADDRESS, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("String"), renderer, "text", STC_STRING, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+
+ /*
+ select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+ gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
+ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(change_symbols_selection), ref);
+ */
+
+
+
+ return result;
+
+}
+
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = panneau à mettre à jour. *
+* format = données sur l'exécutable à représenter. *
+* *
+* Description : Affiche la liste des symboles présents dans un exécutable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void handle_new_exe_on_strings_panel(GtkWidget *panel, const GExeFormat *format)
+{
+ GtkTreeStore *store; /* Modèle de gestion */
+ size_t count; /* Nombre des chaînes */
+ GBinSymbol **symbols; /* Liste des chaînes trouvées */
+ size_t i; /* Boucle de parcours */
+ char address[11]; /* Conversion de l'adresse */
+ GtkTreeIter iter; /* Point d'insertion */
+
+ store = g_object_get_data(G_OBJECT(panel), "store");
+
+ symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count);
+
+ for (i = 0; i < count; i++)
+ {
+ if (g_binary_symbol_get_target_type(symbols[i]) != STP_STRING) continue;
+
+ /* FIXME : adresses autres que 32 bits */
+ snprintf(address, 11, "0x%08llx", g_binary_symbol_get_address(symbols[i]));
+
+ gtk_tree_store_append(store, &iter, NULL);
+ gtk_tree_store_set(store, &iter,
+ STC_ADDRESS, address,
+ STC_STRING, g_binary_symbol_to_string(symbols[i]),
+ -1);
+
+ }
+
+}
diff --git a/src/panels/strings.h b/src/panels/strings.h
new file mode 100644
index 0000000..8227e89
--- /dev/null
+++ b/src/panels/strings.h
@@ -0,0 +1,44 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * strings.h - prototypes pour le panneau d'affichage des chaînes de caractères
+ *
+ * Copyright (C) 2006-2007 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 _PANEL_STRINGS_H
+#define _PANEL_STRINGS_H
+
+
+#include <gtk/gtk.h>
+
+
+#include "../format/executable.h"
+
+
+
+/* Construit le panneau d'affichage des symboles. */
+GtkWidget *build_strings_panel(GObject *);
+
+/* Affiche la liste des symboles présents dans un exécutable. */
+void handle_new_exe_on_strings_panel(GtkWidget *, const GExeFormat *);
+
+
+
+#endif /* _PANEL_STRINGS_H */
diff --git a/src/panels/symbols.c b/src/panels/symbols.c
new file mode 100644
index 0000000..c7c8369
--- /dev/null
+++ b/src/panels/symbols.c
@@ -0,0 +1,284 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * symbols.c - panneau d'affichage des symboles
+ *
+ * Copyright (C) 2006-2007 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 "symbols.h"
+
+
+#include <gtk/gtk.h>
+
+
+#include "panel-int.h"
+#include "../format/format.h"
+
+
+
+#define _(str) str
+
+
+
+
+/* Panneau d'aperçu de graphiques (instance) */
+struct _GSymbolsPanel
+{
+ GEditorPanel parent; /* A laisser en premier */
+
+ GtkTreeStore *store; /* Modèle de gestion */
+
+ GtkBinView *binview; /* Affichage à faire défiler */
+
+};
+
+
+
+/* Panneau d'aperçu de graphiques (classe) */
+struct _GSymbolsPanelClass
+{
+ GEditorPanelClass parent; /* A laisser en premier */
+
+};
+
+
+/* Colonnes de la liste des symboles */
+typedef enum _SymbolsColumn
+{
+ SBC_ADDRESS, /* Adresse mémoire du symbole */
+ SBC_NAME, /* Désignation humaine */
+
+ SBC_COUNT /* Nombre de colonnes */
+
+} SymbolsColumn;
+
+
+
+/* Initialise la classe des panneaux d'aperçu de graphiques. */
+static void g_symbols_panel_class_init(GSymbolsPanelClass *);
+
+/* Initialise une instance de panneau d'aperçu de graphiques. */
+static void g_symbols_panel_init(GSymbolsPanel *);
+
+/* Réagit au changement de sélection des symboles. */
+static void on_symbols_selection_change(GtkTreeSelection *, GSymbolsPanel *);
+
+/* Réagit à un changement d'affichage principal de contenu. */
+static void reload_symbols_for_new_view(GSymbolsPanel *, GtkBinView *, bool);
+
+
+
+/* Indique le type définit pour un panneau d'aperçu de graphiques. */
+G_DEFINE_TYPE(GSymbolsPanel, g_symbols_panel, G_TYPE_EDITOR_PANEL);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des panneaux d'aperçu de graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_symbols_panel_class_init(GSymbolsPanelClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = instance à initialiser. *
+* *
+* Description : Initialise une instance de panneau d'aperçu de graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_symbols_panel_init(GSymbolsPanel *panel)
+{
+ GEditorPanel *base; /* Version basique d'instance */
+ GtkWidget *treeview; /* Affichage de la liste */
+ GtkCellRenderer *renderer; /* Moteur de rendu de colonne */
+ GtkTreeViewColumn *column; /* Colonne de la liste */
+ GtkTreeSelection *select; /* Sélection dans la liste */
+
+ base = G_EDITOR_PANEL(panel);
+
+ base->name = _("Symbols");
+ base->reload_view = (reload_for_new_view_fc)reload_symbols_for_new_view;
+
+ base->widget = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(base->widget);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(base->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(base->widget), GTK_SHADOW_IN);
+
+ panel->store = gtk_tree_store_new(SBC_COUNT, G_TYPE_STRING, G_TYPE_STRING);
+
+ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(panel->store));
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
+ gtk_widget_show(treeview);
+ gtk_container_add(GTK_CONTAINER(base->widget), treeview);
+
+ g_object_unref(G_OBJECT(panel->store));
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_visible(column, FALSE);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+ gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Address", renderer, "text", SBC_ADDRESS, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", SBC_NAME, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+ gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
+ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(on_symbols_selection_change), panel);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un panneau d'aperçu de graphiques. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GEditorPanel *g_symbols_panel_new(void)
+{
+ GEditorPanel *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SYMBOLS_PANEL, NULL);
+
+ return G_EDITOR_PANEL(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : selection = sélection modifiée. *
+* panel = structure contenant les informations maîtresses. *
+* *
+* Description : Réagit au changement de sélection des symboles. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPanel *panel)
+{
+ GtkTreeIter iter; /* Point de sélection */
+ GtkTreeModel *model; /* Modèle de gestion */
+ gchar *string; /* Chaîne sélectionnée */
+ vmpa_t address; /* Adresse à rejoindre */
+
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ {
+ gtk_tree_model_get(model, &iter, SBC_ADDRESS, &string, -1);
+ address = strtoll(string, NULL, 16); /* FIXME */
+ g_free(string);
+
+ gtk_bin_view_scroll_to_address(panel->binview, address);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = panneau à mettre à jour. *
+* view = nouvelle visualisation de désassemblage. *
+* same = changement de binaire ou de vue ? *
+* *
+* Description : Réagit à un changement d'affichage principal de contenu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void reload_symbols_for_new_view(GSymbolsPanel *panel, GtkBinView *view, bool same)
+{
+ GOpenidaBinary *binary; /* Binaire en cours d'édition */
+ GExeFormat *format; /* Format associé au binaire */
+ GBinSymbol **symbols; /* Symboles trouvés */
+ size_t count; /* Nombre de ces symboles */
+ GArchProcessor *proc; /* Architecture utilisée */
+ size_t i; /* Boucle de parcours */
+ vmpa_t address; /* Adresse associée au symbole */
+ char tmp[VMPA_MAX_SIZE]; /* Version humainement lisible */
+ GtkTreeIter iter; /* Point d'insertion */
+
+ panel->binview = view;
+
+ if (same) return;
+
+ gtk_tree_store_clear(panel->store);
+
+ binary = gtk_bin_view_get_binary(view);
+ format = g_openida_binary_get_format(binary);
+ symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count);
+
+ if (symbols != NULL)
+ {
+ proc = get_arch_processor_from_format(format);
+
+ for (i = 0; i < count; i++)
+ {
+ if (g_binary_symbol_get_target_type(symbols[i]) == STP_STRING)
+ continue;
+
+ address = g_binary_symbol_get_address(symbols[i]);
+ vmpa_to_string(address, g_arch_processor_get_memory_size(proc), tmp);
+
+ gtk_tree_store_append(panel->store, &iter, NULL);
+ gtk_tree_store_set(panel->store, &iter,
+ SBC_ADDRESS, tmp,
+ SBC_NAME, g_binary_symbol_to_string(symbols[i]),
+ -1);
+
+ }
+
+ }
+
+}
diff --git a/src/panels/symbols.h b/src/panels/symbols.h
new file mode 100644
index 0000000..7978b30
--- /dev/null
+++ b/src/panels/symbols.h
@@ -0,0 +1,60 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * pan_symbols.h - prototypes pour le panneau d'affichage des symboles
+ *
+ * Copyright (C) 2006-2007 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 _PAN_SYMBOLS_H
+#define _PAN_SYMBOLS_H
+
+
+#include <glib-object.h>
+
+
+#include "panel.h"
+
+
+
+#define G_TYPE_SYMBOLS_PANEL g_symbols_panel_get_type()
+#define G_SYMBOLS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_symbols_panel_get_type(), GSymbolsPanel))
+#define G_IS_SYMBOLS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_symbols_panel_get_type()))
+#define G_SYMBOLS_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SYMBOLS_PANEL, GSymbolsPanelClass))
+#define G_IS_SYMBOLS_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SYMBOLS_PANEL))
+#define G_SYMBOLS_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SYMBOLS_PANEL, GSymbolsPanelClass))
+
+
+/* Panneau d'affichage des symboles (instance) */
+typedef struct _GSymbolsPanel GSymbolsPanel;
+
+/* Panneau d'affichage des symboles (classe) */
+typedef struct _GSymbolsPanelClass GSymbolsPanelClass;
+
+
+
+/* Indique le type définit pour un panneau d'affichage des symboles. */
+GType g_symbols_panel_get_type(void);
+
+/* Crée un panneau d'affichage des symboles. */
+GEditorPanel *g_symbols_panel_new(void);
+
+
+
+#endif /* _PAN_SYMBOLS_H */