summaryrefslogtreecommitdiff
path: root/src/panel
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-08-09 18:12:27 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-08-09 18:12:27 (GMT)
commit5cd25c4adfe0426520a51a76de3f77c77cfa4b8e (patch)
tree396514971fb78e81b7bb55c9cd3331d87b45ca9a /src/panel
parentd02deb2425d6559c357bdd00e1c0fb05f35d5fc9 (diff)
Reorganized the way formats are handled (Java and PE got disabled, Dwarf is empty).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@105 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/panel')
-rwxr-xr-xsrc/panel/Makefile.am1
-rw-r--r--src/panel/panels.c2
-rw-r--r--src/panel/panels.h1
-rw-r--r--src/panel/strings.c150
-rw-r--r--src/panel/strings.h44
-rw-r--r--src/panel/symbols.c18
-rw-r--r--src/panel/symbols.h4
7 files changed, 211 insertions, 9 deletions
diff --git a/src/panel/Makefile.am b/src/panel/Makefile.am
index 48f0958..20ea22e 100755
--- a/src/panel/Makefile.am
+++ b/src/panel/Makefile.am
@@ -5,6 +5,7 @@ libpanel_la_SOURCES = \
log.h log.c \
panels.h panels.c \
registers.h registers.c \
+ strings.h strings.c \
symbols.h symbols.c
libpanel_la_LDFLAGS =
diff --git a/src/panel/panels.c b/src/panel/panels.c
index 39adc10..9363578 100644
--- a/src/panel/panels.c
+++ b/src/panel/panels.c
@@ -27,6 +27,7 @@
#include "log.h"
#include "registers.h"
+#include "strings.h"
#include "symbols.h"
@@ -52,6 +53,7 @@ void init_panels(GObject *ref)
panel_list[PNT_LOG] = build_log_panel();
panel_list[PNT_REGISTERS] = build_registers_panel();
panel_list[PNT_SYMBOLS] = build_symbols_panel(ref);
+ panel_list[PNT_STRINGS] = build_strings_panel(ref);
}
diff --git a/src/panel/panels.h b/src/panel/panels.h
index feaa908..4584bba 100644
--- a/src/panel/panels.h
+++ b/src/panel/panels.h
@@ -36,6 +36,7 @@ typedef enum _PanelType
PNT_LOG, /* Messages système */
PNT_REGISTERS, /* Registres d'architecture */
PNT_SYMBOLS, /* Symboles d'exécutable */
+ PNT_STRINGS, /* Chaînes de carac. trouvées */
PNT_COUNT
diff --git a/src/panel/strings.c b/src/panel/strings.c
new file mode 100644
index 0000000..1d09593
--- /dev/null
+++ b/src/panel/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/panel/strings.h b/src/panel/strings.h
new file mode 100644
index 0000000..8227e89
--- /dev/null
+++ b/src/panel/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/panel/symbols.c b/src/panel/symbols.c
index a31cc4b..1908ed0 100644
--- a/src/panel/symbols.c
+++ b/src/panel/symbols.c
@@ -30,6 +30,7 @@
#include "../arch/processor.h"
+#include "../format/format.h"
#include "../gtkext/gtkbinview.h"
@@ -158,10 +159,10 @@ void change_symbols_selection(GtkTreeSelection *selection, gpointer data)
* *
******************************************************************************/
-void reload_symbols_panel_content(GtkWidget *panel, const exe_format *format)
+void reload_symbols_panel_content(GtkWidget *panel, const GExeFormat *format)
{
- GBinRoutine **routines; /* Routines trouvées */
- size_t count; /* Nombre de ces routines */
+ GBinSymbol **symbols; /* Symboles trouvés */
+ size_t count; /* Nombre de ces symboles */
GtkTreeStore *store; /* Modèle de gestion */
GArchProcessor *proc; /* Architecture utilisée */
size_t i; /* Boucle de parcours */
@@ -169,9 +170,9 @@ void reload_symbols_panel_content(GtkWidget *panel, const exe_format *format)
char tmp[19]; /* Version humainement lisible */
GtkTreeIter iter; /* Point d'insertion */
- routines = get_all_exe_routines(format, &count);
+ symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count);
- if (routines != NULL)
+ if (symbols != NULL)
{
store = g_object_get_data(G_OBJECT(panel), "store");
@@ -179,7 +180,10 @@ void reload_symbols_panel_content(GtkWidget *panel, const exe_format *format)
for (i = 0; i < count; i++)
{
- address = g_binary_routine_get_address(routines[i]);
+ if (g_binary_symbol_get_target_type(symbols[i]) == STP_STRING)
+ continue;
+
+ address = g_binary_symbol_get_address(symbols[i]);
switch (g_arch_processor_get_memory_size(proc))
{
@@ -205,7 +209,7 @@ void reload_symbols_panel_content(GtkWidget *panel, const exe_format *format)
gtk_tree_store_append(store, &iter, NULL);
gtk_tree_store_set(store, &iter,
SBC_ADDRESS, tmp,
- SBC_NAME, g_binary_routine_get_name(routines[i]),
+ SBC_NAME, g_binary_symbol_to_string(symbols[i]),
-1);
}
diff --git a/src/panel/symbols.h b/src/panel/symbols.h
index 195bcf2..9761fed 100644
--- a/src/panel/symbols.h
+++ b/src/panel/symbols.h
@@ -29,7 +29,7 @@
#include <gtk/gtk.h>
-#include "../format/exe_format.h"
+#include "../format/executable.h"
@@ -38,7 +38,7 @@ GtkWidget *build_symbols_panel(GObject *);
/* Affiche la liste des symboles présents dans un exécutable. */
-void reload_symbols_panel_content(GtkWidget *, const exe_format *);
+void reload_symbols_panel_content(GtkWidget *, const GExeFormat *);