summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-09-04 21:28:31 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-09-04 21:28:31 (GMT)
commitfc7a3dfb87fba9ae031cb52fa5951e00c409b07e (patch)
tree45109fdeec00ba9c4555018c5694b0877dcbc6e3 /src
parent04ca0756d59629113bd3f602565850a2910ac84e (diff)
Updated the code and displayed the symbols using all symbols, not only routines.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@398 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src')
-rw-r--r--src/arch/vmpa.c20
-rw-r--r--src/gui/panels/bookmarks.c4
-rw-r--r--src/gui/panels/regedit.c7
-rw-r--r--src/gui/panels/symbols.c408
4 files changed, 228 insertions, 211 deletions
diff --git a/src/arch/vmpa.c b/src/arch/vmpa.c
index aa97eba..c3cf17e 100644
--- a/src/arch/vmpa.c
+++ b/src/arch/vmpa.c
@@ -352,23 +352,23 @@ char *vmpa2_phys_to_string(const vmpa2t *addr, MemoryDataSize msize, char buffer
switch (msize)
{
case MDS_8_BITS:
- ret = snprintf(buffer, VMPA_MAX_SIZE,"0x%02" PRIx64, addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN,"0x%02" PRIx64, addr->physical);
break;
case MDS_16_BITS:
- ret = snprintf(buffer, VMPA_MAX_SIZE, "0x%04" PRIx64, addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%04" PRIx64, addr->physical);
break;
case MDS_32_BITS:
- ret = snprintf(buffer, VMPA_MAX_SIZE, "0x%08" PRIx64, addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%08" PRIx64, addr->physical);
break;
case MDS_64_BITS:
- ret = snprintf(buffer, VMPA_MAX_SIZE, "0x%016" PRIx64, addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%016" PRIx64, addr->physical);
break;
default:
- ret = snprintf(buffer, VMPA_MAX_SIZE, "0x%" PRIx64, addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%" PRIx64, addr->physical);
break;
}
@@ -403,23 +403,23 @@ char *vmpa2_virt_to_string(const vmpa2t *addr, MemoryDataSize msize, char buffer
switch (msize)
{
case MDS_8_BITS:
- ret = snprintf(buffer, VMPA_MAX_SIZE,"0x%02" PRIx64, addr->virtual);
+ ret = snprintf(buffer, VMPA_MAX_LEN,"0x%02" PRIx64, addr->virtual);
break;
case MDS_16_BITS:
- ret = snprintf(buffer, VMPA_MAX_SIZE, "0x%04" PRIx64, addr->virtual);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%04" PRIx64, addr->virtual);
break;
case MDS_32_BITS:
- ret = snprintf(buffer, VMPA_MAX_SIZE, "0x%08" PRIx64, addr->virtual);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%08" PRIx64, addr->virtual);
break;
case MDS_64_BITS:
- ret = snprintf(buffer, VMPA_MAX_SIZE, "0x%016" PRIx64, addr->virtual);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%016" PRIx64, addr->virtual);
break;
default:
- ret = snprintf(buffer, VMPA_MAX_SIZE, "0x%" PRIx64, addr->virtual);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%" PRIx64, addr->virtual);
break;
}
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index a61f6bc..56e7119 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -26,13 +26,13 @@
#include <assert.h>
+#include <cairo-gobject.h>
#include <malloc.h>
#include <regex.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <cairo-gobject.h>
#include <gtk/gtk.h>
@@ -201,7 +201,7 @@ static void g_bookmarks_panel_class_init(GBookmarksPanelClass *klass)
editem->update_binary = (update_item_binary_fc)reload_bookmarks_into_treeview;
filename = find_pixmap_file("bookmark.png");
- /* assert(filename != NULL); */
+ assert(filename != NULL);
klass->bookmark_img = cairo_image_surface_create_from_png(filename);
diff --git a/src/gui/panels/regedit.c b/src/gui/panels/regedit.c
index 159a4d0..3819e64 100644
--- a/src/gui/panels/regedit.c
+++ b/src/gui/panels/regedit.c
@@ -358,7 +358,10 @@ static void g_regedit_panel_dispose(GRegeditPanel *panel)
static void g_regedit_panel_finalize(GRegeditPanel *panel)
{
if (panel->filter != NULL)
+ {
regfree(panel->filter);
+ free(panel->filter);
+ }
G_OBJECT_CLASS(g_regedit_panel_parent_class)->finalize(G_OBJECT(panel));
@@ -794,8 +797,8 @@ static void on_param_value_edited(GtkCellRendererText *renderer, gchar *path, gc
/******************************************************************************
* *
-* Paramètres : entry = entrée de texte contenant le filtre brut. *
-* panel = panneau assurant l'affichage des paramètres. *
+* Paramètres : entry = entrée de texte contenant le filtre brut. *
+* panel = panneau assurant l'affichage des paramètres. *
* *
* Description : Démarre l'actualisation du filtrage des paramètres. *
* *
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index 40a135c..4f92f1c 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -28,6 +28,8 @@
#include <i18n.h>
+#include <assert.h>
+#include <cairo-gobject.h>
#include <malloc.h>
#include <regex.h>
#include <string.h>
@@ -63,16 +65,22 @@ struct _GSymbolsPanelClass
{
GPanelItemClass parent; /* A laisser en premier */
+ cairo_surface_t *routine_img; /* Image pour les routines */
+ cairo_surface_t *package_img; /* Image pour les paquets */
+ cairo_surface_t *class_img; /* Image pour les classes */
+
};
/* Colonnes de la liste des symboles */
typedef enum _SymbolsColumn
{
- SBC_ADDRESS, /* Adresse mémoire du symbole */
+ SBC_SYMBOL, /* Symbole représenté */
- SBC_ICON, /* Image de représentation */
+ SBC_PICTURE, /* Image de représentation */
SBC_NAME, /* Désignation humaine */
+ SBC_ADDRESS, /* Adresse mémoire du symbole */
+ SBC_SECTION, /* Section d'appartenance */
SBC_EXPAND, /* Affichage des classes */
@@ -116,10 +124,11 @@ static void reload_symbols_for_new_list_view(GSymbolsPanel *);
/* S'assure qu'un noeud donné existe bien. */
+#if 0
static GtkTreeIter ensure_symbol_node_exist(GtkTreeStore *, GtkTreeIter *, const char *);
-
+#endif
/* Détermine le point d'insertion parent d'une routine. */
-static bool find_parent_for_routine(GtkTreeStore *, const GBinRoutine *, GtkTreeIter *);
+static bool find_parent_for_symbol(GtkTreeStore *, const GBinSymbol *, GtkTreeIter *);
/* Réagit à un changement d'affichage principal de contenu. */
static void reload_symbols_for_new_tree_view(GSymbolsPanel *);
@@ -136,16 +145,13 @@ static gboolean show_all_classes_in_tree_view(GtkTreeModel *, GtkTreePath *, Gtk
/* Démarre l'actualisation du filtrage des symboles. */
-static gboolean filter_symbols_from_key_press(GtkEntry *, GdkEventKey *, GSymbolsPanel *);
-
-/* Démarre l'actualisation du filtrage des symboles. */
-static void filter_symbols_from_icons(GtkEntry *, GtkEntryIconPosition, GdkEventButton *, GSymbolsPanel *);
+static void on_symbols_filter_changed(GtkSearchEntry *, GSymbolsPanel *);
/* Exécute un nouveau filtrage des symboles affichés. */
-static void do_filtering_on_symbols(GSymbolsPanel *, GtkEntry *);
+static void do_filtering_on_symbols(GSymbolsPanel *);
/* Détermine si un nom de symbole doit être filtré ou non. */
-static bool is_symbol_filtered(GSymbolsPanel *, const char *);
+static bool is_symbol_filtered(GSymbolsPanel *, const GBinSymbol *);
@@ -174,6 +180,7 @@ static void g_symbols_panel_class_init(GSymbolsPanelClass *klass)
{
GObjectClass *object; /* Autre version de la classe */
GEditorItemClass *editem; /* Encore une autre vision... */
+ gchar *filename; /* Chemin d'accès à utiliser */
object = G_OBJECT_CLASS(klass);
@@ -184,6 +191,27 @@ static void g_symbols_panel_class_init(GSymbolsPanelClass *klass)
editem->update_binary = (update_item_binary_fc)change_symbols_panel_current_binary;
+ filename = find_pixmap_file("symbol_routine_classic.png");
+ assert(filename != NULL);
+
+ klass->routine_img = cairo_image_surface_create_from_png(filename);
+
+ g_free(filename);
+
+ filename = find_pixmap_file("symbol_package.png");
+ assert(filename != NULL);
+
+ klass->package_img = cairo_image_surface_create_from_png(filename);
+
+ g_free(filename);
+
+ filename = find_pixmap_file("symbol_class_classic.png");
+ assert(filename != NULL);
+
+ klass->class_img = cairo_image_surface_create_from_png(filename);
+
+ g_free(filename);
+
}
@@ -207,7 +235,7 @@ static void g_symbols_panel_init(GSymbolsPanel *panel)
GtkWidget *toolbar; /* Barre d'outils */
GtkWidget *button; /* Bouton de cette même barre */
GtkWidget *separator; /* Barre de séparation vert. */
- GtkWidget *entry; /* Zone de recherche */
+ GtkWidget *search; /* Zone de recherche */
GtkWidget *scrollwnd; /* Support défilant */
GtkWidget *treeview; /* Affichage de la liste */
GtkCellRenderer *renderer; /* Moteur de rendu de colonne */
@@ -271,17 +299,14 @@ static void g_symbols_panel_init(GSymbolsPanel *panel)
/* Espace de recherche */
- entry = qck_create_entry(ref, "search", "");
- gtk_widget_set_tooltip_text(entry, _("Filter symbols using POSIX extended regular expressions"));
-
- gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_FIND);
+ search = gtk_search_entry_new();
+ gtk_widget_set_tooltip_text(search, _("Filter symbols using POSIX extended regular expressions"));
- g_signal_connect(G_OBJECT(entry), "key-press-event",
- G_CALLBACK(filter_symbols_from_key_press), panel);
- g_signal_connect(G_OBJECT(entry), "icon-press",
- G_CALLBACK(filter_symbols_from_icons), panel);
+ g_signal_connect(search, "search-changed", G_CALLBACK(on_symbols_filter_changed), panel);
+ gtk_widget_show(search);
+ gtk_widget_set_hexpand(search, TRUE);
- gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(box), search, TRUE, TRUE, 0);
/* Liste arborescente ou linéaire */
@@ -292,7 +317,8 @@ static void g_symbols_panel_init(GSymbolsPanel *panel)
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwnd), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwnd), GTK_SHADOW_IN);
- panel->store = gtk_tree_store_new(SBC_COUNT, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN);
+ panel->store = gtk_tree_store_new(SBC_COUNT, G_TYPE_OBJECT, CAIRO_GOBJECT_TYPE_SURFACE, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(panel->store));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
@@ -306,33 +332,36 @@ static void g_symbols_panel_init(GSymbolsPanel *panel)
g_object_unref(G_OBJECT(panel->store));
- /*
- column = gtk_tree_view_column_new();
- gtk_tree_view_column_set_visible(column, FALSE);
+ /* Cellules d'affichage */
+
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes("", renderer,
+ "surface", SBC_PICTURE,
+ NULL);
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);
- //gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column);
-
- column = gtk_tree_view_column_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer,
+ "text", SBC_NAME,
+ NULL);
+ gtk_tree_view_column_set_sort_column_id(column, SBC_NAME);
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_pixbuf_new();
- //column = gtk_tree_view_column_new_with_attributes("Icon", renderer, "pixbuf", SBC_ICON, NULL);
- gtk_tree_view_column_pack_start(column, renderer, FALSE);
- gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", SBC_ICON);
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Address"), renderer,
+ "text", SBC_ADDRESS,
+ NULL);
+ gtk_tree_view_column_set_sort_column_id(column, SBC_ADDRESS);
+ 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_column_pack_end(column, renderer, TRUE);
- gtk_tree_view_column_add_attribute(column, renderer, "text", SBC_NAME);
- //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_with_attributes(_("Section"), renderer,
+ "text", SBC_SECTION,
+ NULL);
+ gtk_tree_view_column_set_sort_column_id(column, SBC_SECTION);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ /* Prise en compte de la sélection */
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
@@ -377,6 +406,12 @@ static void g_symbols_panel_dispose(GSymbolsPanel *panel)
static void g_symbols_panel_finalize(GSymbolsPanel *panel)
{
+ if (panel->filter != NULL)
+ {
+ regfree(panel->filter);
+ free(panel->filter);
+ }
+
G_OBJECT_CLASS(g_symbols_panel_parent_class)->finalize(G_OBJECT(panel));
}
@@ -517,22 +552,20 @@ static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPan
{
GtkTreeIter iter; /* Point de sélection */
GtkTreeModel *model; /* Modèle de gestion */
- gchar *string; /* Chaîne sélectionnée */
- vmpa_t address; /* Adresse à rejoindre */
+ GBinSymbol *symbol; /* Symbole à traiter */
+ const vmpa2t *addr; /* Localisation dudit symbole */
+ GtkViewPanel *vpanel; /* Afficheur effectif de code */
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
- gtk_tree_model_get(model, &iter, SBC_ADDRESS, &string, -1);
+ gtk_tree_model_get(model, &iter, SBC_SYMBOL, &symbol, -1);
- if (string != NULL)
- {
- address = strtoll(string, NULL, 16);
- g_free(string);
+ addr = g_binary_symbol_get_location(symbol, NULL);
- gtk_view_panel_scroll_to_address(g_editor_item_get_current_view(G_EDITOR_ITEM(panel)),
- address);
+ vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ gtk_view_panel_scroll_to_address(vpanel, addr);
- }
+ g_object_unref(G_OBJECT(symbol));
}
@@ -602,45 +635,51 @@ static void change_symbols_panel_current_binary(GSymbolsPanel *panel, GLoadedBin
static void reload_symbols_for_new_list_view(GSymbolsPanel *panel)
{
GExeFormat *format; /* Format associé au binaire */
- GBinRoutine **routines; /* Liste des routines trouvées */
- size_t routines_count; /* Nombre de ces routines */
GArchProcessor *proc; /* Architecture utilisée */
+ GBinSymbol **symbols; /* Symboles à représenter */
+ size_t sym_count; /* Qté de symboles présents */
+ MemoryDataSize size; /* Taille des localisations */
size_t i; /* Boucle de parcours */
- const char *name; /* Désignation du symbole */
- vmpa_t address; /* Adresse associée au symbole */
- char tmp[VMPA_MAX_SIZE]; /* Version humainement lisible */
- GdkPixbuf *pixbuf; /* Icone pour l'élément inséré */
+ cairo_surface_t *icon; /* Image associée au symbole */
+ const vmpa2t *addr; /* Localisation d'un symbole */
+ char virt[VMPA_MAX_LEN]; /* Version humainement lisible */
GtkTreeIter iter; /* Point d'insertion */
format = g_loaded_binary_get_format(panel->binary);
+ proc = get_arch_processor_from_format(format);
+
+ symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &sym_count);
- routines = g_binary_format_get_routines(G_BIN_FORMAT(format), &routines_count);
- qsort(routines, routines_count, sizeof(GBinRoutine *), (__compar_fn_t)g_binary_routine_rcompare);
+ size = g_arch_processor_get_memory_size(proc);
- if (routines != NULL)
+ for (i = 0; i < sym_count; i++)
{
- proc = get_arch_processor_from_format(format);
+ if (is_symbol_filtered(panel, symbols[i]))
+ continue;
- for (i = 0; i < routines_count; i++)
+ switch (g_binary_symbol_get_target_type(symbols[i]))
{
- name = g_binary_routine_to_string(routines[i]);
-
- if (is_symbol_filtered(panel, name))
- continue;
-
- address = g_binary_routine_get_address(routines[i]);
- vmpa_to_string(address, g_arch_processor_get_memory_size(proc), tmp);
-
- pixbuf = get_pixbuf_from_file("symbol_routine_classic.png");
+ case STP_ROUTINE:
+ icon = G_SYMBOLS_PANEL_GET_CLASS(panel)->routine_img;
+ break;
+ case STP_OBJECT:
+ icon = G_SYMBOLS_PANEL_GET_CLASS(panel)->routine_img; /* FIXME */
+ break;
+ default:
+ assert(false);
+ break;
+ }
- gtk_tree_store_append(panel->store, &iter, NULL);
- gtk_tree_store_set(panel->store, &iter,
- SBC_ICON, pixbuf,
- SBC_ADDRESS, tmp,
- SBC_NAME, name,
- -1);
+ addr = g_binary_symbol_get_location(symbols[i], NULL);
+ vmpa2_virt_to_string(addr, size, virt, NULL);
- }
+ gtk_tree_store_append(panel->store, &iter, NULL);
+ gtk_tree_store_set(panel->store, &iter,
+ SBC_SYMBOL, symbols[i],
+ SBC_PICTURE, icon,
+ SBC_NAME, g_binary_symbol_to_string(symbols[i]),
+ SBC_ADDRESS, virt,
+ -1);
}
@@ -666,13 +705,13 @@ static void reload_symbols_for_new_list_view(GSymbolsPanel *panel)
* Remarques : - *
* *
******************************************************************************/
-
+#if 0
static GtkTreeIter ensure_symbol_node_exist(GtkTreeStore *store, GtkTreeIter *parent, const char *name)
{
bool found; /* Bilan des recherches */
GtkTreeIter iter; /* Boucle de parcours */
gchar *string; /* Chaîne sélectionnée */
- GdkPixbuf *pixbuf; /* Icone pour l'élément inséré */
+ cairo_surface_t *icon; /* Image associée au symbole */
found = false;
@@ -690,26 +729,23 @@ static GtkTreeIter ensure_symbol_node_exist(GtkTreeStore *store, GtkTreeIter *pa
if (!found)
{
- pixbuf = get_pixbuf_from_file("symbol_package.png");
-
gtk_tree_store_append(store, &iter, parent);
gtk_tree_store_set(store, &iter,
- SBC_ICON, pixbuf,
+ SBC_PICTURE, G_SYMBOLS_PANEL_GET_CLASS(panel)->package_img,
SBC_NAME, name,
-1);
-
}
return iter;
}
-
+#endif
/******************************************************************************
* *
-* Paramètres : store = gestion des différents éléments insérés. *
-* routine = routine à intégrer. *
-* parent = point d'insertion parent à constituer. *
+* Paramètres : store = gestion des différents éléments insérés. *
+* symbol = routine ou objet à intégrer. *
+* parent = point d'insertion parent à constituer. *
* *
* Description : Détermine le point d'insertion parent d'une routine. *
* *
@@ -719,8 +755,9 @@ static GtkTreeIter ensure_symbol_node_exist(GtkTreeStore *store, GtkTreeIter *pa
* *
******************************************************************************/
-static bool find_parent_for_routine(GtkTreeStore *store, const GBinRoutine *routine, GtkTreeIter *parent)
+static bool find_parent_for_symbol(GtkTreeStore *store, const GBinSymbol *symbol, GtkTreeIter *parent)
{
+#if 0
GDataType *namespace; /* Espace d'appartenance */
char *string; /* Conversion en chaîne */
char *iter; /* Boucle de parcours */
@@ -742,6 +779,9 @@ static bool find_parent_for_routine(GtkTreeStore *store, const GBinRoutine *rout
}
return true;
+#endif
+
+ return false;
}
@@ -761,65 +801,65 @@ static bool find_parent_for_routine(GtkTreeStore *store, const GBinRoutine *rout
static void reload_symbols_for_new_tree_view(GSymbolsPanel *panel)
{
GExeFormat *format; /* Format associé au binaire */
- GBinRoutine **routines; /* Liste des routines trouvées */
- size_t routines_count; /* Nombre de ces routines */
GArchProcessor *proc; /* Architecture utilisée */
+ GBinSymbol **symbols; /* Symboles à représenter */
+ size_t sym_count; /* Qté de symboles présents */
+ MemoryDataSize size; /* Taille des localisations */
size_t i; /* Boucle de parcours */
- const char *name; /* Désignation du symbole */
- vmpa_t address; /* Adresse associée au symbole */
- char tmp[VMPA_MAX_SIZE]; /* Version humainement lisible */
GtkTreeIter parent; /* Point d'insertion parent */
+ cairo_surface_t *icon; /* Image associée au symbole */
+ const vmpa2t *addr; /* Localisation d'un symbole */
+ char virt[VMPA_MAX_LEN]; /* Version humainement lisible */
GtkTreeIter iter; /* Point d'insertion */
- GdkPixbuf *pixbuf; /* Icone pour l'élément inséré */
format = g_loaded_binary_get_format(panel->binary);
+ proc = get_arch_processor_from_format(format);
+
+ symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &sym_count);
- routines = g_binary_format_get_routines(G_BIN_FORMAT(format), &routines_count);
- qsort(routines, routines_count, sizeof(GBinRoutine *), (__compar_fn_t)g_binary_routine_rcompare);
+ size = g_arch_processor_get_memory_size(proc);
- if (routines != NULL)
+ for (i = 0; i < sym_count; i++)
{
- proc = get_arch_processor_from_format(format);
+ if (is_symbol_filtered(panel, symbols[i]))
+ continue;
- for (i = 0; i < routines_count; i++)
+ if (find_parent_for_symbol(panel->store, symbols[i], &parent))
{
- name = g_binary_routine_to_string(routines[i]);
-
- if (is_symbol_filtered(panel, name))
- continue;
-
- address = g_binary_routine_get_address(routines[i]);
- vmpa_to_string(address, g_arch_processor_get_memory_size(proc), tmp);
-
- if (find_parent_for_routine(panel->store, routines[i], &parent))
- {
- pixbuf = get_pixbuf_from_file("symbol_class_classic.png");
-
- gtk_tree_store_set(panel->store, &parent,
- SBC_ICON, pixbuf,
- SBC_EXPAND, TRUE,
- -1);
-
- gtk_tree_store_append(panel->store, &iter, &parent);
-
- }
- else
- gtk_tree_store_append(panel->store, &iter, NULL);
-
- pixbuf = get_pixbuf_from_file("symbol_routine_classic.png");
-
- gtk_tree_store_set(panel->store, &iter,
- SBC_ICON, pixbuf,
- SBC_ADDRESS, tmp,
- SBC_NAME, name,
+ gtk_tree_store_set(panel->store, &parent,
+ SBC_PICTURE, G_SYMBOLS_PANEL_GET_CLASS(panel)->class_img,
+ SBC_EXPAND, TRUE,
-1);
- if (pixbuf != NULL)
- g_object_unref(G_OBJECT(pixbuf));
+ gtk_tree_store_append(panel->store, &iter, &parent);
+ }
+ else
+ gtk_tree_store_append(panel->store, &iter, NULL);
+ switch (g_binary_symbol_get_target_type(symbols[i]))
+ {
+ case STP_ROUTINE:
+ icon = G_SYMBOLS_PANEL_GET_CLASS(panel)->routine_img;
+ break;
+ case STP_OBJECT:
+ icon = G_SYMBOLS_PANEL_GET_CLASS(panel)->routine_img; /* FIXME */
+ break;
+ default:
+ assert(false);
+ break;
}
+ addr = g_binary_symbol_get_location(symbols[i], NULL);
+ vmpa2_virt_to_string(addr, size, virt, NULL);
+
+ gtk_tree_store_set(panel->store, &iter,
+ SBC_SYMBOL, symbols[i],
+ SBC_PICTURE, icon,
+ SBC_NAME, g_binary_symbol_to_string(symbols[i]),
+ SBC_ADDRESS, virt,
+ -1);
+
}
}
@@ -904,40 +944,8 @@ static gboolean show_all_classes_in_tree_view(GtkTreeModel *model, GtkTreePath *
/******************************************************************************
* *
-* Paramètres : entry = entrée de texte contenant le filtre brut. *
-* event = informations liées à l'événement. *
-* panel = panneau assurant l'affichage des symboles. *
-* *
-* Description : Démarre l'actualisation du filtrage des symboles. *
-* *
-* Retour : FALSE pour poursuivre la propagation de l'événement. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static gboolean filter_symbols_from_key_press(GtkEntry *entry, GdkEventKey *event, GSymbolsPanel *panel)
-{
- switch (event->keyval)
- {
- case GDK_KEY_Return:
- case GDK_KEY_KP_Enter:
- do_filtering_on_symbols(panel, entry);
- break;
-
- }
-
- return FALSE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : entry = entrée de texte contenant le filtre brut. *
-* icon_pos = position de l'image de fond. *
-* event = informations liées à l'événement. *
-* panel = panneau assurant l'affichage des symboles. *
+* Paramètres : entry = entrée de texte contenant le filtre brut. *
+* panel = panneau assurant l'affichage des symboles. *
* *
* Description : Démarre l'actualisation du filtrage des symboles. *
* *
@@ -947,31 +955,11 @@ static gboolean filter_symbols_from_key_press(GtkEntry *entry, GdkEventKey *even
* *
******************************************************************************/
-static void filter_symbols_from_icons(GtkEntry *entry, GtkEntryIconPosition icon_pos, GdkEventButton *event, GSymbolsPanel *panel)
-{
- do_filtering_on_symbols(panel, entry);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : panel = panneau assurant l'affichage des symboles. *
-* entry = entrée de texte contenant le filtre brut. *
-* *
-* Description : Exécute un nouveau filtrage des symboles affichés. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void do_filtering_on_symbols(GSymbolsPanel *panel, GtkEntry *entry)
+static void on_symbols_filter_changed(GtkSearchEntry *entry, GSymbolsPanel *panel)
{
const gchar *text; /* Texte de l'utilisateur */
int ret; /* Bilan de mise en place */
- GdkColor error; /* Couleur d'erreur */
+ GdkRGBA error; /* Couleur d'erreur */
if (panel->filter != NULL)
{
@@ -980,7 +968,7 @@ static void do_filtering_on_symbols(GSymbolsPanel *panel, GtkEntry *entry)
panel->filter = NULL;
}
- text = gtk_entry_get_text(entry);
+ text = gtk_entry_get_text(GTK_ENTRY(entry));
if (strlen(text) > 0)
{
@@ -992,10 +980,11 @@ static void do_filtering_on_symbols(GSymbolsPanel *panel, GtkEntry *entry)
free(panel->filter);
panel->filter = NULL;
- error.red = 65535;
- error.green = 0;
- error.blue = 0;
- gtk_widget_modify_text(GTK_WIDGET(entry), GTK_STATE_NORMAL, &error);
+ error.red = 1.0;
+ error.green = 0.0;
+ error.blue = 0.0;
+ error.alpha = 1.0;
+ gtk_widget_override_color(GTK_WIDGET(entry), GTK_STATE_NORMAL, &error);
return;
@@ -1003,8 +992,27 @@ static void do_filtering_on_symbols(GSymbolsPanel *panel, GtkEntry *entry)
}
- gtk_widget_modify_text(GTK_WIDGET(entry), GTK_STATE_NORMAL, NULL);
+ gtk_widget_override_color(GTK_WIDGET(entry), GTK_STATE_NORMAL, NULL);
+
+ do_filtering_on_symbols(panel);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = panneau assurant l'affichage des symboles. *
+* *
+* Description : Exécute un nouveau filtrage des symboles affichés. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+static void do_filtering_on_symbols(GSymbolsPanel *panel)
+{
g_object_ref(G_OBJECT(panel->binary));
change_symbols_panel_current_binary(panel, panel->binary);
g_object_unref(G_OBJECT(panel->binary));
@@ -1014,8 +1022,8 @@ static void do_filtering_on_symbols(GSymbolsPanel *panel, GtkEntry *entry)
/******************************************************************************
* *
-* Paramètres : panel = panneau assurant l'affichage des symboles. *
-* name = désignation du symbole à traiter. *
+* Paramètres : panel = panneau assurant l'affichage des symboles. *
+* symbol = symbole à traiter. *
* *
* Description : Détermine si un nom de symbole doit être filtré ou non. *
* *
@@ -1025,15 +1033,21 @@ static void do_filtering_on_symbols(GSymbolsPanel *panel, GtkEntry *entry)
* *
******************************************************************************/
-static bool is_symbol_filtered(GSymbolsPanel *panel, const char *name)
+static bool is_symbol_filtered(GSymbolsPanel *panel, const GBinSymbol *symbol)
{
+ SymbolType type; /* Type associé au symbole */
regmatch_t match; /* Récupération des trouvailles*/
int ret; /* Bilan du filtrage */
+ type = g_binary_symbol_get_target_type(symbol);
+
+ if (type != STP_ROUTINE && type != STP_OBJECT)
+ return true;
+
if (panel->filter == NULL)
return false;
- ret = regexec(panel->filter, name, 1, &match, 0);
+ ret = regexec(panel->filter, g_binary_symbol_to_string(symbol), 1, &match, 0);
if (ret == REG_NOMATCH)
return true;