summaryrefslogtreecommitdiff
path: root/src/analysis/line.h
blob: bb628b626ff3119871e1241ebbad7b89324e4301 (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
132
133
134
135
136

/* 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               */

} 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   */
    asm_processor *proc;                    /* Architecture utilisée       */

} disass_options;



/* Ligne de représentation générique */
typedef struct _rendering_line rendering_line;


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

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

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




/* Ajoute une ligne à un ensemble existant. */
void add_line_to_rendering_lines(rendering_line **, rendering_line *);

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

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



/* Met à jour la nombre d'octets maximale par instruction. */
void get_rendering_line_binary_len(rendering_line *, off_t *);

/* Prend en compte le nombre d'octets maximal par instruction. */
void set_rendering_line_max_binary_len(rendering_line *, off_t);

/* Fournit les dimensions d'une ligne par rapport à d'autres. */
void get_rendering_line_size(rendering_line *, int *, int *);

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



/* ------------------------- LIGNE EN TETE DE DESASSEMBLAGE ------------------------- */


/* Crée une des lignes de description initiales. */
rendering_line *create_prologue_line(const char *);



/* ----------------------- COMMENTAIRES SUR UNE LIGNE ENTIERE ----------------------- */


/* Crée une ligne de commentaires entière. */
rendering_line *create_comment_line(uint64_t, RenderingLineType, const char *, const disass_options *);



/* ------------------------ LIGNE DE CODE EN LANGAGE MACHINE ------------------------ */


/* Crée une ligne de représentation de code binaire. */
rendering_line *create_code_line(asm_instr *, uint64_t, const disass_options *);






#endif  /* _ANALYSIS_LINE_H */