/* Chrysalide - Outil d'analyse de fichiers binaires
 * dwarf-int.h - prototypes pour les structures internes du format DWARF
 *
 * Copyright (C) 2008 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 .
 */
#ifndef _FORMAT_DWARF_DWARF_INT_H
#define _FORMAT_DWARF_DWARF_INT_H
#include "dwarf.h"
#include 
#include "../debuggable-int.h"
#include "dwarf_def.h"
/* 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 *);
/* Format de débogage DWARF (instance) */
struct _GDwarfFormat
{
    GDbgFormat parent;                      /* A laisser en premier        */
};
/* Format de débogage DWARF (classe) */
struct _GDwarfFormatClass
{
    GDbgFormatClass parent;                 /* A laisser en premier        */
};
/* Format du DWARF */
typedef enum _DwarfFormat
{
    DWF_32_BITS,                            /* Mode 32 bits                */
    DWF_64_BITS                             /* Mode 64 bits                */
} DwarfFormat;
/* Description d'un attribut d'une abréviation */
typedef struct _dw_abbrev_attr
{
    DwarfAttrib attrib;                     /* Sujet de l'élément          */
    DwarfForm form;                         /* Représentation              */
} dw_abbrev_attr;
/* Description d'une abréviation */
typedef struct _dw_abbrev
{
    off_t offset;                           /* Position dans le corps      */
    DwarfTag tag;                           /* Sujet de l'élément          */
    dw_abbrev_attr *attribs;                /* Liste des attributs         */
    size_t attribs_count;                   /* Nombre de ces attributs     */
    struct _dw_abbrev **children;           /* Liste des sous-éléments     */
    size_t children_count;                  /* Nombre de ces enfants       */
} dw_abbrev;
/* 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 */