diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2008-07-26 23:46:10 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2008-07-26 23:46:10 (GMT) |
commit | dbf4d1f93e54251568854bff0ebc9c84f60857f6 (patch) | |
tree | 72fa507ada7ba5b7351f711a7f16a8d3f7d32524 /src/gtksnippet.h | |
parent | c4f9b35d4ccb5bb82c4927daddd34d7a828bff3c (diff) |
Parsed x86 binary data and displayed the result.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@6 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtksnippet.h')
-rw-r--r-- | src/gtksnippet.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/src/gtksnippet.h b/src/gtksnippet.h new file mode 100644 index 0000000..e66eedc --- /dev/null +++ b/src/gtksnippet.h @@ -0,0 +1,128 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * format_elf.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 "arch/instruction.h" +#include "arch/processor.h" + + + + + + + +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; + + +/* Mode d'adressage à utiliser */ +typedef enum _AdressMode +{ + ADM_32BITS, /* Adresses sur 32 bits */ + ADM_64BITS /* Adresses sur 64 bits */ + +} AdressMode; + + + +typedef struct _code_line_info +{ + uint64_t offset; /* Position de l'instruction */ + asm_instr *instr; /* Eventuelle instruction */ + char *comment; /* Eventuel commentaire */ + +} code_line_info; + + +struct _GtkSnippet { + + GtkWidget widget; /* Présence obligatoire en 1er */ + + AdressMode mode; /* Mode d'affichage */ + + PangoLayout *layout; /* Moteur de rendu du code ASM */ + GdkGC *gc; /* Contexte graphique du rendu */ + + const asm_processor *proc; /* Architecture utilisée */ + code_line_info *info; /* Contenu à représenter */ + unsigned int info_count; /* Quantité d'informations */ + + + 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 gtk_snippet_test(GtkSnippet *cpu); + + + +/* 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 *, uint64_t, asm_instr *, const char *); + +/* Définit le contenu visuel à partir des infos enregistrées. */ +void gtk_snippet_build_content(GtkSnippet *); + + + + +G_END_DECLS + + + + + + +#endif /* _GTK_SNIPPET_H */ |