diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-04-12 19:15:35 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-04-12 19:15:35 (GMT) |
commit | 216a3d0121fabd678e50ea6b4fa2447ae9b921f0 (patch) | |
tree | 395fcd91b674ff5652e34b46207ba08cc9e7af68 /src/gtkext/gtksnippet.h | |
parent | edac614a164d9cac345d914f4320d71bdb16ab79 (diff) |
Created a debugging layout and introduced a heavier use of GLib.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@58 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/gtksnippet.h')
-rw-r--r-- | src/gtkext/gtksnippet.h | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/src/gtkext/gtksnippet.h b/src/gtkext/gtksnippet.h new file mode 100644 index 0000000..41727bd --- /dev/null +++ b/src/gtkext/gtksnippet.h @@ -0,0 +1,156 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * gtksnippet.h - prototypes pour l'affichage d'un fragment de code d'assemblage + * + * 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_SNIPPET_H +#define _GTK_SNIPPET_H + + +#include <stdint.h> +#include <gtk/gtk.h> +#include <cairo.h> + + +#include "../analysis/line.h" +#include "../arch/instruction.h" +#include "../arch/processor.h" +#include "../format/exe_format.h" + + + +typedef struct _code_line_info +{ + uint64_t offset; /* Position de l'instruction */ + asm_instr *instr; /* Eventuelle instruction */ + char *comment; /* Eventuel commentaire */ + + gboolean bp_set; /* Point d'arrêt défini */ + +} code_line_info; + + + + +/* Crée une ligne de représentation insérable. */ +code_line_info *create_code_line_info(uint64_t, asm_instr *, const char *); + +/* Supprime une ligne de représentation. */ +void delete_code_line_info(code_line_info *); + +/* Etablit la comparaison entre deux lignes de représentation. */ +int compare_code_line_info(const code_line_info **, const code_line_info **); + + + + + +G_BEGIN_DECLS + + +#define GTK_SNIPPET(obj) GTK_CHECK_CAST(obj, gtk_snippet_get_type (), GtkSnippet) +#define GTK_SNIPPET_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, gtk_snippet_get_type(), GtkSnippetClass) +#define GTK_IS_SNIPPET(obj) GTK_CHECK_TYPE(obj, gtk_snippet_get_type()) + + +typedef struct _GtkSnippet GtkSnippet; +typedef struct _GtkSnippetClass GtkSnippetClass; + + + + + +struct _GtkSnippet { + + GtkWidget widget; /* Présence obligatoire en 1er */ + + AdressMode mode; /* Mode d'affichage */ + + bool show_vaddress; /* Affichage des adresses ? */ + bool show_code; /* Affichage du code brut ? */ + + PangoLayout *layout; /* Moteur de rendu du code ASM */ + GdkGC *gc; /* Contexte graphique du rendu */ + int line_height; /* Hauteur maximale des lignes */ + + const exe_format *format; /* Format du contenu bianire */ + const asm_processor *proc; /* Architecture utilisée */ + code_line_info *info; /* Contenu à représenter */ + unsigned int info_count; /* Quantité d'informations */ + + GRenderingLine *lines; /* Contenu à représenter */ + + + gint sel; +}; + +struct _GtkSnippetClass { + GtkWidgetClass parent_class; +}; + + +GtkType gtk_snippet_get_type(void); +void gtk_snippet_set_sel(GtkSnippet *cpu, gint sel); + +GtkWidget * gtk_snippet_new(void); + + + + +/* Choisit d'afficher les adresses virtuelles ou non. */ +void gtk_snippet_show_vaddress(GtkSnippet *, gboolean); + +/* Choisit d'afficher le code brut ou non. */ +void gtk_snippet_show_code(GtkSnippet *, gboolean); + + + + +/* Définit le format auquel le contenu est lié. */ +void gtk_snippet_set_format(GtkSnippet *, const exe_format *); + +/* Définit l'architecture à laquelle le contenu est lié. */ +void gtk_snippet_set_processor(GtkSnippet *, const asm_processor *); + +/* Ajoute une ligne dans le bloc de représentation. */ +void gtk_snippet_add_line(GtkSnippet *, const code_line_info *); + +/* Définit les lignes du bloc de représentation. */ +void gtk_snippet_set_rendering_lines(GtkSnippet *, GRenderingLine *); + +/* Définit le contenu visuel à partir des infos enregistrées. */ +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 + + + + + + +#endif /* _GTK_SNIPPET_H */ |