diff options
| -rw-r--r-- | ChangeLog | 17 | ||||
| -rw-r--r-- | plugins/stackvars/operand.c | 8 | ||||
| -rw-r--r-- | src/analysis/exporter-int.h | 16 | ||||
| -rw-r--r-- | src/analysis/exporter.c | 191 | ||||
| -rw-r--r-- | src/analysis/exporter.h | 6 | ||||
| -rw-r--r-- | src/analysis/line_code.c | 108 | ||||
| -rw-r--r-- | src/analysis/line_comment.c | 66 | ||||
| -rw-r--r-- | src/analysis/line_prologue.c | 35 | ||||
| -rw-r--r-- | src/arch/immediate.c | 184 | ||||
| -rw-r--r-- | src/arch/instruction.c | 58 | ||||
| -rw-r--r-- | src/arch/x86/operand.c | 215 | ||||
| -rw-r--r-- | src/arch/x86/registers.c | 33 | ||||
| -rw-r--r-- | src/gtkext/gtkblockview.c | 147 | ||||
| -rw-r--r-- | src/main.c | 5 | 
14 files changed, 25 insertions, 1064 deletions
| @@ -1,5 +1,22 @@  10-04-11  Cyrille Bagard <nocbos@gmail.com> +	* plugins/stackvars/operand.c: +	* src/analysis/exporter.c: +	* src/analysis/exporter.h: +	* src/analysis/exporter-int.h: +	* src/analysis/line_code.c: +	* src/analysis/line_comment.c: +	* src/analysis/line_prologue.c: +	* src/arch/immediate.c: +	* src/arch/instruction.c: +	* src/arch/x86/operand.c: +	* src/arch/x86/registers.c: +	* src/gtkext/gtkblockview.c: +	* src/main.c: +	Clean the code by removing all references to the old GtkTextBuffer usage. + +10-04-11  Cyrille Bagard <nocbos@gmail.com> +  	* src/analysis/exporter.c:  	* src/analysis/exporter.h:  	* src/analysis/exporter-int.h: diff --git a/plugins/stackvars/operand.c b/plugins/stackvars/operand.c index 387f766..503a065 100644 --- a/plugins/stackvars/operand.c +++ b/plugins/stackvars/operand.c @@ -57,9 +57,6 @@ static void g_stack_var_operand_class_init(GStackVarOperandClass *);  /* Initialise l'instande d'un opérandes de substitution. */  static void g_stack_var_operand_init(GStackVarOperand *); -/* Ajoute à un texte GTK le contenu d'un opérande. */ -static void g_stack_var_operand_add_to_gtk_buffer(const GStackVarOperand *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* Indique le type défini pour un opérande de substitution pour variable de pile. */ @@ -102,7 +99,7 @@ static void g_stack_var_operand_init(GStackVarOperand *operand)      parent = G_CONTENT_EXPORTER(operand); -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_stack_var_operand_add_to_gtk_buffer; +    //parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_stack_var_operand_add_to_gtk_buffer;  } @@ -133,7 +130,7 @@ GArchOperand *g_stack_var_operand_new(const GBinRoutine *routine, const GX86ModR  } - +#if 0  /******************************************************************************  *                                                                             *  *  Paramètres  : operand = opérande à transcrire.                             * @@ -174,3 +171,4 @@ static void g_stack_var_operand_add_to_gtk_buffer(const GStackVarOperand *operan                                             "]", 1, RTT_HOOK);  } +#endif diff --git a/src/analysis/exporter-int.h b/src/analysis/exporter-int.h index 421770e..5198e4f 100644 --- a/src/analysis/exporter-int.h +++ b/src/analysis/exporter-int.h @@ -35,12 +35,6 @@ typedef void (* add_text_fc) (GContentExporter *, GRenderingOptions *, MainRende  /* Ajoute à un texte GTK le contenu de la ligne de rendu. */  typedef void (* export_buffer_fc) (GContentExporter *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu de la ligne de rendu. */ -typedef void (* add_to_gtk_buffer_fc) (GContentExporter *, MainRendering, GtkTextBuffer *, GtkTextIter *, size_t [SAR_COUNT]); - -/* Traduit une instruction en version humainement lisible. */ -typedef void (* add_arch_to_gtk_buffer_fc) (const GContentExporter *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* Exportation de contenu (instance) */ @@ -49,10 +43,7 @@ struct _GContentExporter      GObject parent;                         /* A laisser en premier        */      add_text_fc add_text;                   /* Remplissage simple          */ -    export_buffer_fc export_buffer;         /* Constitution du texte GTK   */ -    add_to_gtk_buffer_fc add_to_gtk_buffer; /* Constitution du texte GTK   */ - -    add_arch_to_gtk_buffer_fc add_arch_to_gtk_buffer;   /* Constitution... */ +    export_buffer_fc export_buffer;         /* Constitution du texte GLib  */  }; @@ -65,8 +56,6 @@ struct _GContentExporterClass      PangoContext *context;                  /* Contexte graphique Pango    */      PangoAttrList *attribs[RTT_COUNT];      /* Décorateurs pour tampons    */ -    GtkTextTag *tags[RTT_COUNT];            /* Décorateurs pour les textes */ -  }; @@ -76,9 +65,6 @@ void g_content_exporter_insert_text(GContentExporter *, FILE *, const char *, si  /* Ajoute du texte à un tampon de code via l'instance spécifiée. */  void g_content_exporter_insert_into_buffer(GContentExporter *, GBufferLine *, BufferLineColumn, const char *, size_t, RenderingTagType); -/* Ajoute du texte à un texte GTK via l'instance spécifiée. */ -void g_content_exporter_insert_with_gtk_tag(GContentExporter *, GtkTextBuffer *, GtkTextIter *, const char *, size_t, RenderingTagType); -  #endif  /* _ANALYSIS_EXPORTER_INT_H */ diff --git a/src/analysis/exporter.c b/src/analysis/exporter.c index 5820fd6..b6d773a 100644 --- a/src/analysis/exporter.c +++ b/src/analysis/exporter.c @@ -48,8 +48,6 @@ static void g_content_exporter_class_init(GContentExporterClass *klass)  {      GdkScreen *screen;                      /* Ecran pour GDK              */      PangoFontDescription *font_desc;        /* Police de caractère         */ -    GtkTextTagTable *table;                 /* Seule table globale valable */ -    GtkTextTag *tag;      /* Exportation vers un tampon de code */ @@ -87,89 +85,6 @@ static void g_content_exporter_class_init(GContentExporterClass *klass)      klass->attribs[RTT_VAR_NAME] = pango_attr_list_new(); - - -    /* Décorateurs GTK */ - -    table = get_gtk_tag_table(); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "green", NULL); - -    klass->tags[RTT_COMMENT] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "gray", NULL); - -    klass->tags[RTT_RAW_CODE] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "red", NULL); - -    klass->tags[RTT_INSTRUCTION] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "purple", NULL); - -    klass->tags[RTT_IMMEDIATE] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "blue", NULL); - -    klass->tags[RTT_REGISTER] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "blue", "background", "black", NULL); - -    klass->tags[RTT_HOOK] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "white", "background", "black", NULL); - -    klass->tags[RTT_SIGNS] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "red", "background", "black", NULL); - -    klass->tags[RTT_LTGT] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "black", NULL); - -    klass->tags[RTT_SEGMENT] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "orange", NULL); - -    klass->tags[RTT_STRING] = tag; -    gtk_text_tag_table_add(table, tag); - -    tag = gtk_text_tag_new(NULL); - -    g_object_set(G_OBJECT(tag), "foreground", "black", NULL); - -    klass->tags[RTT_VAR_NAME] = tag; -    gtk_text_tag_table_add(table, tag); -  } @@ -193,33 +108,6 @@ static void g_content_exporter_init(GContentExporter *exporter)  /******************************************************************************  *                                                                             * -*  Paramètres  : table = éventuelle instance à enregistrer.                   * -*                                                                             * -*  Description : Définit et/ou renvoie le singleton pour les marques de texte.* -*                                                                             * -*  Retour      : Table courante à utiliser.                                   * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GtkTextTagTable *_get_gtk_tag_table(GtkTextTagTable *table) -{ -    static GtkTextTagTable *result = NULL;  /* Table valable à renvoyer    */ - -    if (table != NULL) -    { -        if (result != NULL) /* TODO : free() */; -        result = table; -    } - -    return result; - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : exporter = instance sachant exporter son contenu.            *  *                stream   = flux ouvert en écriture.                          *  *                text     = texte à insérer dans l'existant.                  * @@ -276,37 +164,6 @@ void g_content_exporter_insert_into_buffer(GContentExporter *exporter, GBufferLi  /******************************************************************************  *                                                                             * -*  Paramètres  : exporter = instance sachant exporter son contenu.            * -*                buffer   = zone de texte à venir compléter.                  * -*                iter     = point d'insertion du nouveau texte. [OUT]         * -*                text     = texte à insérer dans l'existant.                  * -*                length   = taille du texte à traiter.                        * -*                tag      = type de décorateur à utiliser.                    * -*                                                                             * -*  Description : Ajoute du texte à un texte GTK via l'instance spécifiée.     * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -void g_content_exporter_insert_with_gtk_tag(GContentExporter *exporter, GtkTextBuffer *buffer, GtkTextIter *iter, const char *text, size_t length, RenderingTagType tag) -{ -    size_t init;                            /* Point d'insertion initial   */ - -    if (tag != RTT_NONE) -        gtk_text_buffer_insert_with_tags(buffer, iter, text, length, -                                         G_CONTENT_EXPORTER_GET_CLASS(exporter)->tags[tag], -                                         NULL); - -    else gtk_text_buffer_insert_with_tags(buffer, iter, text, length, NULL); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : exporter  = instance sachant exporter son contenu.           *  *                options   = options de rendu.                                *  *                rendering = support effectif final des lignes de code.       * @@ -348,51 +205,3 @@ void g_content_exporter_to_buffer(GContentExporter *exporter, GBufferLine *line,          exporter->export_buffer(exporter, line, options);  } - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : exporter  = instance sachant exporter son contenu.           * -*                rendering = support effectif final des lignes de code.       * -*                buffer    = zone de texte à venir compléter.                 * -*                iter      = point d'insertion du nouveau texte.              * -*                lengths   = taille des différentes composantes de la ligne.  * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu de l'instance spécifiée.    * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -void g_content_exporter_add_to_gtk_buffer(GContentExporter *exporter, MainRendering rendering, GtkTextBuffer *buffer, GtkTextIter *iter, size_t lengths[SAR_COUNT]) -{ -    if (exporter->add_to_gtk_buffer != NULL) -        exporter->add_to_gtk_buffer(exporter, rendering, buffer, iter, lengths); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : exporter  = instance sachant exporter son contenu.           * -*                format    = format du binaire manipulé.                      * -*                syntax    = type de représentation demandée.                 * -*                buffer    = zone de texte à venir compléter.                 * -*                iter      = point d'insertion du nouveau texte.              * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'une architecture.         * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -void g_content_exporter_add_arch_to_gtk_buffer(const GContentExporter *exporter, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    if (exporter->add_arch_to_gtk_buffer != NULL) -        exporter->add_arch_to_gtk_buffer(exporter, format, syntax, buffer, iter); - -} diff --git a/src/analysis/exporter.h b/src/analysis/exporter.h index 297fd99..7c90cad 100644 --- a/src/analysis/exporter.h +++ b/src/analysis/exporter.h @@ -95,12 +95,6 @@ void g_content_exporter_add_text(GContentExporter *, GRenderingOptions *, MainRe  /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  void g_content_exporter_to_buffer(GContentExporter *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu de l'instance spécifiée. */ -void g_content_exporter_add_to_gtk_buffer(GContentExporter *, MainRendering, GtkTextBuffer *, GtkTextIter *, size_t [SAR_COUNT]); - -/* Ajoute à un texte GTK le contenu d'une architecture. */ -void g_content_exporter_add_arch_to_gtk_buffer(const GContentExporter *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  #endif  /* _ANALYSIS_EXPORTER_H */ diff --git a/src/analysis/line_code.c b/src/analysis/line_code.c index 4761522..7630366 100644 --- a/src/analysis/line_code.c +++ b/src/analysis/line_code.c @@ -64,9 +64,6 @@ static void g_code_line_add_text(GCodeLine *, GRenderingOptions *, MainRendering  /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_code_line_to_buffer(GCodeLine *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu de la ligne de code. */ -static void g_code_line_add_to_gtk_buffer(GCodeLine *, MainRendering, GtkTextBuffer *, GtkTextIter *, size_t [SAR_COUNT]); -  /* Indique le type définit par la GLib pour la ligne. */ @@ -113,7 +110,6 @@ static void g_code_line_init(GCodeLine *line)      exporter_parent->add_text = (add_text_fc)g_code_line_add_text;      exporter_parent->export_buffer = (export_buffer_fc)g_code_line_to_buffer; -    exporter_parent->add_to_gtk_buffer = (add_to_gtk_buffer_fc)g_code_line_add_to_gtk_buffer;      line_parent = G_RENDERING_LINE(line); @@ -290,110 +286,6 @@ static void g_code_line_to_buffer(GCodeLine *line, GBufferLine *buffer, GRenderi  /******************************************************************************  *                                                                             * -*  Paramètres  : line      = ligne de représentation à actualiser.            * -*                rendering = support effectif final des lignes de code.       * -*                buffer    = zone de texte à venir compléter.                 * -*                iter      = point d'insertion du nouveau texte.              * -*                lengths   = taille des différentes composantes de la ligne.  * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu de la ligne de code.        * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_code_line_add_to_gtk_buffer(GCodeLine *line, MainRendering rendering, GtkTextBuffer *buffer, GtkTextIter *iter, size_t lengths[SAR_COUNT]) -{ -    GContentExporter *exporter;             /* Autre vision de la ligne #1 */ -    GRenderingLine *basic;                  /* Autre vision de la ligne #2 */ -    bool show_address;                      /* Affichage de l'adresse ?    */ -    bool show_code;                         /* Affichage du code brut ?    */ -    MemoryDataSize msize;                   /* Taille du bus d'adresses    */ -    char address[VMPA_MAX_SIZE];            /* Adresse au format texte     */ -    size_t len;                             /* Taille de l'élément inséré  */ -    const bin_t *content;                   /* Contenu binaire global      */ -    off_t bin_offset;                       /* Début de l'instruction      */ -    off_t bin_len;                          /* Taille d'instruction        */ -    char *bin_code;                         /* Tampon du code binaire      */ -    off_t i;                                /* Boucle de parcours          */ - -    exporter = G_CONTENT_EXPORTER(line); -    basic = G_RENDERING_LINE(line); - -    show_address = g_rendering_options_has_to_show_address(line->options, rendering); -    show_code = g_rendering_options_has_to_show_code(line->options, rendering); - -    /* Eventuelle adresse virtuelle ou physique */ - -    if (show_address) -    { -        msize = g_arch_processor_get_memory_size(g_rendering_options_get_processor(line->options)); - -        len = vmpa_to_string(G_RENDERING_LINE(line)->offset, msize, address); -        lengths[SAR_ADDRESS] = len; - -        g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, -                                           address, len, RTT_NONE); - -        g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, -                                               "\t", 1, RTT_NONE); - -    } - -    /* Eventuel code brut */ - -    if (show_code) -    { -        content = g_binary_format_get_content(G_BIN_FORMAT(g_rendering_options_get_format(line->options)), NULL); -        g_arch_instruction_get_location(line->instr, &bin_offset, &bin_len, NULL); - -        lengths[SAR_CODE] = MAX(lengths[SAR_CODE], bin_len * 3 - 1); - -        bin_code = (char *)calloc(bin_len * 3, sizeof(char)); - -        for (i = 0; i < bin_len; i++) -        { -            if ((i + 1) < bin_len) -                snprintf(&bin_code[i * (2 + 1)], 4, "%02hhx ", content[bin_offset + i]); -            else -                snprintf(&bin_code[i * (2 + 1)], 3, "%02hhx", content[bin_offset + i]); -        } - -        g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, -                                               bin_code, bin_len * 3 - 1, RTT_RAW_CODE); - -        free(bin_code); - -        g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, -                                               "\t", 1, RTT_NONE); - -    } - -    /* Instruction proprement dite */ - -    g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(line->instr), -                                              g_rendering_options_get_format(line->options), -                                              ASX_INTEL/*FIXME*/, buffer, iter); - -    lengths[SAR_INSTRUCTION] = MAX(lengths[SAR_INSTRUCTION], 4 /* FIXME */); - -    /* Commentaire ? */ - -    if (basic->comment != NULL) -    { -        g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, "\t", 1, RTT_NONE); -        g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, "; ", 2, RTT_COMMENT); -        g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, basic->comment, -                                       strlen(basic->comment), RTT_COMMENT); -    } - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : offset  = emplacement physique ou en mémoire.                *  *                instr   = instruction à représenter.                         *  *                options = paramétrage du rendu.                              * diff --git a/src/analysis/line_comment.c b/src/analysis/line_comment.c index 8af1777..5bdf29a 100644 --- a/src/analysis/line_comment.c +++ b/src/analysis/line_comment.c @@ -60,9 +60,6 @@ static void g_comment_line_init(GCommentLine *);  /* Ajoute du texte simple à un fichier ouvert en écriture. */  static void g_comment_line_add_text(GCommentLine *, GRenderingOptions *, MainRendering, FILE *); -/* Ajoute à un texte GTK le contenu de la ligne de commentaires. */ -static void g_comment_line_add_to_gtk_buffer(GCommentLine *, MainRendering, GtkTextBuffer *, GtkTextIter *, size_t [SAR_COUNT]); -  /* Indique le type définit par la GLib pour la ligne. */ @@ -108,7 +105,6 @@ static void g_comment_line_init(GCommentLine *line)      exporter_parent = G_CONTENT_EXPORTER(line);      exporter_parent->add_text = (add_text_fc)g_comment_line_add_text; -    exporter_parent->add_to_gtk_buffer = (add_to_gtk_buffer_fc)g_comment_line_add_to_gtk_buffer;      line_parent = G_RENDERING_LINE(line); @@ -177,68 +173,6 @@ static void g_comment_line_add_text(GCommentLine *line, GRenderingOptions *optio  /******************************************************************************  *                                                                             * -*  Paramètres  : line      = ligne de représentation à actualiser.            * -*                rendering = support effectif final des lignes de code.       * -*                buffer    = zone de texte à venir compléter.                 * -*                iter      = point d'insertion du nouveau texte.              * -*                lengths   = taille des différentes composantes de la ligne.  * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu de la ligne de commentaires.* -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_comment_line_add_to_gtk_buffer(GCommentLine *line, MainRendering rendering, GtkTextBuffer *buffer, GtkTextIter *iter, size_t lengths[SAR_COUNT]) -{ -    bool show_address;                      /* Affichage de l'adresse ?    */ -    bool show_code;                         /* Affichage du code brut ?    */ -    MemoryDataSize msize;                   /* Taille du bus d'adresses    */ -    char address[VMPA_MAX_SIZE];            /* Adresse au format texte     */ -    size_t len;                             /* Taille de l'élément inséré  */ - -    show_address = g_rendering_options_has_to_show_address(line->options, rendering); -    show_code = g_rendering_options_has_to_show_code(line->options, rendering); - -    /* Eventuelle adresse virtuelle ou physique */ - -    if (show_address) -    { -        msize = g_arch_processor_get_memory_size(g_rendering_options_get_processor(line->options)); - -        len = vmpa_to_string(G_RENDERING_LINE(line)->offset, msize, address); - -        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter, -                                           address, len, RTT_NONE); - -        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter, -                                               "\t", 1, RTT_NONE); - -    } - -    /* Eventuel code brut (sauté) */ - -    if (show_code) -        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter, -                                               "\t", 1, RTT_NONE); - -    /* Commentaire proprement dit */ - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter, -                                           "; ", 2, RTT_COMMENT); - -    len = strlen(line->comment); - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter, -                                           line->comment, len, RTT_COMMENT); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : offset  = emplacement physique ou en mémoire.                *  *                comment = texte à afficher au final.                         *  *                options = paramétrage du rendu.                              * diff --git a/src/analysis/line_prologue.c b/src/analysis/line_prologue.c index 007804b..d530a44 100644 --- a/src/analysis/line_prologue.c +++ b/src/analysis/line_prologue.c @@ -59,9 +59,6 @@ static void g_prologue_line_init(GPrologueLine *);  /* Ajoute du texte simple à un fichier ouvert en écriture. */  static void g_prologue_line_add_text(GPrologueLine *, GRenderingOptions *, MainRendering, FILE *); -/* Ajoute à un texte GTK le contenu de la ligne d'ouverture. */ -static void g_prologue_line_add_to_gtk_buffer(GPrologueLine *, MainRendering, GtkTextBuffer *, GtkTextIter *, size_t [SAR_COUNT]); -  /* Indique le type définit par la GLib pour la ligne. */ @@ -107,7 +104,6 @@ static void g_prologue_line_init(GPrologueLine *line)      exporter_parent = G_CONTENT_EXPORTER(line);      exporter_parent->add_text = (add_text_fc)g_prologue_line_add_text; -    exporter_parent->add_to_gtk_buffer = (add_to_gtk_buffer_fc)g_prologue_line_add_to_gtk_buffer;      line_parent = G_RENDERING_LINE(line); @@ -148,37 +144,6 @@ static void g_prologue_line_add_text(GPrologueLine *line, GRenderingOptions *opt  /******************************************************************************  *                                                                             * -*  Paramètres  : line      = ligne de représentation à actualiser.            * -*                rendering = support effectif final des lignes de code.       * -*                buffer    = zone de texte à venir compléter.                 * -*                iter      = point d'insertion du nouveau texte.              * -*                lengths   = taille des différentes composantes de la ligne.  * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu de la ligne d'ouverture.    * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_prologue_line_add_to_gtk_buffer(GPrologueLine *line, MainRendering rendering, GtkTextBuffer *buffer, GtkTextIter *iter, size_t lengths[SAR_COUNT]) -{ -    size_t len;                             /* Taille de l'élément inséré  */ - -    len = strlen(line->comment); - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter, -                                           "; ", 2, RTT_COMMENT); - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter, -                                           line->comment, len, RTT_COMMENT); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : comment = texte à afficher au final.                         *  *                                                                             *  *  Description : Crée une des lignes de descriptions initiales.               * diff --git a/src/arch/immediate.c b/src/arch/immediate.c index 61dc5f5..07f848f 100644 --- a/src/arch/immediate.c +++ b/src/arch/immediate.c @@ -93,8 +93,6 @@ static void g_imm_operand_add_text(const GImmOperand *, GRenderingOptions *, Mai  /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_imm_operand_to_buffer(const GImmOperand *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu d'un opérande. */ -static void g_imm_operand_add_to_gtk_buffer(const GImmOperand *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *);  /* Indique le type défini pour un opérande de valeur numérique. */ @@ -140,7 +138,6 @@ static void g_imm_operand_init(GImmOperand *operand)      parent->add_text = (add_text_fc)g_imm_operand_add_text;      parent->export_buffer = (export_buffer_fc)g_imm_operand_to_buffer; -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_imm_operand_add_to_gtk_buffer;  } @@ -512,187 +509,6 @@ static void g_imm_operand_to_buffer(const GImmOperand *operand, GBufferLine *buf  /******************************************************************************  *                                                                             * -*  Paramètres  : operand = opérande à transcrire.                             * -*                format  = format du binaire manipulé.                        * -*                syntax  = type de représentation demandée.                   * -*                buffer  = zone de texte à venir compléter.                   * -*                iter    = point d'insertion du nouveau texte.                * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'un opérande.              * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_imm_operand_add_to_gtk_buffer(const GImmOperand *operand, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    char value[VMPA_MAX_SIZE];              /* Chaîne à imprimer           */ -    vmpa_t address;                         /* Décallage final constaté    */ -    const char *label;                      /* Etiquette de symbole        */ -    SymbolType symtype;                     /* Type de symbole             */ -    char *printable;                        /* Version texte présentable   */ - -    /* Valeur brute */ - -    switch (syntax) -    { -        case ASX_INTEL: -            switch (operand->size) -            { -                case MDS_UNDEFINED: -                    snprintf(value, VMPA_MAX_SIZE, "0x???"); -                    break; -                case AOS_8_BITS_UNSIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "0x%hhx", operand->unsigned_imm.val8); -                    break; -                case AOS_16_BITS_UNSIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "0x%hx", operand->unsigned_imm.val16); -                    break; -                case AOS_32_BITS_UNSIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "0x%x", operand->unsigned_imm.val32); -                    break; -                case AOS_64_BITS_UNSIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "0x%llx", operand->unsigned_imm.val64); -                    break; -                case AOS_8_BITS_SIGNED: -                    if (g_imm_operand_is_negative(operand)) -                        snprintf(value, VMPA_MAX_SIZE, "0x%hhx", ~operand->signed_imm.val8 + 1); -                    else -                        snprintf(value, VMPA_MAX_SIZE, "0x%hhx", operand->signed_imm.val8); -                    break; -                case AOS_16_BITS_SIGNED: -                    if (g_imm_operand_is_negative(operand)) -                        snprintf(value, VMPA_MAX_SIZE, "0x%hx", ~operand->signed_imm.val16 + 1); -                    else -                        snprintf(value, VMPA_MAX_SIZE, "0x%hx", operand->signed_imm.val16); -                    break; -                case AOS_32_BITS_SIGNED: -                    if (g_imm_operand_is_negative(operand)) -                        snprintf(value, VMPA_MAX_SIZE, "0x%x", ~operand->signed_imm.val32 + 1); -                    else -                        snprintf(value, VMPA_MAX_SIZE, "0x%x", operand->signed_imm.val32); -                    break; -                case AOS_64_BITS_SIGNED: -                    if (g_imm_operand_is_negative(operand)) -                        snprintf(value, VMPA_MAX_SIZE, "0x%llx", ~operand->signed_imm.val64 + 1); -                    else -                        snprintf(value, VMPA_MAX_SIZE, "0x%llx", operand->signed_imm.val64); -                    break; -            } -            break; - -        case ASX_ATT: -            switch (operand->size) -            { -                case MDS_UNDEFINED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x???"); -                    break; -                case AOS_8_BITS_UNSIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x%hhx", operand->unsigned_imm.val8); -                    break; -                case AOS_16_BITS_UNSIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x%hx", operand->unsigned_imm.val16); -                    break; -                case AOS_32_BITS_UNSIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x%x", operand->unsigned_imm.val32); -                    break; -                case AOS_64_BITS_UNSIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x%llx", operand->unsigned_imm.val64); -                    break; -                case AOS_8_BITS_SIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x%hhx", ~operand->signed_imm.val8 + 1); -                    break; -                case AOS_16_BITS_SIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x%hx", ~operand->signed_imm.val16 + 1); -                    break; -                case AOS_32_BITS_SIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x%x", ~operand->signed_imm.val32 + 1); -                    break; -                case AOS_64_BITS_SIGNED: -                    snprintf(value, VMPA_MAX_SIZE, "$0x%llx", ~operand->signed_imm.val64 + 1); -                    break; -            } -            break; - -        default: -            break; - -    } - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                           value, strlen(value), RTT_IMMEDIATE); - -    /* Complément d'information */ - -    if (operand->size == g_arch_processor_get_memory_size(get_arch_processor_from_format(format))) -    { -        if (g_imm_operand_to_vmpa_t(operand, &address)) -        { -            if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), &label, &symtype, &address)) -            { -                switch (symtype) -                { -                    case STP_OBJECT: -                    case STP_FUNCTION: -                        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                               " ", 1, RTT_NONE); -                        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                               "<", 1, RTT_LTGT); - -                        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                               label, strlen(label), RTT_LTGT); - -                        if (address > 0) -                        { -                            g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                                   "+", 1, RTT_LTGT); - -                            snprintf(value, VMPA_MAX_SIZE, "0x%llx", address); - -                            g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                                   value, strlen(value), RTT_LTGT); - -                        } - -                        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                               ">", 1, RTT_LTGT); - -                        break; - -                    case STP_STRING: -                        printable = strdup(label); -                        printable = escape_crlf(printable); -                        /*printable = strrpl(printable, "<", "<"); -                        printable = strrpl(printable, ">", ">");*/ - -                        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                               " ", 1, RTT_NONE); -                        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                               "\"", 1, RTT_STRING); -                        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                               printable, strlen(printable), RTT_STRING); -                        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                               "\"", 1, RTT_STRING); - -                        free(printable); - -                        break; - -                } - -            } - -        } - -    } - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : operand = opérande à traiter.                                *  *                addr    = valeur résultante. [OUT]                           *  *                                                                             * diff --git a/src/arch/instruction.c b/src/arch/instruction.c index eb8ec28..14b0038 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -44,9 +44,6 @@ static void g_arch_instruction_add_text(const GArchInstruction *, GRenderingOpti  /*  Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_arch_instruction_to_buffer(const GArchInstruction *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu d'une instruction. */ -static void g_arch_instruction_add_to_gtk_buffer(const GArchInstruction *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* Indique le type défini pour une instruction d'architecture. */ @@ -91,7 +88,6 @@ static void g_arch_instruction_init(GArchInstruction *instr)      parent->add_text = (add_text_fc)g_arch_instruction_add_text;      parent->export_buffer = (export_buffer_fc)g_arch_instruction_to_buffer; -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_arch_instruction_add_to_gtk_buffer;  } @@ -206,60 +202,6 @@ static void g_arch_instruction_to_buffer(const GArchInstruction *instr, GBufferL  /******************************************************************************  *                                                                             * -*  Paramètres  : instr   = instruction à transcrire.                          * -*                format = format du binaire manipulé.                         * -*                syntax = type de représentation demandée.                    * -*                buffer = zone de texte à venir compléter.                    * -*                iter   = point d'insertion du nouveau texte.                 * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'une instruction.          * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_arch_instruction_add_to_gtk_buffer(const GArchInstruction *instr, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    const char *key;                        /* Mot clef principal          */ -    size_t klen;                            /* Taille de ce mot clef       */ -    size_t i;                               /* Boucle de parcours          */ - -    key = instr->get_text(instr, format, syntax); -    klen = strlen(key); - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(instr), buffer, iter, -                                           key, klen, RTT_INSTRUCTION); - -    if (instr->operands_count > 0) -    { -        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(instr), buffer, iter, -                                               "\t", 1, RTT_NONE); - -        g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[0]), -                                                  format, syntax, buffer, iter); - -        for (i = 1; i < instr->operands_count; i++) -        { -            g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(instr), buffer, iter, -                                                   ",", 1, RTT_NONE/* FIXME */); - -            g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(instr), buffer, iter, -                                                   " ", 1, RTT_NONE); - -            g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(G_ARCH_INSTRUCTION(instr)->operands[i]), -                                                      format, syntax, buffer, iter); - -        } - -    } - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : instr   = instruction quelconque à modifier.                 *  *                offset  = position physique dans le code binaire.            *  *                length  = taille de l'instruction.                           * diff --git a/src/arch/x86/operand.c b/src/arch/x86/operand.c index 0a571a7..849e54d 100644 --- a/src/arch/x86/operand.c +++ b/src/arch/x86/operand.c @@ -95,9 +95,6 @@ static void g_x86_register_operand_add_text(const GX86RegisterOperand *, GRender  /*Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_x86_register_operand_to_buffer(const GX86RegisterOperand *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu d'un opérande. */ -static void g_x86_register_operand_add_to_gtk_buffer(const GX86RegisterOperand *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* ----------------------- OPERANDES COMPLEXES DE TYPE MOD/RM ----------------------- */ @@ -136,9 +133,6 @@ static void g_x86_mod_rm_operand_add_text(const GX86ModRMOperand *, GRenderingOp  /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_x86_mod_rm_operand_to_buffer(const GX86ModRMOperand *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu d'un opérande. */ -static void g_x86_mod_rm_operand_add_to_gtk_buffer(const GX86ModRMOperand *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* ------------------------- OPERANDES D'ADRESSES RELATIVES ------------------------- */ @@ -173,9 +167,6 @@ static void g_x86_relative_operand_add_text(const GX86RelativeOperand *, GRender  /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_x86_relative_operand_to_buffer(const GX86RelativeOperand *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu d'un opérande. */ -static void g_x86_relative_operand_add_to_gtk_buffer(const GX86RelativeOperand *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* ------------------------ OPERANDES D'EMPLACEMENTS MEMOIRE ------------------------ */ @@ -210,9 +201,6 @@ static void g_x86_moffs_operand_add_text(const GX86MOffsOperand *, GRenderingOpt  /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_x86_moffs_operand_to_buffer(const GX86MOffsOperand *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu d'un opérande. */ -static void g_x86_moffs_operand_add_to_gtk_buffer(const GX86MOffsOperand *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* ---------------------- OPERANDES DE MANIPULATION DE DONNEES ---------------------- */ @@ -248,9 +236,6 @@ static void g_x86_data_operand_add_text(const GX86DataOperand *, GRenderingOptio  /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_x86_data_operand_to_buffer(const GX86DataOperand *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu d'un opérande. */ -static void g_x86_data_operand_add_to_gtk_buffer(const GX86DataOperand *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* ---------------------------------------------------------------------------------- */ @@ -346,7 +331,6 @@ static void g_x86_register_operand_init(GX86RegisterOperand *operand)      parent->add_text = (add_text_fc)g_x86_register_operand_add_text;      parent->export_buffer = (export_buffer_fc)g_x86_register_operand_to_buffer; -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_x86_register_operand_add_to_gtk_buffer;  } @@ -510,29 +494,6 @@ static void g_x86_register_operand_to_buffer(const GX86RegisterOperand *operand,  } -/****************************************************************************** -*                                                                             * -*  Paramètres  : operand = opérande à transcrire.                             * -*                format = format du binaire manipulé.                         * -*                syntax = type de représentation demandée.                    * -*                buffer = zone de texte à venir compléter.                    * -*                iter   = point d'insertion du nouveau texte.                 * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'un opérande.              * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_x86_register_operand_add_to_gtk_buffer(const GX86RegisterOperand *operand, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(operand->reg), format, syntax, buffer, iter); - -} - -  /* ---------------------------------------------------------------------------------- */  /*                         OPERANDES COMPLEXES DE TYPE MOD/RM                         */ @@ -581,7 +542,6 @@ static void g_x86_mod_rm_operand_init(GX86ModRMOperand *operand)      parent->add_text = (add_text_fc)g_x86_mod_rm_operand_add_text;      parent->export_buffer = (export_buffer_fc)g_x86_mod_rm_operand_to_buffer; -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_x86_mod_rm_operand_add_to_gtk_buffer;  } @@ -851,90 +811,6 @@ static void g_x86_mod_rm_operand_to_buffer(const GX86ModRMOperand *operand, GBuf  /******************************************************************************  *                                                                             * -*  Paramètres  : operand = opérande à transcrire.                             * -*                format  = format du binaire manipulé.                        * -*                syntax  = type de représentation demandée.                   * -*                buffer  = zone de texte à venir compléter.                   * -*                iter    = point d'insertion du nouveau texte.                * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'un opérande.              * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_x86_mod_rm_operand_add_to_gtk_buffer(const GX86ModRMOperand *operand, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    char tmp[2];                            /* Echelle en puissance de 2   */ - -    switch (syntax) -    { -        case ASX_INTEL: - -            g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                   "[", 1, RTT_HOOK); - -            if (operand->scale > 0) -            { -                snprintf(tmp, 2, "%d", (int)pow(2, operand->scale));  - -                g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                       tmp, 1, RTT_IMMEDIATE); - -                g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                       "*", 1, RTT_SIGNS); - -            } - -            g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(operand->index), -                                                      format, syntax, buffer, iter); - -            if (operand->base != NULL) -            { -                g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                       "+", 1, RTT_SIGNS); - -                g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(operand->base), -                                                          format, syntax, buffer, iter); - -            } - -            if (operand->displacement != NULL) -            { -                if (g_imm_operand_is_negative(operand->displacement)) -                    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                           "-", 1, RTT_SIGNS); -                else -                    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                           "+", 1, RTT_SIGNS); - -                g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(operand->displacement), -                                                          format, syntax, buffer, iter); - -            } - -            g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                   "]", 1, RTT_HOOK); - -            break; - -        case ASX_ATT: - -            /* TODO */ -            g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                                   "[ModRM]", 7, RTT_HOOK); - -            break; - -    } - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : operand = opérande à consulter.                              *  *                scale   = facteur sous forme de puissance de deux. [OUT      *  *                index   = register principal de l'opérande. [OUT]            * @@ -1041,7 +917,6 @@ static void g_x86_relative_operand_init(GX86RelativeOperand *operand)      parent->add_text = (add_text_fc)g_x86_relative_operand_add_text;      parent->export_buffer = (export_buffer_fc)g_x86_relative_operand_to_buffer; -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_x86_relative_operand_add_to_gtk_buffer;  } @@ -1145,30 +1020,6 @@ static void g_x86_relative_operand_to_buffer(const GX86RelativeOperand *operand,  /******************************************************************************  *                                                                             * -*  Paramètres  : operand = opérande à transcrire.                             * -*                format  = format du binaire manipulé.                        * -*                syntax  = type de représentation demandée.                   * -*                buffer  = zone de texte à venir compléter.                   * -*                iter    = point d'insertion du nouveau texte.                * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'un opérande.              * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_x86_relative_operand_add_to_gtk_buffer(const GX86RelativeOperand *operand, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(operand->immediate), -                                              format, syntax, buffer, iter); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : operand = opérande à traiter.                                *  *                                                                             *  *  Description : Fournit l'adresse relative représentée par une opérande X86. * @@ -1234,7 +1085,6 @@ static void g_x86_moffs_operand_init(GX86MOffsOperand *operand)      parent->add_text = (add_text_fc)g_x86_moffs_operand_add_text;      parent->export_buffer = (export_buffer_fc)g_x86_moffs_operand_to_buffer; -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_x86_moffs_operand_add_to_gtk_buffer;  } @@ -1322,33 +1172,6 @@ static void g_x86_moffs_operand_to_buffer(const GX86MOffsOperand *operand, GBuff  } -/****************************************************************************** -*                                                                             * -*  Paramètres  : operand = opérande à transcrire.                             * -*                format = format du binaire manipulé.                         * -*                syntax = type de représentation demandée.                    * -*                buffer = zone de texte à venir compléter.                    * -*                iter   = point d'insertion du nouveau texte.                 * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'un opérande.              * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_x86_moffs_operand_add_to_gtk_buffer(const GX86MOffsOperand *operand, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                           "ds:", 3, RTT_SEGMENT); - -    g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(operand->offset), -                                              format, syntax, buffer, iter); - -} - -  /* ---------------------------------------------------------------------------------- */  /*                        OPERANDES DE MANIPULATION DE DONNEES                        */ @@ -1397,7 +1220,6 @@ static void g_x86_data_operand_init(GX86DataOperand *operand)      parent->add_text = (add_text_fc)g_x86_data_operand_add_text;      parent->export_buffer = (export_buffer_fc)g_x86_data_operand_to_buffer; -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_x86_data_operand_add_to_gtk_buffer;  } @@ -1502,43 +1324,6 @@ static void g_x86_data_operand_to_buffer(const GX86DataOperand *operand, GBuffer  } -/****************************************************************************** -*                                                                             * -*  Paramètres  : operand = opérande à transcrire.                             * -*                format  = format du binaire manipulé.                        * -*                syntax  = type de représentation demandée.                   * -*                buffer  = zone de texte à venir compléter.                   * -*                iter    = point d'insertion du nouveau texte.                * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'un opérande.              * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_x86_data_operand_add_to_gtk_buffer(const GX86DataOperand *operand, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    if (operand->dest) -        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                               "es:", 3, RTT_SEGMENT); -    else -        g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                               "ds:", 3, RTT_SEGMENT); - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                           "[", 1, RTT_HOOK); - -    g_content_exporter_add_arch_to_gtk_buffer(G_CONTENT_EXPORTER(operand->reg), format, -                                              syntax, buffer, iter); - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(operand), buffer, iter, -                                           "]", 1, RTT_HOOK); - -} - -  /* ---------------------------------------------------------------------------------- */  /*                           AIDE A LA CREATION D'OPERANDES                           */ diff --git a/src/arch/x86/registers.c b/src/arch/x86/registers.c index 8a61d09..18756b3 100644 --- a/src/arch/x86/registers.c +++ b/src/arch/x86/registers.c @@ -118,9 +118,6 @@ static void g_x86_register_add_text(const GX86Register *, GRenderingOptions *, M  /* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */  static void g_x86_register_to_buffer(const GX86Register *, GBufferLine *, GRenderingOptions *); -/* Ajoute à un texte GTK le contenu d'un opérande. */ -static void g_x86_register_add_to_gtk_buffer(const GX86Register *, const GExeFormat *, AsmSyntax, GtkTextBuffer *, GtkTextIter *); -  /* Indique le type défini pour une représentation d'un registre x86. */ @@ -165,7 +162,6 @@ static void g_x86_register_init(GX86Register *reg)      parent->add_text = (add_text_fc)g_x86_register_add_text;      parent->export_buffer = (export_buffer_fc)g_x86_register_to_buffer; -    parent->add_arch_to_gtk_buffer = (add_arch_to_gtk_buffer_fc)g_x86_register_add_to_gtk_buffer;  } @@ -556,35 +552,6 @@ static void g_x86_register_to_buffer(const GX86Register *reg, GBufferLine *buffe  /******************************************************************************  *                                                                             * -*  Paramètres  : operand = opérande à transcrire.                             * -*                format = format du binaire manipulé.                         * -*                syntax = type de représentation demandée.                    * -*                buffer = zone de texte à venir compléter.                    * -*                iter   = point d'insertion du nouveau texte.                 * -*                                                                             * -*  Description : Ajoute à un texte GTK le contenu d'un opérande.              * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_x86_register_add_to_gtk_buffer(const GX86Register *reg, const GExeFormat *format, AsmSyntax syntax, GtkTextBuffer *buffer, GtkTextIter *iter) -{ -    char key[MAX_REGNAME_LEN];              /* Mot clef principal          */ -    size_t klen;                            /* Taille de ce mot clef       */ - -    g_x86_register_to_string(reg, syntax, key, &klen); - -    g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(reg), buffer, iter, -                                           key, klen, RTT_REGISTER); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : reg = registre à consulter.                                  *  *                                                                             *  *  Description : Indique si le registre correspond à ebp ou similaire.        * diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c index 2ea7ae2..70cd8ea 100644 --- a/src/gtkext/gtkblockview.c +++ b/src/gtkext/gtkblockview.c @@ -27,9 +27,6 @@  #include <malloc.h>  #include <string.h> -#define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API -#include <gtk/gtktextdisplay.h> -  #include "gtkbinview-int.h"  #include "support.h" @@ -39,7 +36,6 @@  #include "../glibext/gcodebuffer.h" -#include "../glibext/gbuffersegment.h"  #ifndef _ @@ -108,8 +104,6 @@ struct _GtkBlockView      bool show_code;                         /* Affichage du code brut ?    */      GBufferView *buffer_view;               /* Code sous forme de texte    */ -    GtkTextBuffer *buffer;                  /* Code sous forme de texte    */ -    GtkTextLayout *layout;                  /* Disposition du texte        */      gint line_height;                       /* Hauteur maximale des lignes */      gint left_margin;                       /* Marge gauche + espace       */ @@ -141,24 +135,6 @@ struct _GtkBlockViewClass -static void -gtk_text_view2_set_attributes_from_style (GtkTextAttributes  *values, -                                         GtkStyle           *style) -{ -    PangoFontDescription *font_desc; - -  values->appearance.bg_color = style->base[GTK_STATE_NORMAL]; -  values->appearance.fg_color = style->text[GTK_STATE_NORMAL]; - -  if (values->font) -    pango_font_description_free (values->font); - -        font_desc = pango_font_description_from_string ("mono 10"); - -  values->font = pango_font_description_copy (/*style->*/font_desc); -        pango_font_description_free (font_desc); -} -  /* Procède à l'initialisation de l'afficheur d'un bloc binaire. */  static void gtk_block_view_init(GtkBlockView *); @@ -524,13 +500,6 @@ static void gtk_block_view_init(GtkBlockView *view)  {      GtkBinView *binview;                    /* Instance parente            */ - -    PangoFontDescription *font_desc; -    PangoContext *ltr_context, *rtl_context; -    GtkTextAttributes *style; -    static bool done = false; - -      binview = GTK_BIN_VIEW(view);      binview->scroll = (scroll_fc)gtk_block_view_scroll; @@ -538,66 +507,6 @@ static void gtk_block_view_init(GtkBlockView *view)      binview->get_coordinates = (get_addr_coordinates_fc)gtk_block_view_get_address_coordinates; - -    view->buffer = gtk_text_buffer_new(get_gtk_tag_table()); - - - -    view->layout = gtk_text_layout_new(); - - - -    if (!done || 1) -    { -        done = true; - -        gtk_text_layout_set_overwrite_mode(GTK_BLOCK_VIEW(view)->layout, FALSE); - - -        ltr_context = gtk_widget_create_pango_context(view); -        pango_context_set_base_dir(ltr_context, PANGO_DIRECTION_LTR); -        rtl_context = gtk_widget_create_pango_context(view); -        pango_context_set_base_dir(rtl_context, PANGO_DIRECTION_RTL); - -        gtk_text_layout_set_contexts(GTK_BLOCK_VIEW(view)->layout, ltr_context, rtl_context); - - - -        style = gtk_text_attributes_new (); - -        gtk_widget_ensure_style(view); - -        font_desc = pango_font_description_from_string ("mono 10"); -        gtk_widget_modify_font (view, font_desc); -        pango_font_description_free (font_desc); - -        gtk_text_view2_set_attributes_from_style(style, GTK_WIDGET(view)->style); -        /* -        style->pixels_above_lines = 5; -        style->pixels_below_lines = 5; -        style->pixels_inside_wrap = 10; -        style->left_margin = 10; -        style->right_margin = 10; -        style->indent = 10;*/ -        style->left_margin = 10; -        style->right_margin = 10; - -        style->wrap_mode = GTK_WRAP_NONE; -        style->justification = GTK_JUSTIFY_LEFT; - -        style->direction = gtk_widget_get_direction(view); - - -        gtk_text_layout_set_default_style(GTK_BLOCK_VIEW(view)->layout, style); - -        gtk_text_attributes_unref(style); - - -        //gtk_text_layout_get_size (GTK_BLOCK_VIEW(view)->layout, &width, &height); - -    } - -      view->_buffer = g_code_buffer_new(); @@ -734,7 +643,7 @@ static gboolean gtk_block_view_button_press(GtkWidget *widget, GdkEventButton *e      GRenderingLine *line;                   /* Ligne de rendu              */      result = FALSE; - +#if 0      view = GTK_BLOCK_VIEW(widget);      gtk_text_layout_get_line_at_y(view->layout, &iter, event->y, NULL); @@ -748,7 +657,7 @@ static gboolean gtk_block_view_button_press(GtkWidget *widget, GdkEventButton *e          result = TRUE;          g_rendering_line_toggle_flag(line, RLF_BREAK_POINT);      } - +#endif      return result;  } @@ -1127,64 +1036,16 @@ static void gtk_block_view_set_rendering_lines(GtkBlockView *view, GRenderingLin  static void gtk_block_view_complete_building_content(GDelayedInsertion *insertion, GtkBlockView *view)  { -    size_t lengths[SAR_COUNT];              /* Différentes tailles de zone */ -    GtkTextIter pos;                        /* Point d'insertion           */ -    PangoTabArray *tabs;                    /* Tailles de tabulation       */ -    GdkRectangle rect;                      /* Zone d'un point             */ - -    lengths[SAR_ADDRESS] = insertion->lengths[SAR_ADDRESS]; -    lengths[SAR_CODE] = insertion->lengths[SAR_CODE]; -    lengths[SAR_INSTRUCTION] = insertion->lengths[SAR_INSTRUCTION]; -      gdk_threads_enter(); -    gtk_text_layout_set_buffer(view->layout, view->buffer); - -    gtk_text_layout_set_cursor_visible(GTK_BLOCK_VIEW(view)->layout, FALSE); - -    gtk_text_buffer_get_end_iter(view->buffer, &pos); -    gtk_text_layout_move_iter_visually(view->layout, &pos, -1); -    gtk_text_layout_get_iter_location(view->layout, &pos, &rect); - -    /* Taille des tabulations */ - -    if (lengths[SAR_ADDRESS] > 0 && lengths[SAR_CODE] > 0) -        tabs = pango_tab_array_new_with_positions(3, TRUE, -                                                  PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3), -                                                  PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3 + lengths[SAR_CODE] + 3), -                                                  PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3 + lengths[SAR_CODE] + 3 + lengths[SAR_INSTRUCTION] + 4)); - -    else if (lengths[SAR_ADDRESS] > 0 && lengths[SAR_CODE] == 0) -        tabs = pango_tab_array_new_with_positions(2, TRUE, -                                                  PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3), -                                                  PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3 + lengths[SAR_INSTRUCTION] + 4)); - -    else if (lengths[SAR_ADDRESS] == 0 && lengths[SAR_CODE] > 0) -        tabs = pango_tab_array_new_with_positions(2, TRUE, -                                                  PANGO_TAB_LEFT, rect.width * (lengths[SAR_CODE] + 3), -                                                  PANGO_TAB_LEFT, rect.width * (lengths[SAR_CODE] + 3 + lengths[SAR_INSTRUCTION] + 4)); - -    else -        tabs = pango_tab_array_new_with_positions(1, TRUE, -                                                  PANGO_TAB_LEFT, rect.width * (lengths[SAR_INSTRUCTION] + 4)); - -    if (view->layout->default_style->tabs) -        pango_tab_array_free(view->layout->default_style->tabs); - -    view->layout->default_style->tabs = tabs; - -    gtk_text_layout_default_style_changed(view->layout); -      /* Taille des marges */ - +#if 0      view->line_height = rect.height;      view->left_margin = 2 * rect.height;      view->left_text = -2.5 * rect.height; - +#endif      /* Validation finale */ -    gtk_text_layout_validate(GTK_BLOCK_VIEW(view)->layout, G_MAXINT); -      gtk_block_view_recompute_size_request(view);      gdk_flush (); @@ -31,7 +31,6 @@  #include "editor.h"  #include "params.h"  #include "project.h" -#include "analysis/exporter.h"  #include "arch/processor.h"  #include "format/format.h"  #include "format/mangling/demangler.h" @@ -103,8 +102,6 @@ int main(int argc, char **argv)      init_all_demanglers();      init_all_formats(); -    _get_gtk_tag_table(gtk_text_tag_table_new()); -      /* Création de l'interface */      init_internal_panels(); @@ -131,8 +128,6 @@ int main(int argc, char **argv)      gtk_main();      gdk_threads_leave(); -    _get_gtk_tag_table(0xdeadc0de); -      unload_configuration(config);      return EXIT_SUCCESS; | 
