/* 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 . */ #ifndef _GTK_SNIPPET_H #define _GTK_SNIPPET_H #include #include #include #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; /* Mode d'adressage à utiliser */ typedef enum _AdressMode { ADM_32BITS, /* Adresses sur 32 bits */ ADM_64BITS /* Adresses sur 64 bits */ } AdressMode; 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 */ 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); /* 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 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 */