diff options
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/panels/Makefile.am | 19 | ||||
-rw-r--r-- | src/panels/breaks.c | 458 | ||||
-rw-r--r-- | src/panels/breaks.h | 59 | ||||
-rw-r--r-- | src/panels/panel-int.h | 74 | ||||
-rw-r--r-- | src/panels/panel.c | 256 | ||||
-rw-r--r-- | src/panels/panel.h | 116 | ||||
-rw-r--r-- | src/panels/registers.c | 230 | ||||
-rw-r--r-- | src/panels/registers.h | 47 | ||||
-rw-r--r-- | src/panels/strings.c | 153 | ||||
-rw-r--r-- | src/panels/strings.h | 44 |
11 files changed, 0 insertions, 1458 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index d239a0d..f90d3bc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -85,5 +85,3 @@ chrysalide_hub_LDFLAGS = $(LIBGTK_LIBS) -L.libs -lchrysacore # glibext doit être traité en premier, à cause des marshals GLib SUBDIRS = core glibext gtkext analysis arch format common debug gui mangling plugins - -# TODO: rm -rf panels diff --git a/src/panels/Makefile.am b/src/panels/Makefile.am deleted file mode 100644 index 47665b6..0000000 --- a/src/panels/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ - -noinst_LTLIBRARIES = libpanels.la - -libpanels_la_SOURCES = \ - breaks.h breaks.c \ - glimpse.h glimpse.c \ - panel-int.h \ - panel.h panel.c \ - registers.h registers.c \ - strings.h strings.c - -libpanels_la_LDFLAGS = - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/panels/breaks.c b/src/panels/breaks.c deleted file mode 100644 index 5562ae0..0000000 --- a/src/panels/breaks.c +++ /dev/null @@ -1,458 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * breaks.c - panneau d'affichage des points d'arrêt - * - * Copyright (C) 2010-2018 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 "breaks.h" - - -#include "panel-int.h" -#include "../debug/break.h" -#include "../gtkext/easygtk.h" -#include "../gtkext/support.h" - - - -#define _(str) str - - -/* Panneau d'affichage des points d'arrêt (instance) */ -struct _GBreaksPanel -{ - GEditorPanel parent; /* A laisser en premier */ - - GtkTreeView *treeview; /* Composant d'affichage */ - GtkTreeStore *store; /* Modèle de gestion */ - - GLoadedBinary *binary; /* Binaire en cours d'étude */ - -}; - - -/* Panneau d'affichage des points d'arrêt (classe) */ -struct _GBreaksPanelClass -{ - GEditorPanelClass parent; /* A laisser en premier */ - -}; - - -/* Colonnes de la liste des symboles */ -typedef enum _BreaksColumn -{ - BKC_POINT, /* Point d'arrêt de référence */ - BKC_ICON, /* Statut du point d'arrêt */ - BKC_ADDRESS, /* Adresse mémoire du symbole */ - BKC_STRING, /* Désignation humaine */ - - BKC_COUNT /* Nombre de colonnes */ - -} BreaksColumn; - - -/* Initialise la classe des panneaux de points d'arrêt. */ -static void g_breaks_panel_class_init(GBreaksPanelClass *); - -/* Initialise une instance de panneau de points d'arrêt. */ -static void g_breaks_panel_init(GBreaksPanel *); - -/* Réagit à un changement du binaire courant. */ -static void reload_breaks_for_new_binary(GBreaksPanel *, GLoadedBinary *); - - - - -/* Intègre à l'affichage un groupe de points d'arrêt. */ -static void add_bp_group_to_breaks_panel(GLoadedBinary *, GBreakGroup *, GBreaksPanel *); - -/* Réagit à une nouvelle création de point d'arrêt. */ -static void refresh_breaks_panel_on_bp_added(GBreakGroup *, GBreakPoint *, GBreaksPanel *); - -/* Réagit à une suppression de point d'arrêt. */ -static void refresh_breaks_panel_on_bp_removed(GBreakGroup *, GBreakPoint *, GBreaksPanel *); - -/* Réagit à une modification de point d'arrêt. */ -static void refresh_breaks_panel_on_bp_changed(GBreakGroup *, GBreakPoint *, GBreaksPanel *); - - - - -/* Retrouve un point d'arrêt dans la liste affichée. */ -static bool find_breakpoint_in_breaks_panel(GBreaksPanel *, GBreakPoint *, GtkTreeIter *); - - - -/* Indique le type défini pour un panneau d'affichage des points d'arrêt. */ -G_DEFINE_TYPE(GBreaksPanel, g_breaks_panel, G_TYPE_EDITOR_PANEL); - - -/****************************************************************************** -* * -* Paramètres : klass = classe à initialiser. * -* * -* Description : Initialise la classe des panneaux de points d'arrêt. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_breaks_panel_class_init(GBreaksPanelClass *klass) -{ - -} - - -/****************************************************************************** -* * -* Paramètres : panel = instance à initialiser. * -* * -* Description : Initialise une instance de panneau de points d'arrêt. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_breaks_panel_init(GBreaksPanel *panel) -{ - GEditorPanel *base; /* Version basique d'instance */ - GObject *ref; /* Espace de référencement */ - GtkWidget *toolbar; /* Barre d'outils */ - GtkWidget *button; /* Bouton de cette même barre */ - GtkWidget *separator; /* Barre de séparation vert. */ - GtkWidget *scrollwnd; /* Support défilant */ - 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 = _("Breakpoints"); - base->reload_binary = (reload_for_new_binary_fc)reload_breaks_for_new_binary; - - base->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); - gtk_widget_show(base->widget); - - ref = G_OBJECT(base->widget); - g_object_set_data(ref, "panel", panel); - - scrollwnd = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_show(scrollwnd); - gtk_box_pack_start(GTK_BOX(base->widget), scrollwnd, TRUE, TRUE, 0); - - 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(BKC_COUNT, G_TYPE_OBJECT, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); - - treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(panel->store)); - gtk_widget_show(treeview); - gtk_container_add(GTK_CONTAINER(scrollwnd), treeview); - - panel->treeview = GTK_TREE_VIEW(treeview); - - g_object_unref(G_OBJECT(panel->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); - - - - column = gtk_tree_view_column_new(); - gtk_tree_view_column_set_title(column, _("Address")); - - renderer = gtk_cell_renderer_pixbuf_new(); - gtk_tree_view_column_pack_start(column, renderer, FALSE); - gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", BKC_ICON); - - renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_column_pack_start(column, renderer, TRUE); - gtk_tree_view_column_add_attribute(column, renderer, "text", BKC_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(_("Address"), renderer, "text", BKC_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", BKC_STRING, NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); - - - - -} - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Crée un panneau d'aperçu de graphiques. * -* * -* Retour : Adresse de la structure mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GEditorPanel *g_breaks_panel_new(void) -{ - GEditorPanel *result; /* Structure à retourner */ - - result = g_object_new(G_TYPE_BREAKS_PANEL, NULL); - - return G_EDITOR_PANEL(result); - -} - - -/****************************************************************************** -* * -* Paramètres : panel = panneau à mettre à jour. * -* binary = nouvelle instance de binaire analysé. * -* * -* Description : Réagit à un changement du binaire courant. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void reload_breaks_for_new_binary(GBreaksPanel *panel, GLoadedBinary *binary) -{ - - printf("CHNAGE BINARY !\n"); - - panel->binary = binary; - - //g_loaded_binary_for_each_bp_group(binary, (GExtFunc)add_bp_group_to_breaks_panel, panel); - - -} - - - - - - - - - - - - - - -/****************************************************************************** -* * -* Paramètres : binary = instance active du binaire analysé. * -* group = groupe de points d'arrêt présent dans le binaire. * -* panel = panneau à mettre à jour. * -* * -* Description : Intègre à l'affichage un groupe de points d'arrêt. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void add_bp_group_to_breaks_panel(GLoadedBinary *binary, GBreakGroup *group, GBreaksPanel *panel) -{ - /* FIXME : bloquer toute émission de signal tant que les ajouts ne sont pas terminés. */ - - g_signal_connect(group, "added", - G_CALLBACK(refresh_breaks_panel_on_bp_added), panel); - - g_signal_connect(group, "removed", - G_CALLBACK(refresh_breaks_panel_on_bp_removed), panel); - - g_break_group_for_each(group, (GExtFunc)refresh_breaks_panel_on_bp_added, panel); - -} - - -/****************************************************************************** -* * -* Paramètres : group = ensemble de points d'arrêt intervenant. * -* point = point d'arrêt à l'origine de la procédure. * -* panel = panneau à mettre à jour. * -* * -* Description : Réagit à une nouvelle création de point d'arrêt. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void refresh_breaks_panel_on_bp_added(GBreakGroup *group, GBreakPoint *point, GBreaksPanel *panel) -{ -#if 0 - GExeFormat *format; /* Format associé au binaire */ - GArchProcessor *proc; /* Architecture utilisée */ - char address[VMPA_MAX_SIZE]; /* Conversion de l'adresse */ - GtkTreeIter iter; /* Point d'insertion */ - - format = g_loaded_binary_get_format(panel->binary); - proc = get_arch_processor_from_format(format); - - vmpa_to_string(g_break_point_get_address(point), - g_arch_processor_get_memory_size(proc), - address); - - gtk_tree_store_append(panel->store, &iter, NULL); - gtk_tree_store_set(panel->store, &iter, - BKC_POINT, point, - BKC_ADDRESS, address, - BKC_STRING, "???", - -1); - - /* Pour le reste... */ - refresh_breaks_panel_on_bp_changed(group, point, panel); - - g_object_unref(G_OBJECT(format)); - -#endif -} - - -/****************************************************************************** -* * -* Paramètres : group = ensemble de points d'arrêt intervenant. * -* point = point d'arrêt à l'origine de la procédure. * -* panel = panneau à mettre à jour. * -* * -* Description : Réagit à une suppression de point d'arrêt. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void refresh_breaks_panel_on_bp_removed(GBreakGroup *group, GBreakPoint *point, GBreaksPanel *panel) -{ - GtkTreeIter iter; /* Point de modification */ - - if (!find_breakpoint_in_breaks_panel(panel, point, &iter)) - return; - - gtk_tree_store_remove(panel->store, &iter); - -} - - -/****************************************************************************** -* * -* Paramètres : group = ensemble de points d'arrêt intervenant. * -* point = point d'arrêt à l'origine de la procédure. * -* panel = panneau à mettre à jour. * -* * -* Description : Réagit à une modification de point d'arrêt. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void refresh_breaks_panel_on_bp_changed(GBreakGroup *group, GBreakPoint *point, GBreaksPanel *panel) -{ - GtkTreeIter iter; /* Point de modification */ - GdkPixbuf *pixbuf; /* Tampon d'image chargé */ - - if (!find_breakpoint_in_breaks_panel(panel, point, &iter)) - return; - - pixbuf = get_pixbuf_from_file("breakpoint_normal.png"); - if (pixbuf == NULL) return; - - gtk_tree_store_set(panel->store, &iter, - BKC_ICON, pixbuf, - -1); - -} - - - - - - - - - - -/****************************************************************************** -* * -* Paramètres : panel = panneau d'affichage à consulter. * -* point = point d'arrêt lié à la procédure. * -* * -* Description : Retrouve un point d'arrêt dans la liste affichée. * -* * -* Retour : Bilan de la recherche. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool find_breakpoint_in_breaks_panel(GBreaksPanel *panel, GBreakPoint *point, GtkTreeIter *iter) -{ - bool result; /* Bilan à retourner */ - GtkTreeIter tmp; /* Sauvegarde temporaire */ - bool test; /* Valide la poursuite */ - GBreakPoint *bp; /* Adresse à comparer */ - - result = false; - - for (test = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(panel->store), &tmp); - test && !result; - test = gtk_tree_model_iter_next(GTK_TREE_MODEL(panel->store), &tmp)) - { - gtk_tree_model_get(GTK_TREE_MODEL(panel->store), - &tmp, BKC_POINT, &bp, -1); - - if (bp == point) - { - *iter = tmp; - result = true; - } - - } - - return result; - -} diff --git a/src/panels/breaks.h b/src/panels/breaks.h deleted file mode 100644 index 6875e8f..0000000 --- a/src/panels/breaks.h +++ /dev/null @@ -1,59 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * breaks.h - prototypes pour le panneau d'affichage des points d'arrêt - * - * Copyright (C) 2010-2018 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 _PANELS_BREAKS_H -#define _PANELS_BREAKS_H - - -#include <glib-object.h> - - -#include "panel.h" - - - -#define G_TYPE_BREAKS_PANEL g_breaks_panel_get_type() -#define G_BREAKS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_breaks_panel_get_type(), GBreaksPanel)) -#define G_IS_BREAKS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_breaks_panel_get_type())) -#define G_BREAKS_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BREAKS_PANEL, GBreaksPanelClass)) -#define G_IS_BREAKS_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BREAKS_PANEL)) -#define G_BREAKS_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BREAKS_PANEL, GBreaksPanelClass)) - - -/* Panneau d'affichage des points d'arrêt (instance) */ -typedef struct _GBreaksPanel GBreaksPanel; - -/* Panneau d'affichage des points d'arrêt (classe) */ -typedef struct _GBreaksPanelClass GBreaksPanelClass; - - -/* Indique le type défini pour un panneau d'affichage des points d'arrêt. */ -GType g_breaks_panel_get_type(void); - -/* Crée un panneau d'affichage des points d'arrêt. */ -GEditorPanel *g_breaks_panel_new(void); - - - -#endif /* _PANELS_BREAKS_H */ diff --git a/src/panels/panel-int.h b/src/panels/panel-int.h deleted file mode 100644 index 2d93689..0000000 --- a/src/panels/panel-int.h +++ /dev/null @@ -1,74 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * panels.h - prototypes pour les définitions internes liées aux panneaux - * - * Copyright (C) 2009-2016 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 du binaire courant. */ -typedef void (* reload_for_new_binary_fc) (GEditorPanel *, GLoadedBinary *); - -/* Réagit à un changement d'affichage principal de contenu. */ -typedef void (* reload_for_new_view_fc) (GEditorPanel *, GtkDisplayPanel *, 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_binary_fc reload_binary; /* Changement de binaire */ - 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 deleted file mode 100644 index cb70c64..0000000 --- a/src/panels/panel.c +++ /dev/null @@ -1,256 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * panels.h - gestion des différents panneaux - * - * Copyright (C) 2009-2016 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 "breaks.h" -#include "glimpse.h" -#include "panel-int.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, GLoadedBinary *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_breaks_panel_new(); - panels_list_add_tail(panel, &panels_list); - - //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 : binary = nouvelle instance de binaire analysé. * -* * -* Description : Lance une actualisation du fait d'un changement de binaire. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void notify_panels_of_binary_change(GLoadedBinary *binary) -{ - GEditorPanel *iter; /* Boucle de parcours */ - - panels_list_for_each(iter, panels_list) - if (iter->reload_binary != NULL) - iter->reload_binary(iter, binary); - -} - - -/****************************************************************************** -* * -* Paramètres : panel = 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(GtkDisplayPanel *panel, bool same) -{ - GEditorPanel *iter; /* Boucle de parcours */ - - panels_list_for_each(iter, panels_list) - if (iter->reload_view != NULL) - iter->reload_view(iter, panel, same); - -} - - - - - - - -#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 deleted file mode 100644 index f58c69b..0000000 --- a/src/panels/panel.h +++ /dev/null @@ -1,116 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * panels.h - prototypes pour la gestion des différents panneaux - * - * Copyright (C) 2009-2016 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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/gtk.h> - - -#include "../analysis/binary.h" -#include "../gtkext/gtkdisplaypanel.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 *, GLoadedBinary *); - - - - - -/* Procède au chargement de tous les panneaux internes. */ -void init_internal_panels(void); - -/* Lance une actualisation du fait d'un changement de binaire. */ -void notify_panels_of_binary_change(GLoadedBinary *); - -/* Lance une actualisation du fait d'un changement de vue. */ -void notify_panels_of_view_change(GtkDisplayPanel *, 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 deleted file mode 100644 index 20fd8a4..0000000 --- a/src/panels/registers.c +++ /dev/null @@ -1,230 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * registers.c - panneau d'affichage des registres d'architecture - * - * Copyright (C) 2009-2016 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 *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_box_new(GTK_ORIENTATION_VERTICAL, 8); - gtk_widget_show (vbox1); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(result), vbox1); - - - label1 = qck_create_label(NULL, NULL, _("Registers:")); - gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0); - - - table1 = gtk_table_new(7, 3, FALSE); - qck_set_margins(table1, 0, 0, 8, 0); - gtk_widget_show(table1); - gtk_box_pack_start(GTK_BOX(vbox1), table1, FALSE, TRUE, 0); - - 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 = qck_create_label(NULL, NULL, _("Segments:")); - gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0); - - - - - 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 deleted file mode 100644 index 5ba517f..0000000 --- a/src/panels/registers.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * registers.h - prototypes pour le panneau d'affichage des registres d'architecture - * - * Copyright (C) 2009-2016 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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/debugger.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 deleted file mode 100644 index ffd5f6a..0000000 --- a/src/panels/strings.c +++ /dev/null @@ -1,153 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * strings.c - panneau d'affichage des chaînes de caractères - * - * Copyright (C) 2009-2019 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 */ - const mrange_t *range; /* Emplacement de symbole */ - char address[VMPA_MAX_LEN]; /* 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_status(symbols[i]) == SSS_IMPORTED) continue; - - if (g_binary_symbol_get_stype(symbols[i]) != STP_STRING) continue; - - range = g_binary_symbol_get_range(symbols[i]); - mrange_virt_to_string(range, MDS_UNDEFINED, true, address, NULL); - - gtk_tree_store_append(store, &iter, NULL); - gtk_tree_store_set(store, &iter, - STC_ADDRESS, address, - STC_STRING, g_binary_symbol_get_label(symbols[i]), - -1); - - } - -} diff --git a/src/panels/strings.h b/src/panels/strings.h deleted file mode 100644 index 443720e..0000000 --- a/src/panels/strings.h +++ /dev/null @@ -1,44 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * strings.h - prototypes pour le panneau d'affichage des chaînes de caractères - * - * Copyright (C) 2009-2016 Cyrille Bagard - * - * This file is part of Chrysalide. - * - * Chrysalide 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. - * - * Chrysalide 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 */ |