summaryrefslogtreecommitdiff
path: root/src/format/dwarf/dwarf-int.h
blob: 8e35b327c4ae9e72112657c2f69db308812473a6 (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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185

/* Chrysalide - Outil d'analyse de fichiers binaires
 * dwarf-int.h - prototypes pour les structures internes du format 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 Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _FORMAT_DWARF_DWARF_INT_H
#define _FORMAT_DWARF_DWARF_INT_H


#include "dwarf.h"


#include <stdint.h>




#include "../debuggable-int.h"

#include "abbrev.h"
#include "die.h"
#include "dwarf_def.h"





/* Procède à la lecture d'un attribut d'abréviation DWARF. */
bool read_dwarf_abbrev_attr(const GDwarfFormat *, vmpa2t *, dw_abbrev_raw_attr *);

/* Procède à la lecture d'une déclaration d'abréviation DWARF. */
bool read_dwarf_abbrev_decl(const GDwarfFormat *, vmpa2t *, dw_abbrev_decl *);




/* En-tête présente dans certaines sections */
typedef struct _dw_section_header
{
    uint64_t unit_length;                   /* Taille totale sans le champ */
    bool is_32b;                            /* Le format est-il sur 32b ?  */

    uint16_t version;                       /* Version de la section       */

} dw_section_header;






/* Procède à la lecture de l'en-tête d'un contenu binaire ELF. */
bool read_dwarf_section_header(GBinContent *, vmpa2t *, SourceEndian, dw_section_header *);





/* Procède à la lecture de l'en-tête d'une unité de compilation. */
bool read_dwarf_compil_unit_header(GBinContent *, vmpa2t *, SourceEndian, dw_compil_unit_header *);



///---------------------




//-------------------------------





/* Lit la valeur correspondant à un type donné. */
typedef bool (* read_form_value_fc) (const GDwarfFormat *, const dw_compil_unit_header *, DwarfForm, vmpa2t *, dw_form_value *);


/* Format de débogage DWARF (instance) */
struct _GDwarfFormat
{
    GDbgFormat parent;                      /* A laisser en premier        */

    dw_abbrev *abbreviations;               /* Racine des abbréviations    */


    dw_die *info_die;



};

/* Format de débogage DWARF (classe) */
struct _GDwarfFormatClass
{
    GDbgFormatClass parent;                 /* A laisser en premier        */

    read_form_value_fc read_form;           /* lecture de valeurs formatées*/

};





/* Charge de façon générique toutes les informations DWARF. */
bool g_dwarf_format_load(GDwarfFormat *, GExeFormat *);
















/* Format du DWARF */
typedef enum _DwarfFormat
{
    DWF_32_BITS,                            /* Mode 32 bits                */
    DWF_64_BITS                             /* Mode 64 bits                */

} DwarfFormat;





/* Eléments récupérés sur une fonction */
typedef struct _dw_dbg_function
{
    char *name;                             /* Nom de la fonction          */
    char *prototype;                        /* Chaîne descriptive          */

    uint64_t low_pc;                        /* Début de la fonction        */
    uint64_t high_pc;                       /* Fin de la fonction          */

} dw_dbg_function;


#if 0
/* Description du format DWARF */
struct _dwarf_format
{
    dbg_format dummy;                       /* A laisser en premier        */

    DwarfFormat format;                     /* Format de l'instance        */

    dw_abbrev **abbrevs;                    /* Liste des abréviations      */
    size_t abbrevs_count;                   /* Nombre de ces abréviations  */

    dw_dbg_function **dbg_functions;        /* Liste de fonctions trouvées */
    size_t dbg_fc_count;                    /* Nombre de ces fonctions     */

};
#endif



#endif  /* _FORMAT_DWARF_DWARF_INT_H */