summaryrefslogtreecommitdiff
path: root/plugins/dwarf/abbrev.h
blob: b5fe3be0765a6b36925e2cd8592d5cd1d6e4d168 (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

/* Chrysalide - Outil d'analyse de fichiers binaires
 * abbrev.h - prototypes pour la manipulation des abréviation DWARF
 *
 * Copyright (C) 2008-2017 Cyrille Bagard
 *
 *  This file is part of Chrysalide.
 *
 *  Chrysalide 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.
 *
 *  Chrysalide 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 Chrysalide.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _FORMAT_DWARF_ABBREV_H
#define _FORMAT_DWARF_ABBREV_H


#include <stdbool.h>


#include "dwarf.h"
#include "dwarf_def.h"




/* Description d'une abréviation */
typedef struct _dw_abbrev dw_abbrev;







/* Charge toutes les abbréviations présentes dans un DWARF. */
bool load_all_dwarf_abbreviations(GDwarfFormat *);

/* Charge une abréviation valide pour un DWARF en mémoire. */
bool load_dwarf_abbreviation(const GDwarfFormat *, vmpa2t *, dw_abbrev **);

/* Supprime de la mémoire toute trace d'une abréviation DWARF. */
void free_dwarf_abbreviation(dw_abbrev *);

/* Fournit l'étiquette associée à l'ensemble des attributs. */
DwarfTag dwarf_abbreviation_get_tag(const dw_abbrev *);

/* Compte le nombre d'attributs présents dans une abréviation. */
size_t dwarf_abbreviation_count_attribs(const dw_abbrev *);

/* Recherche un attribut dans une abréviation. */
bool dwarf_abbreviation_get_attrib_index(const dw_abbrev *, DwarfAttrib, size_t *);


/* Détermine le type d'un attribut dans une abréviation. */
bool dwarf_abbreviation_get_form_for_index(const dw_abbrev *, size_t, DwarfForm *);


/* Indique si une abbréviation comporte des sous-définitions. */
bool dwarf_abbreviation_has_children(const dw_abbrev *);



/* Recherche une abréviation DWARF donnée. */
const dw_abbrev *find_dwarf_abbreviations(const GDwarfFormat *, uleb128_t);

/* Lit la valeur correspondant à un type donné. */
dw_value *translate_abbreviation_attributes(const GDwarfFormat *, const dw_abbrev *, const dw_compil_unit_header *, vmpa2t *);













#if 0


#include <stdbool.h>


#include "d_dwarf.h"
#include "dwarf-int.h"



/* Charge les abréviations trouvées pour un DWARF. */
bool load_dwarf_abbreviations(dwarf_format *);

/* Décharge les abréviations trouvées pour un DWARF. */
void unload_dwarf_abbreviations(dwarf_format *);

/* Recherche une abréviation DWARF donnée. */
const dw_abbrev *find_dwarf_abbreviations(dwarf_format *, const off_t *, off_t *);

/* Indique la présence ou l'absence d'un attribut donné. */
bool test_dwarf_abbrev_attribute(const dw_abbrev *, DwarfAttrib);

/* Lit la valeur d'un attribut DWARF. */
bool read_dwarf_abbrev_attribute(dwarf_format *, off_t *, bool, const dw_abbrev *, DwarfAttrib, ...);

/* Fait avancer la tête de lecture d'une seule abréviation. */
bool skip_dwarf_abbrev(dwarf_format *, off_t *, const dw_abbrev *);


#endif



#endif  /* _FORMAT_DWARF_ABBREV_H */