summaryrefslogtreecommitdiff
path: root/src/analysis/disass/dragon.h
blob: c6f6fd51341c7d0462fef1e258fbd36878e5a451 (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

/* Chrysalide - Outil d'analyse de fichiers binaires
 * dragon.h - prototypes pour les capacités apportées par la lecture du livre du dragon
 *
 * Copyright (C) 2016 Cyrille Bagard
 *
 *  This file is part of Chrysalide.
 *
 *  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_DISASS_DRAGON_H
#define _ANALYSIS_DISASS_DRAGON_H


#include "../../arch/processor.h"
#include "../../common/bits.h"



/* -------------------------- DECOUPAGES DE CODE EN NOEUDS -------------------------- */


/* Description de noeud, en référence à "Compilers: Principles, Techniques, and Tools" */
typedef struct _dragon_node dragon_node;


/* Fournit les instructions bornant un noeud de code. */
void get_dragon_node_bounding_instructions(dragon_node *, GArchInstruction **, GArchInstruction **);

/* Fournit un noeud particulier à partir d'une liste. */
dragon_node *get_dragon_node(dragon_node *, size_t);

/* Fournit l'indice d'un noeud particulier à partir d'une liste. */
size_t get_dragon_node_index(dragon_node *, dragon_node *);

/* Recherche un noeud selon son intruction de départ. */
dragon_node *find_node_for_instruction(dragon_node *, size_t, bool, const GArchInstruction *);

/* Détermine toute la chaîne hiérarchique de domination. */
void compute_all_dominators(dragon_node *, size_t);

/* Fournit la liste des noeuds dominés par un noeud. */
const bitfield_t *get_domination_bits(const dragon_node *);






/* ---------------------------- ENCAPSULATION DES NOEUDS ---------------------------- */


/* Concentration de tous les efforts */
typedef struct _dragon_knight dragon_knight;


/* Attaque la complexité d'un code en créant des noeuds. */
dragon_knight *begin_dragon_knight(const GArchProcessor *, const instr_coverage *, const mrange_t *, const vmpa2t *);

/* Supprime de la mémoire les données d'une complexité de code. */
void end_dragon_knight(dragon_knight *);

/* Fournit les éléments utiles à un traitement de blocs de code. */
void get_dragon_knight_content(dragon_knight *, dragon_node **, size_t *);



#endif  /* _ANALYSIS_DISASS_DRAGON_H */