diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/analysis/disass/output.c | 6 | ||||
| -rw-r--r-- | src/format/elf/symbols.c | 2 | ||||
| -rw-r--r-- | src/format/symbol.c | 4 | ||||
| -rw-r--r-- | src/glibext/gbufferline.c | 64 | ||||
| -rw-r--r-- | src/glibext/gbufferline.h | 15 | 
5 files changed, 87 insertions, 4 deletions
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 2ecb5f4..355d458 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -232,6 +232,12 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form              if (cmp_vmpa_by_virt(iaddr, saddr) == 0)              { + +                /* Point d'entrée ? */ + +                if (g_binary_symbol_get_target_type(symbols[sym_index]) == STP_ENTRY_POINT) +                    g_buffer_line_add_flag(line, BLF_ENTRYPOINT); +                  /* Commentaire ? */                  comment = g_binary_symbol_get_comment(symbols[sym_index]); diff --git a/src/format/elf/symbols.c b/src/format/elf/symbols.c index 31fbabd..c09c429 100644 --- a/src/format/elf/symbols.c +++ b/src/format/elf/symbols.c @@ -244,7 +244,7 @@ static void register_elf_entry_point(GElfFormat *format, virt_t vaddr, phys_t le  	g_binary_routine_set_range(routine, &range); -	symbol = g_binary_symbol_new(STP_ROUTINE, "XXX", ~0); +	symbol = g_binary_symbol_new(STP_ENTRY_POINT, "XXX", ~0);  	g_binary_symbol_attach_routine(symbol, routine);  	g_binary_format_add_symbol(base, symbol); diff --git a/src/format/symbol.c b/src/format/symbol.c index 1e6063f..ce5c837 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -225,6 +225,7 @@ const char *g_binary_symbol_to_string(const GBinSymbol *symbol)      switch (symbol->type)      {          case STP_ROUTINE: +        case STP_ENTRY_POINT:              result = g_binary_routine_get_name(symbol->extra.routine);              break; @@ -275,6 +276,7 @@ const char *g_binary_symbol_get_label(const GBinSymbol *symbol)      switch (symbol->type)      {          case STP_ROUTINE: +        case STP_ENTRY_POINT:              result = g_binary_routine_get_name(symbol->extra.routine);              break; @@ -325,6 +327,7 @@ void g_binary_symbol_fix_range(GBinSymbol *symbol, const vmpa2t *full)              break;          case STP_ROUTINE: +        case STP_ENTRY_POINT:              routine = g_binary_symbol_get_routine(symbol); @@ -371,6 +374,7 @@ const mrange_t *g_binary_symbol_get_range(const GBinSymbol *symbol)              break;          case STP_ROUTINE: +        case STP_ENTRY_POINT:              result = g_binary_routine_get_range(symbol->extra.routine);              break; diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c index 54f5fb6..824578d 100644 --- a/src/glibext/gbufferline.c +++ b/src/glibext/gbufferline.c @@ -95,6 +95,8 @@ struct _GBufferLine      BufferLineColumn merge_start;           /* Début de la zone globale    */      BufferLineColumn last_used;             /* Dernière colonne utilisée   */ +    BufferLineFlags flags;                  /* Drapeaux particuliers       */ +  };  /* Représentation de fragments de texte en ligne (classe) */ @@ -102,6 +104,7 @@ struct _GBufferLineClass  {      GObjectClass parent;                    /* A laisser en premier        */ +    cairo_surface_t *entrypoint_img;        /* Image pour les entrées      */      cairo_surface_t *bookmark_img;          /* Image pour les signets      */  }; @@ -440,6 +443,13 @@ static void g_buffer_line_class_init(GBufferLineClass *class)  {      gchar *filename;                        /* Chemin d'accès à utiliser   */ +    filename = find_pixmap_file("entrypoint.png"); +    /* assert(filename != NULL); */ + +    class->entrypoint_img = cairo_image_surface_create_from_png(filename); + +    g_free(filename); +      filename = find_pixmap_file("bookmark.png");      /* assert(filename != NULL); */ @@ -1130,6 +1140,46 @@ void g_buffer_line_start_merge_at(GBufferLine *line, BufferLineColumn start)  /******************************************************************************  *                                                                             * +*  Paramètres  : line = ligne à venir compléter.                              * +*                flag = propriété à intégrer.                                 * +*                                                                             * +*  Description : Ajoute une propriété particulière à une ligne donnée.        * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +void g_buffer_line_add_flag(GBufferLine *line, BufferLineFlags flag) +{ +    line->flags |= flag; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : line = ligne à venir compléter.                              * +*                flag = propriété à supprimer.                                * +*                                                                             * +*  Description : Retire une propriété particulière à une ligne donnée.        * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +void g_buffer_line_remove_flag(GBufferLine *line, BufferLineFlags flag) +{ +    line->flags &= ~flag; + +} + + +/****************************************************************************** +*                                                                             *  *  Paramètres  : line       = ligne de texte à manipuler.                     *  *                cairo      = contexte graphique à utiliser pour les pinceaux.*  *                max_widths = largeurs de colonne à respecter.                * @@ -1151,10 +1201,18 @@ void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const gint max_widths      gint x;                                 /* Point de départ d'impression*/      BufferLineColumn i;                     /* Boucle de parcours          */ -    class = G_BUFFER_LINE_GET_CLASS(line); +    if (line->flags != BLF_NONE) +    { +        class = G_BUFFER_LINE_GET_CLASS(line); + +        if (line->flags & BLF_ENTRYPOINT) +            cairo_set_source_surface(cairo, class->entrypoint_img, 5, y); +        else if (line->flags & BLF_BOOKMARK) +            cairo_set_source_surface(cairo, class->bookmark_img, 5, y); -    cairo_set_source_surface(cairo, class->bookmark_img, 5, y); -    cairo_paint(cairo); +        cairo_paint(cairo); + +    }      x = x_init; diff --git a/src/glibext/gbufferline.h b/src/glibext/gbufferline.h index 9b35f0b..6984c37 100644 --- a/src/glibext/gbufferline.h +++ b/src/glibext/gbufferline.h @@ -83,6 +83,15 @@ typedef enum _BufferLineColumn  #define COL_MARGIN 23 +/* Propriétés particulières supplémentaires */ +typedef enum _BufferLineFlags +{ +    BLF_NONE        = 0 << 0,               /* Aucune                      */ +    BLF_ENTRYPOINT  = 1 << 0,               /* Représentation d'une entrée */ +    BLF_BOOKMARK    = 1 << 1                /* Signet associé              */ + +} BufferLineFlags; +  /* Détermine le type de la représentation de fragments de texte en ligne. */  GType g_buffer_line_get_type(void); @@ -126,6 +135,12 @@ gint g_buffer_line_get_merge_width(GBufferLine *, BufferLineColumn *, const bool  /* Définit la colonne à partir de laquelle la fusion opère. */  void g_buffer_line_start_merge_at(GBufferLine *, BufferLineColumn); +/* Ajoute une propriété particulière à une ligne donnée. */ +void g_buffer_line_add_flag(GBufferLine *, BufferLineFlags); + +/* Retire une propriété particulière à une ligne donnée. */ +void g_buffer_line_remove_flag(GBufferLine *, BufferLineFlags); +  /* Imprime la ligne de texte représentée. */  void g_buffer_line_draw(GBufferLine *, cairo_t *, const gint [BLC_COUNT], gint, gint, const bool *);  | 
