summaryrefslogtreecommitdiff
path: root/src/analysis/line.h
blob: 5744d248818e8d5cd82ebc78676e67566a1f593a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

/* OpenIDA - Outil d'analyse de fichiers binaires
 * line.h - prototypes pour la représentation des lignes de rendu
 *
 * 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 _ANALYSIS_LINE_H
#define _ANALYSIS_LINE_H


#include <stdbool.h>
#include <gtk/gtk.h>


#include "../arch/processor.h"
#include "../format/exe_format.h"



/* Définitions des types de ligne */
typedef enum _RenderingLineType
{
    RLT_PROLOGUE,                           /* Description de l'analyse    */
    RLT_PROTOTYPE,                          /* Prototype de fonction       */
    RLT_CODE                                /* Code en langage machine     */

} RenderingLineType;

/* Image à afficher en marge de ligne */
typedef enum _RenderingLineFlag
{
    RLF_NONE            = (0 << 0),         /* Ligne commune               */
    RLF_ENTRY_POINT     = (1 << 0),         /* Point d'entrée du prgm.     */
    RLF_BREAK_POINT     = (1 << 1),         /* Point d'arrêt               */
    RLF_RUNNING_BP      = (1 << 2)          /* Point d'arrêt activé        */

} RenderingLineFlag;

/* Passage de paramètres compact */
typedef struct _disass_options
{
    bool show_address;                      /* Affichage de l'adresse ?    */
    bool show_code;                         /* Affichage du code brut ?    */

    exe_format *format;                     /* Format du contenu bianire   */
    GArchProcessor *proc;                   /* Architecture utilisée       */

} disass_options;



#define G_TYPE_RENDERING_LINE               g_rendering_line_get_type()
#define G_RENDERING_LINE(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_rendering_line_get_type(), GRenderingLine))
#define G_IS_RENDERING_LINE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_rendering_line_get_type()))
#define G_RENDERING_LINE_GET_IFACE(inst)    (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_rendering_line_get_type(), GRenderingLineIface))


/* Ligne de représentation générique (instance) */
typedef struct _GRenderingLine GRenderingLine;

/* Ligne de représentation générique (classe) */
typedef struct _GRenderingLineClass GRenderingLineClass;


/* Indique le type définit pour une ligne de représentation. */
GType g_rendering_line_get_type(void);

/* Fournit le type d'une ligne. */
RenderingLineType get_rendering_line_type(const GRenderingLine *);

/* Ajoute une information supplémentaire à une ligne. */
void g_rendering_line_add_flag(GRenderingLine *, RenderingLineFlag);

/* Retire une information supplémentaire d'une ligne. */
void g_rendering_line_remove_flag(GRenderingLine *, RenderingLineFlag);

/* Bascule l'état d'une information sur d'une ligne. */
void g_rendering_line_toggle_flag(GRenderingLine *, RenderingLineFlag);

/* Fournit les informations supplémentaires d'une ligne. */
RenderingLineFlag g_rendering_line_get_flags(const GRenderingLine *);

/* Procède à l'initialisation des bases d'une représentation. */
void g_rendering_line_draw(GRenderingLine *, GdkDrawable *, GdkGC *, gint, gint, gint, gint);



/* ------------------------ TRAITEMENT DES LIGNES PAR GROUPE ------------------------ */


/* Ajoute une ligne à un ensemble existant. */
void g_rendering_line_add_to_lines(GRenderingLine **, GRenderingLine *);

/* Insère une ligne dans un ensemble existant.  */
void g_rendering_line_insert_into_lines(GRenderingLine **, GRenderingLine *, bool);

/* Fournit l'élement suivant un autre pour un parcours. */
GRenderingLine *g_rendering_line_get_next_iter(GRenderingLine *, const GRenderingLine *);

/* Met à jour le nombre d'octets maximal par instruction. */
void g_rendering_line_update_bin_len(GRenderingLine *);

/* Fournit les dimensions de lignes de représentation. */
void g_rendering_line_get_size(GRenderingLine *, int *, int *, int *);

/* Recherche une ligne d'après sa position à l'écran. */
GRenderingLine *g_rendering_line_find_by_y(GRenderingLine *, gdouble *);

/* Recherche une ligne d'après sa position en mémoire/physique. */
GRenderingLine *g_rendering_line_find_by_offset(GRenderingLine *, uint64_t);



#endif  /* _ANALYSIS_LINE_H */