summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog31
-rw-r--r--src/Makefile.am4
-rw-r--r--src/binary.c4
-rw-r--r--src/binary.h2
-rw-r--r--src/editor.c21
-rw-r--r--src/format/elf/e_elf.c39
-rw-r--r--src/format/elf/e_elf.h6
-rw-r--r--src/format/exe_format-int.h5
-rw-r--r--src/format/exe_format.c22
-rw-r--r--src/format/exe_format.h10
-rw-r--r--src/gtkcodeview.c167
-rw-r--r--src/gtkcodeview.h60
-rw-r--r--src/gtksnippet.c37
-rw-r--r--src/gtksnippet.h6
-rw-r--r--src/pan_symbols.c206
-rw-r--r--src/pan_symbols.h45
16 files changed, 656 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 3516c02..4cdf2d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2008-09-06 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/binary.c:
+ * src/binary.h:
+ Display found symbols when loading binary data.
+
+ * src/editor.c:
+ Use the new GTK components.
+
+ * src/format/elf/e_elf.c:
+ * src/format/elf/e_elf.h:
+ * src/format/exe_format.c:
+ * src/format/exe_format.h:
+ * src/format/exe_format-int.h:
+ Provide the needed functions to access the found symbols.
+
+ * src/gtkcodeview.c:
+ * src/gtkcodeview.h:
+ New entries: provide a support for code snippets.
+
+ * src/gtksnippet.c:
+ * src/gtksnippet.h:
+ Give the vertical position of a given address.
+
+ * src/Makefile.am:
+ Add gtkcodeview.[ch] and pan_symbols.[ch] to openida_SOURCES.
+
+ * src/pan_symbols.c:
+ * src/pan_symbols.h:
+ New entries: add a panel allowing to browse found symbols.
+
2008-08-31 Cyrille Bagard <nocbos@gmail.com>
* src/binary.c:
diff --git a/src/Makefile.am b/src/Makefile.am
index f2a0558..603ba36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,9 @@ bin_PROGRAMS=openida
openida_SOURCES = \
binary.h binary.c \
editor.c \
- gtksnippet.h gtksnippet.c
+ gtksnippet.h gtksnippet.c \
+ gtkcodeview.h gtkcodeview.c \
+ pan_symbols.h pan_symbols.c
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/intl $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) `pkg-config --cflags gthread-2.0`
diff --git a/src/binary.c b/src/binary.c
index b7ee15a..0737d90 100644
--- a/src/binary.c
+++ b/src/binary.c
@@ -113,7 +113,7 @@ uint8_t *map_binary_file(const char *filename, size_t *length)
-void fill_snippet(GtkSnippet *snippet)
+void fill_snippet(GtkSnippet *snippet, GtkWidget *panel)
{
off_t length;
uint8_t *bin_data;
@@ -255,5 +255,7 @@ void fill_snippet(GtkSnippet *snippet)
*/
+ handle_new_exe_on_symbols_panel(panel, format);
+
}
diff --git a/src/binary.h b/src/binary.h
index a6295c9..d2dacc5 100644
--- a/src/binary.h
+++ b/src/binary.h
@@ -30,7 +30,7 @@
-void fill_snippet(GtkSnippet *snippet);
+void fill_snippet(GtkSnippet *snippet, GtkWidget *panel);
diff --git a/src/editor.c b/src/editor.c
index 460108e..dbdc2d3 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -51,6 +51,8 @@
#include "binary.h"
#include "gtksnippet.h"
+#include "gtkcodeview.h"
+#include "pan_symbols.h"
#define _(str) str
@@ -387,6 +389,9 @@ GtkWidget *create_editor(void)
GtkWidget *textview1;
GtkWidget *statusbar1;
+ GtkWidget *codeview;
+
+ GtkWidget *panel;
#if 0
GtkWidget *vbox; /* Support à divisions vert. */
@@ -431,19 +436,28 @@ GtkWidget *create_editor(void)
gtk_paned_pack1 (GTK_PANED (hpaned1), scrolledwindow2, FALSE, TRUE);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_SHADOW_IN);
+ codeview = gtk_codeview_new();
+ g_object_set_data(G_OBJECT(result), "codeview", codeview);
+ //gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow2), codeview);
+ gtk_container_add(GTK_CONTAINER(scrolledwindow2), codeview);
+
textview2 = gtk_snippet_new();
+ gtk_widget_show(codeview);
gtk_snippet_set_sel(GTK_SNIPPET(textview2), 44);
- fill_snippet(textview2);
/*
textview2 = gtk_text_view_new ();
*/
gtk_widget_show (textview2);
/*gtk_container_add (GTK_CONTAINER (scrolledwindow2), textview2);*/
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow2), textview2);
+ //gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow2), textview2);
+
+ gtk_container_add(GTK_CONTAINER(codeview), textview2);
fixed1 = gtk_fixed_new ();
gtk_widget_show (fixed1);
- gtk_paned_pack2 (GTK_PANED (hpaned1), fixed1, TRUE, TRUE);
+ //gtk_paned_pack2 (GTK_PANED (hpaned1), fixed1, TRUE, TRUE);
+ panel = build_symbols_panel(G_OBJECT(result));
+ gtk_paned_pack2 (GTK_PANED (hpaned1), panel, TRUE, TRUE);
label1 = gtk_label_new (_("Registres :"));
gtk_widget_show (label1);
@@ -642,6 +656,7 @@ GtkWidget *create_editor(void)
+ fill_snippet(textview2, panel);
return result;
diff --git a/src/format/elf/e_elf.c b/src/format/elf/e_elf.c
index a6399ab..0493df8 100644
--- a/src/format/elf/e_elf.c
+++ b/src/format/elf/e_elf.c
@@ -59,6 +59,7 @@ elf_format *load_elf(const uint8_t *content, off_t length)
EXE_FORMAT(result)->length = length;
EXE_FORMAT(result)->find_section = (find_section_fc)find_elf_section;
+ EXE_FORMAT(result)->get_symbols = (get_symbols_fc)get_elf_symbols;
memcpy(&result->header, content, sizeof(Elf32_Ehdr));
@@ -75,3 +76,41 @@ elf_format *load_elf(const uint8_t *content, off_t length)
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* labels = liste des commentaires à insérer. [OUT] *
+* types = type des symboles listés. [OUT] *
+* offsets = liste des indices des commentaires. [OUT] *
+* *
+* Description : Récupère tous les symboles présents dans le contenu binaire. *
+* *
+* Retour : Nombre d'éléments mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+size_t get_elf_symbols(const elf_format *format, char ***labels, SymbolType **types, uint64_t **offsets)
+{
+ size_t result; /* Quantité à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = format->sym_count;
+
+ *labels = (char **)calloc(result, sizeof(char *));
+ *types = (SymbolType *)calloc(result, sizeof(SymbolType));
+ *offsets = (uint64_t *)calloc(result, sizeof(uint64_t));
+
+ for (i = 0; i < format->sym_count; i++)
+ {
+ (*labels)[i] = strdup(format->symbols[i].name);
+ (*types)[i] = STP_SECTION;
+ (*offsets)[i] = format->symbols[i].address;
+ }
+
+ return result;
+
+}
diff --git a/src/format/elf/e_elf.h b/src/format/elf/e_elf.h
index fabee77..d4bf39b 100644
--- a/src/format/elf/e_elf.h
+++ b/src/format/elf/e_elf.h
@@ -30,6 +30,9 @@
#include <sys/types.h>
+#include "../exe_format.h"
+
+
/* Description du format ELF */
typedef struct _elf_format elf_format;
@@ -39,7 +42,8 @@ typedef struct _elf_format elf_format;
/* Prend en charge un nouvel ELF. */
elf_format *load_elf(const uint8_t *, off_t);
-
+/* Récupère tous les symboles présents dans le contenu binaire. */
+size_t get_elf_symbols(const elf_format *, char ***, SymbolType **, uint64_t **);
diff --git a/src/format/exe_format-int.h b/src/format/exe_format-int.h
index a8333de..b437087 100644
--- a/src/format/exe_format-int.h
+++ b/src/format/exe_format-int.h
@@ -32,6 +32,10 @@
/* Recherche une section donnée au sein de binaire. */
typedef bool (* find_section_fc) (const exe_format *, const char *, off_t *, off_t *, uint64_t *);
+/* Récupère tous les symboles présents dans le contenu binaire. */
+typedef size_t (* get_symbols_fc) (const exe_format *, char ***, SymbolType **, uint64_t **);
+
+
/* Support générique d'un format d'exécutable */
@@ -41,6 +45,7 @@ struct _exe_format
off_t length; /* Taille de ce contenu */
find_section_fc find_section; /* Recherche d'une section */
+ get_symbols_fc get_symbols; /* Liste des symboles présents */
};
diff --git a/src/format/exe_format.c b/src/format/exe_format.c
index 48a4d4c..5cbaba5 100644
--- a/src/format/exe_format.c
+++ b/src/format/exe_format.c
@@ -51,3 +51,25 @@ bool find_exe_section(const exe_format *format, const char *target, off_t *offse
return format->find_section(format, target, offset, size, voffset);
}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* labels = liste des commentaires à insérer. [OUT] *
+* types = type des symboles listés. [OUT] *
+* offsets = liste des indices des commentaires. [OUT] *
+* *
+* Description : Récupère tous les symboles présents dans le contenu binaire. *
+* *
+* Retour : Nombre d'éléments mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+size_t get_exe_symbols(const exe_format *format, char ***labels, SymbolType **types, uint64_t **offsets)
+{
+ return format->get_symbols(format, labels, types, offsets);
+
+}
diff --git a/src/format/exe_format.h b/src/format/exe_format.h
index 0ec727b..3dab5a7 100644
--- a/src/format/exe_format.h
+++ b/src/format/exe_format.h
@@ -35,11 +35,21 @@
typedef struct _exe_format exe_format;
+/* Types de symbole */
+typedef enum _SymbolType
+{
+ STP_SECTION /* Simple morceau de code */
+
+} SymbolType;
+
/* Recherche une section donnée au sein de binaire. */
bool find_exe_section(const exe_format *, const char *, off_t *, off_t *, uint64_t *);
+/* Récupère tous les symboles présents dans le contenu binaire. */
+size_t get_exe_symbols(const exe_format *, char ***, SymbolType **, uint64_t **);
+
diff --git a/src/gtkcodeview.c b/src/gtkcodeview.c
new file mode 100644
index 0000000..1062aaf
--- /dev/null
+++ b/src/gtkcodeview.c
@@ -0,0 +1,167 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkcodeview.c - affichage d'un ou de plusieurs morceaux de code
+ *
+ * Copyright (C) 2008 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 "gtkcodeview.h"
+
+
+#include "gtksnippet.h"
+
+
+
+
+
+struct _GtkCodeview
+{
+ GtkViewport viewport;
+
+};
+
+struct _GtkCodeviewClass
+{
+ GtkViewportClass parent_class;
+
+};
+
+
+
+
+/* Détermine le type du composant d'affichage des morceaux. */
+G_DEFINE_TYPE(GtkCodeview, gtk_codeview, GTK_TYPE_VIEWPORT)
+
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : class = classe GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'afficheur de morceaux. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_codeview_class_init(GtkCodeviewClass *class)
+{
+ GtkWidgetClass *widget_class; /* Classe de haut niveau */
+ GtkViewportClass *viewport_class; /* Classe du niveau supérieur */
+
+ widget_class = GTK_WIDGET_CLASS(class);
+ viewport_class = GTK_VIEWPORT_CLASS(class);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : codeview = composant GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'afficheur de morceaux. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_codeview_init(GtkCodeview *codeview)
+{
+
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un nouveau composant pour l'affichage de morceaux. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget* gtk_codeview_new(void)
+{
+ return g_object_new(GTK_TYPE_CODE_VIEW, NULL);
+
+}
+
+
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : codeview = composant GTK à manipuler. *
+* address = adresse à présenter à l'écran. *
+* *
+* Description : S'assure qu'une adresse donnée est visible à l'écran. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_codeview_scroll_to_address(GtkCodeview *codeview, uint64_t address)
+{
+ GList *list; /* Ensemble des enfants */
+ GList *iter; /* Boucle de parcours */
+ GtkSnippet *snippet; /* Morceau de code présent */
+ gint position; /* Position à garantir */
+ GtkAdjustment *vadj; /* Défilement à mettre à jour */
+
+ list = gtk_container_get_children(GTK_CONTAINER(codeview));
+
+ for (iter = g_list_first(list); iter != NULL; iter = g_list_next(iter))
+ {
+ snippet = GTK_SNIPPET(iter->data);
+
+ if (gtk_snippet_get_address_vposition(snippet, address, &position))
+ {
+ vadj = GTK_VIEWPORT(codeview)->vadjustment;
+
+ gtk_adjustment_set_value(vadj, position);
+
+ break;
+
+ }
+
+ }
+
+ g_list_free(list);
+
+}
+
+
+
diff --git a/src/gtkcodeview.h b/src/gtkcodeview.h
new file mode 100644
index 0000000..18bec6e
--- /dev/null
+++ b/src/gtkcodeview.h
@@ -0,0 +1,60 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkcodeview.h - prototypes pour l'affichage d'un ou de plusieurs morceaux de code
+ *
+ * Copyright (C) 2008 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 _GTK_CODEVIEW_H
+#define _GTK_CODEVIEW_H
+
+
+#include <gtk/gtk.h>
+
+
+#include <stdint.h>
+
+
+
+#define GTK_TYPE_CODE_VIEW (gtk_codeview_get_type())
+#define GTK_CODE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CODE_VIEW, GtkCodeview))
+#define GTK_CODE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CODE_VIEW, GtkCodeviewClass))
+#define GTK_IS_CODE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CODE_VIEW))
+#define GTK_IS_CODE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CODE_VIEW))
+#define GTK_CODE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CODE_VIEW, GtkCodeviewClass))
+
+
+typedef struct _GtkCodeview GtkCodeview;
+typedef struct _GtkCodeviewClass GtkCodeviewClass;
+
+
+
+/* Détermine le type du composant d'affichage des morceaux. */
+GType gtk_codeview_get_type(void);
+
+/* Crée un nouveau composant pour l'affichage de morceaux. */
+GtkWidget* gtk_codeview_new(void);
+
+
+/* S'assure qu'une adresse donnée est visible à l'écran. */
+void gtk_codeview_scroll_to_address(GtkCodeview *, uint64_t);
+
+
+
+#endif /* _GTK_CODEVIEW_H */
diff --git a/src/gtksnippet.c b/src/gtksnippet.c
index 7e5e012..73339fd 100644
--- a/src/gtksnippet.c
+++ b/src/gtksnippet.c
@@ -1,6 +1,6 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
- * gtksnippet.h - affichage d'un fragment de code d'assemblage
+ * gtksnippet.c - affichage d'un fragment de code d'assemblage
*
* Copyright (C) 2008 Cyrille Bagard
*
@@ -609,3 +609,38 @@ void gtk_snippet_build_content(GtkSnippet *snippet)
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : snippet = composant GTK à consulter. *
+* address = adresse à présenter à l'écran. *
+* position = position verticale au sein du composant. [OUT] *
+* *
+* Description : Indique la position verticale d'une adresse donnée. *
+* *
+* Retour : TRUE si l'adresse fait partie du composant, FALSE sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+gboolean gtk_snippet_get_address_vposition(GtkSnippet *snippet, uint64_t address, gint *position)
+{
+ unsigned int i; /* Boucle de parcours */
+
+ *position = 0;
+
+ for (i = 0; i < snippet->info_count; i++)
+ {
+ if (snippet->info[i].offset == address) break;
+ else *position += snippet->line_height;
+ }
+
+ return (i < snippet->info_count);
+
+}
+
diff --git a/src/gtksnippet.h b/src/gtksnippet.h
index 6e89a3c..a90e89c 100644
--- a/src/gtksnippet.h
+++ b/src/gtksnippet.h
@@ -1,6 +1,6 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
- * format_elf.h - prototypes pour l'affichage d'un fragment de code d'assemblage
+ * gtksnippet.h - prototypes pour l'affichage d'un fragment de code d'assemblage
*
* Copyright (C) 2008 Cyrille Bagard
*
@@ -133,6 +133,10 @@ void gtk_snippet_build_content(GtkSnippet *);
+/* Indique la position verticale d'une adresse donnée. */
+gboolean gtk_snippet_get_address_vposition(GtkSnippet *, uint64_t, gint *);
+
+
G_END_DECLS
diff --git a/src/pan_symbols.c b/src/pan_symbols.c
new file mode 100644
index 0000000..c2e7788
--- /dev/null
+++ b/src/pan_symbols.c
@@ -0,0 +1,206 @@
+
+/* OpenIDA - Outils de configurations pour le WM Firebox
+ * pan_symmbols.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 "pan_symbols.h"
+
+
+#include <malloc.h>
+#include <stdlib.h>
+
+
+#include "gtkcodeview.h"
+
+
+
+/* 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;
+
+
+/* Réagit au changement de sélection des symboles. */
+void change_symbols_selection(GtkTreeSelection *, gpointer);
+
+
+
+
+/******************************************************************************
+* *
+* 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_symbols_panel(GObject *ref)
+{
+ GtkWidget *result; /* Pnneau à 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(SBC_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);
+
+ 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(change_symbols_selection), ref);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : selection = sélection modifiée. *
+* data = adresse de l'espace de référencements. *
+* *
+* Description : Réagit au changement de sélection des symboles. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void change_symbols_selection(GtkTreeSelection *selection, gpointer data)
+{
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ gchar *string; /* Chaîne sélectionnée */
+ uint64_t address; /* Adresse à rejoindre */
+ GtkCodeview *codeview; /* Affichage à faire défiler */
+
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ {
+ gtk_tree_model_get(model, &iter, SBC_ADDRESS, &string, -1);
+ address = strtoll(string, NULL, 16);
+ g_free(string);
+
+ codeview = GTK_CODE_VIEW(g_object_get_data(G_OBJECT(data), "codeview"));
+
+ gtk_codeview_scroll_to_address(codeview, address);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* 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_symbols_panel(GtkWidget *panel, const exe_format *format)
+{
+ GtkTreeStore *store; /* Modèle de gestion */
+ GtkTreeIter iter; /* Point d'insertion */
+ char **labels; /* Etiquettes humaines */
+ SymbolType *types; /* Type des symboles listés */
+ uint64_t *offsets; /* Emplacements de mémoire */
+ size_t count; /* Nombre des symboles */
+ size_t i; /* Boucle de parcours */
+ char address[11];
+
+ store = g_object_get_data(G_OBJECT(panel), "store");
+
+ count = get_exe_symbols(format, &labels, &types, &offsets);
+
+ if (count > 0)
+ {
+ for (i = 0; i < count; i++)
+ {
+
+
+ snprintf(address, 11, "0x%08llx", offsets[i]);
+
+
+ gtk_tree_store_append(store, &iter, NULL);
+ gtk_tree_store_set(store, &iter,
+ SBC_ADDRESS, address,
+ SBC_NAME, labels[i],
+ -1);
+
+
+ }
+
+ free(labels);
+ free(types);
+ free(offsets);
+
+ }
+
+
+
+
+}
+
+
diff --git a/src/pan_symbols.h b/src/pan_symbols.h
new file mode 100644
index 0000000..1fd1ee6
--- /dev/null
+++ b/src/pan_symbols.h
@@ -0,0 +1,45 @@
+
+/* OpenIDA - Outils de configurations pour le WM Firebox
+ * pan_symmbols.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 <gtk/gtk.h>
+
+
+#include "format/exe_format.h"
+
+
+
+/* Construit le panneau d'affichage des symboles. */
+GtkWidget *build_symbols_panel(GObject *);
+
+
+/* Affiche la liste des symboles présents dans un exécutable. */
+void handle_new_exe_on_symbols_panel(GtkWidget *, const exe_format *);
+
+
+
+#endif /* _PAN_SYMBOLS_H */