summaryrefslogtreecommitdiff
path: root/src/format/dwarf
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-08-12 19:05:31 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-08-12 19:05:31 (GMT)
commit4b2f65ed2125cd7b6ef598cf02738f6c839d8935 (patch)
treede62e9daaafe63248c45202004758e91b7341cc5 /src/format/dwarf
parentb5c6bcea25b1b840fd6c8e89a4a3c9fbd83ba84b (diff)
Extended the loading process of binary formats to prepare the DWARF support.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@568 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/dwarf')
-rw-r--r--src/format/dwarf/Makefile.am10
-rw-r--r--src/format/dwarf/dwarf-int.c75
-rw-r--r--src/format/dwarf/dwarf-int.h80
-rw-r--r--src/format/dwarf/dwarf.c212
-rw-r--r--src/format/dwarf/dwarf.h23
-rw-r--r--src/format/dwarf/v2/Makefile.am12
-rw-r--r--src/format/dwarf/v2/dwarf.c171
-rw-r--r--src/format/dwarf/v2/dwarf.h59
-rw-r--r--src/format/dwarf/v3/Makefile.am12
-rw-r--r--src/format/dwarf/v3/dwarf.c171
-rw-r--r--src/format/dwarf/v3/dwarf.h59
-rw-r--r--src/format/dwarf/v4/Makefile.am12
-rw-r--r--src/format/dwarf/v4/dwarf.c171
-rw-r--r--src/format/dwarf/v4/dwarf.h59
14 files changed, 1103 insertions, 23 deletions
diff --git a/src/format/dwarf/Makefile.am b/src/format/dwarf/Makefile.am
index 5c92107..e3889c4 100644
--- a/src/format/dwarf/Makefile.am
+++ b/src/format/dwarf/Makefile.am
@@ -2,7 +2,8 @@
noinst_LTLIBRARIES = libformatdwarf.la
libformatdwarf_la_SOURCES = \
- dwarf.h dwarf.c
+ dwarf.h dwarf.c \
+ dwarf-int.h dwarf-int.c
# libformatdwarf_la_SOURCES = \
# abbrev.h abbrev.c \
@@ -12,9 +13,16 @@ libformatdwarf_la_SOURCES = \
# info.h info.c \
# utils.h utils.c
+libformatdwarf_la_LIBADD = \
+ v2/libformatdwarfv2.la \
+ v3/libformatdwarfv3.la \
+ v4/libformatdwarfv4.la
+
libformatdwarf_la_LDFLAGS = $(LIBGTK_LIBS)
AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+
+SUBDIRS = v2 v3 v4
diff --git a/src/format/dwarf/dwarf-int.c b/src/format/dwarf/dwarf-int.c
new file mode 100644
index 0000000..310f926
--- /dev/null
+++ b/src/format/dwarf/dwarf-int.c
@@ -0,0 +1,75 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * dwarf-int.c - structures internes du format DWARF
+ *
+ * Copyright (C) 2015 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/>.
+ */
+
+
+#include "dwarf-int.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* pos = position de début de lecture. [OUT] *
+* endian = boutisme reconnu dans le format. *
+* header = en-tête à déterminer. [OUT] *
+* *
+* Description : Procède à la lecture de l'en-tête d'un contenu binaire ELF. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool read_dwarf_section_header(GBinContent *content, vmpa2t *pos, SourceEndian endian, dw_section_header *header)
+{
+ bool result; /* Bilan à retourner */
+ uint32_t first; /* Premier paquet d'octets */
+ bool status; /* Bilan d'opération */
+
+ result = false;
+
+ status = g_binary_content_read_u32(content, pos, endian, &first);
+ if (!status) goto rdsh_exit;
+
+ if (first >= 0xfffffff0 && first != 0xffffffff)
+ goto rdsh_exit;
+
+ if (first == 0xffffffff)
+ {
+ result = g_binary_content_read_u64(content, pos, endian, &header->unit_length);
+ header->is_32b = false;
+ }
+ else
+ {
+ result = true;
+ header->unit_length = first;
+ header->is_32b = true;
+ }
+
+ result &= g_binary_content_read_u16(content, pos, endian, &header->version);
+
+ rdsh_exit:
+
+ return result;
+
+}
diff --git a/src/format/dwarf/dwarf-int.h b/src/format/dwarf/dwarf-int.h
index 7999d3a..d3bf14a 100644
--- a/src/format/dwarf/dwarf-int.h
+++ b/src/format/dwarf/dwarf-int.h
@@ -25,15 +25,89 @@
#define _FORMAT_DWARF_DWARF_INT_H
+#include "dwarf.h"
-#include "../dbg_format-int.h"
+#include <stdint.h>
+
+
+
+
+#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
{
@@ -81,7 +155,7 @@ typedef struct _dw_dbg_function
} dw_dbg_function;
-
+#if 0
/* Description du format DWARF */
struct _dwarf_format
{
@@ -96,7 +170,7 @@ struct _dwarf_format
size_t dbg_fc_count; /* Nombre de ces fonctions */
};
-
+#endif
diff --git a/src/format/dwarf/dwarf.c b/src/format/dwarf/dwarf.c
index c7b1c23..db8335b 100644
--- a/src/format/dwarf/dwarf.c
+++ b/src/format/dwarf/dwarf.c
@@ -24,63 +24,245 @@
#include "dwarf.h"
+#include "dwarf-int.h"
+#include "../../common/cpp.h"
+/* Initialise la classe des formats de débogage DWARF. */
+static void g_dwarf_format_class_init(GDwarfFormatClass *);
+/* Initialise une instance de format de débogage DWARF. */
+static void g_dwarf_format_init(GDwarfFormat *);
+/* Supprime toutes les références externes. */
+static void g_dwarf_format_dispose(GDwarfFormat *);
+/* Procède à la libération totale de la mémoire. */
+static void g_dwarf_format_finalize(GDwarfFormat *);
+/******************************************************************************
+* *
+* Paramètres : content = contenu binaire à parcourir. *
+* parent = éventuel format exécutable déjà chargé. *
+* *
+* Description : Indique si le format peut être pris en charge ici. *
+* *
+* Retour : Désignation du format reconnu ou NULL si aucun. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const char *dwarf_is_matching(GBinContent *content, GExeFormat *parent)
+{
+ const char *result; /* Format détecté à renvoyer */
+ size_t i; /* Boucle de parcours */
+ mrange_t range; /* Couverture d'une section */
+ dw_section_header header; /* En-tête DWARF de section */
+ bool found; /* Bilan d'une comparaison */
+
+ static const char *section_names[] = {
+ ".debug_aranges",
+ ".debug_frame",
+ ".debug_info",
+ ".debug_line",
+ ".debug_pubnames",
+ ".debug_pubtypes",
+ ".debug_types"
+ };
+
+ static const uint16_t dwarf_v2_versions[] = {
+ 2, /* .debug_aranges */
+ 1, /* .debug_frame */
+ 2, /* .debug_info */
+ 2, /* .debug_line */
+ 2, /* .debug_pubnames */
+ 0, /* .debug_pubtypes */
+ 0 /* .debug_types */
+ };
+
+ static const uint16_t dwarf_v3_versions[] = {
+ 2, /* .debug_aranges */
+ 3, /* .debug_frame */
+ 3, /* .debug_info */
+ 3, /* .debug_line */
+ 2, /* .debug_pubnames */
+ 2, /* .debug_pubtypes */
+ 0 /* .debug_types */
+ };
+
+ static const uint16_t dwarf_v4_versions[] = {
+ 2, /* .debug_aranges */
+ 4, /* .debug_frame */
+ 4, /* .debug_info */
+ 4, /* .debug_line */
+ 2, /* .debug_pubnames */
+ 2, /* .debug_pubtypes */
+ 4 /* .debug_types */
+ };
+
+ uint16_t current_versions[] = {
+ 0, /* .debug_aranges */
+ 0, /* .debug_frame */
+ 0, /* .debug_info */
+ 0, /* .debug_line */
+ 0, /* .debug_pubnames */
+ 0, /* .debug_pubtypes */
+ 0 /* .debug_types */
+ };
+
+ result = NULL;
+
+ if (parent == NULL)
+ return NULL;
+
+ /* Lecture des indices présents */
+
+ for (i = 0; i < ARRAY_SIZE(section_names); i++)
+ {
+ if (!g_exe_format_get_section_range_by_name(parent, section_names[i], &range))
+ continue;
+
+ if (!read_dwarf_section_header(content, get_mrange_addr(&range), SRE_LITTLE /* FIXME */, &header))
+ continue;
+
+ current_versions[i] = header.version;
+
+ }
+
+ /* Détermination d'une version bien identifiée */
+
+ bool check_dwarf_version(const uint16_t *ref, const uint16_t *cur, size_t count)
+ {
+ bool equal;
+ size_t k;
+
+ equal = true;
+
+ for (k = 0; k < count && equal; k++)
+ equal = (cur[k] == 0) || (ref[k] == cur[k]);
+
+ return equal;
+
+ }
+
+ /**
+ * Un fichier DWARF sans section sera vu comme un fichier DWARF de
+ * dernière génération.
+ * Ce qui n'est pas très grave car rien ne sera chargé par la suite,
+ * du fait de l'absence de section, donc il n'y aura pas d'incompatibilité.
+ */
+
+ found = check_dwarf_version(dwarf_v4_versions, current_versions, ARRAY_SIZE(section_names));
+
+ if (found)
+ result = "dwarf_v4";
+
+ if (result == NULL)
+ {
+ found = check_dwarf_version(dwarf_v3_versions, current_versions, ARRAY_SIZE(section_names));
+
+ if (found)
+ result = "dwarf_v3";
+ }
+
+ if (result == NULL)
+ {
+ found = check_dwarf_version(dwarf_v2_versions, current_versions, ARRAY_SIZE(section_names));
+
+ if (found)
+ result = "dwarf_v2";
+
+ }
+
+ return result;
+
+}
+
+
+/* Indique le type défini pour un format de débogage générique. */
+G_DEFINE_TYPE(GDwarfFormat, g_dwarf_format, G_TYPE_DBG_FORMAT);
/******************************************************************************
* *
-* Paramètres : type = type de format recherché. *
-* content = contenu binaire à parcourir. *
-* length = taille du contenu en question. *
+* Paramètres : klass = classe à initialiser. *
* *
-* Description : Indique si le format peut être pris en charge ici. *
+* Description : Initialise la classe des formats de débogage DWARF. *
* *
-* Retour : true si la réponse est positive, false sinon. *
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-bool dwarf_is_matching(GBinContent *)
+static void g_dwarf_format_class_init(GDwarfFormatClass *klass)
{
- bool result; /* Bilan à faire connaître */
+ GObjectClass *object; /* Autre version de la classe */
- result = false;
+ object = G_OBJECT_CLASS(klass);
- return result;
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_dwarf_format_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_dwarf_format_finalize;
}
/******************************************************************************
* *
-* Paramètres : content = contenu binaire à parcourir. *
-* length = taille du contenu en question. *
+* Paramètres : format = instance à initialiser. *
* *
-* Description : Prend en charge un nouveau format Dwarf. *
+* Description : Initialise une instance de format de débogage DWARF. *
* *
-* Retour : Adresse de la structure mise en place ou NULL en cas d'échec.*
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-GBinFormat *g_dwarf_format_new(const bin_t *content, off_t length)
+static void g_dwarf_format_init(GDwarfFormat *format)
{
+}
- return NULL;
+/******************************************************************************
+* *
+* Paramètres : format = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+static void g_dwarf_format_dispose(GDwarfFormat *format)
+{
+ G_OBJECT_CLASS(g_dwarf_format_parent_class)->dispose(G_OBJECT(format));
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarf_format_finalize(GDwarfFormat *format)
+{
+ G_OBJECT_CLASS(g_dwarf_format_parent_class)->finalize(G_OBJECT(format));
}
diff --git a/src/format/dwarf/dwarf.h b/src/format/dwarf/dwarf.h
index 2e32c8e..a5e988b 100644
--- a/src/format/dwarf/dwarf.h
+++ b/src/format/dwarf/dwarf.h
@@ -25,15 +25,30 @@
#define _FORMAT_DWARF_DWARF_H
-#include "../format.h"
+#include "../executable.h"
+#define G_TYPE_DWARF_FORMAT g_dwarf_format_get_type()
+#define G_DWARF_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dwarf_format_get_type(), GDwarfFormat))
+#define G_IS_DWARF_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dwarf_format_get_type()))
+#define G_DWARF_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DWARF_FORMAT, GDwarfFormatClass))
+#define G_IS_DWARF_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DWARF_FORMAT))
+#define G_DWARF_FORMAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DWARF_FORMAT, GDwarfFormatClass))
+
+
+/* Format de débogage DWARF (instance) */
+typedef struct _GDwarfFormat GDwarfFormat;
+
+/* Format de débogage DWARF (classe) */
+typedef struct _GDwarfFormatClass GDwarfFormatClass;
+
+
/* Indique si le format peut être pris en charge ici. */
-bool dwarf_is_matching(GBinContent *);
+const char *dwarf_is_matching(GBinContent *, GExeFormat *);
-/* Prend en charge un nouveau format Dwarf. */
-GBinFormat *g_dwarf_format_new(const bin_t *, off_t);
+/* Indique le type défini pour un format de débogage DWARF. */
+GType g_dwarf_format_get_type(void);
diff --git a/src/format/dwarf/v2/Makefile.am b/src/format/dwarf/v2/Makefile.am
new file mode 100644
index 0000000..54e7719
--- /dev/null
+++ b/src/format/dwarf/v2/Makefile.am
@@ -0,0 +1,12 @@
+
+noinst_LTLIBRARIES = libformatdwarfv2.la
+
+libformatdwarfv2_la_SOURCES = \
+ dwarf.h dwarf.c
+
+libformatdwarfv2_la_LDFLAGS = $(LIBGTK_LIBS)
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/src/format/dwarf/v2/dwarf.c b/src/format/dwarf/v2/dwarf.c
new file mode 100644
index 0000000..73e4e04
--- /dev/null
+++ b/src/format/dwarf/v2/dwarf.c
@@ -0,0 +1,171 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * dwarf.c - support du format DWARF v2
+ *
+ * Copyright (C) 2015 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/>.
+ */
+
+
+#include "dwarf.h"
+
+
+#include "../dwarf-int.h"
+
+
+
+/* Format de débogage DWARF v2 (instance) */
+struct _GDwarfV2Format
+{
+ GDwarfFormat parent; /* A laisser en premier */
+
+};
+
+/* Format de débogage DWARF v2 (classe) */
+struct _GDwarfV2FormatClass
+{
+ GDwarfFormatClass parent; /* A laisser en premier */
+
+};
+
+
+/* Initialise la classe des formats de débogage DWARF v2. */
+static void g_dwarfv2_format_class_init(GDwarfV2FormatClass *);
+
+/* Initialise une instance de format de débogage DWARF v2. */
+static void g_dwarfv2_format_init(GDwarfV2Format *);
+
+/* Supprime toutes les références externes. */
+static void g_dwarfv2_format_dispose(GDwarfV2Format *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_dwarfv2_format_finalize(GDwarfV2Format *);
+
+
+
+/* Indique le type défini pour un format de débogage DWARF v2. */
+G_DEFINE_TYPE(GDwarfV2Format, g_dwarfv2_format, G_TYPE_DWARF_FORMAT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des formats de débogage DWARF v2. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv2_format_class_init(GDwarfV2FormatClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_dwarfv2_format_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_dwarfv2_format_finalize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance à initialiser. *
+* *
+* Description : Initialise une instance de format de débogage DWARF v2. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv2_format_init(GDwarfV2Format *format)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv2_format_dispose(GDwarfV2Format *format)
+{
+ G_OBJECT_CLASS(g_dwarfv2_format_parent_class)->dispose(G_OBJECT(format));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv2_format_finalize(GDwarfV2Format *format)
+{
+ G_OBJECT_CLASS(g_dwarfv2_format_parent_class)->finalize(G_OBJECT(format));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : content = contenu binaire à parcourir. *
+* parent = éventuel format exécutable déjà chargé. *
+* *
+* Description : Prend en charge un nouveau format DWARF (v2). *
+* *
+* Retour : Adresse de la structure mise en place ou NULL en cas d'échec.*
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GBinFormat *g_dwarfv2_format_new(GBinContent *content, GExeFormat *parent)
+{
+ GDwarfV2Format *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_DWARFV2_FORMAT, NULL);
+
+
+
+ g_binary_format_set_content(G_BIN_FORMAT(result), content);
+
+
+
+ return G_BIN_FORMAT(result);
+
+}
diff --git a/src/format/dwarf/v2/dwarf.h b/src/format/dwarf/v2/dwarf.h
new file mode 100644
index 0000000..360a2e6
--- /dev/null
+++ b/src/format/dwarf/v2/dwarf.h
@@ -0,0 +1,59 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * dwarf.h - prototypes pour le support du format DWARF v2
+ *
+ * Copyright (C) 2015 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 _FORMAT_DWARF_V2_DWARF_H
+#define _FORMAT_DWARF_V2_DWARF_H
+
+
+#include <glib-object.h>
+
+
+#include "../../executable.h"
+#include "../../format.h"
+
+
+
+#define G_TYPE_DWARFV2_FORMAT g_dwarfv2_format_get_type()
+#define G_DWARFV2_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dwarfv2_format_get_type(), GDwarfV2Format))
+#define G_IS_DWARFV2_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dwarfv2_format_get_type()))
+#define G_DWARFV2_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DWARFV2_FORMAT, GDwarfV2FormatClass))
+#define G_IS_DWARFV2_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DWARFV2_FORMAT))
+#define G_DWARFV2_FORMAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DWARFV2_FORMAT, GDwarfV2FormatClass))
+
+
+/* Format de débogage DWARF v2 (instance) */
+typedef struct _GDwarfV2Format GDwarfV2Format;
+
+/* Format de débogage DWARF v2 (classe) */
+typedef struct _GDwarfV2FormatClass GDwarfV2FormatClass;
+
+
+/* Indique le type défini pour un format de débogage DWARF v2. */
+GType g_dwarfv2_format_get_type(void);
+
+/* Prend en charge un nouveau format DWARF (v2). */
+GBinFormat *g_dwarfv2_format_new(GBinContent *, GExeFormat *);
+
+
+
+#endif /* _FORMAT_DWARF_V2_DWARF_H */
diff --git a/src/format/dwarf/v3/Makefile.am b/src/format/dwarf/v3/Makefile.am
new file mode 100644
index 0000000..dd6e9cd
--- /dev/null
+++ b/src/format/dwarf/v3/Makefile.am
@@ -0,0 +1,12 @@
+
+noinst_LTLIBRARIES = libformatdwarfv3.la
+
+libformatdwarfv3_la_SOURCES = \
+ dwarf.h dwarf.c
+
+libformatdwarfv3_la_LDFLAGS = $(LIBGTK_LIBS)
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/src/format/dwarf/v3/dwarf.c b/src/format/dwarf/v3/dwarf.c
new file mode 100644
index 0000000..d6198f7
--- /dev/null
+++ b/src/format/dwarf/v3/dwarf.c
@@ -0,0 +1,171 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * dwarf.c - support du format DWARF v3
+ *
+ * Copyright (C) 2015 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/>.
+ */
+
+
+#include "dwarf.h"
+
+
+#include "../dwarf-int.h"
+
+
+
+/* Format de débogage DWARF v3 (instance) */
+struct _GDwarfV3Format
+{
+ GDwarfFormat parent; /* A laisser en premier */
+
+};
+
+/* Format de débogage DWARF v3 (classe) */
+struct _GDwarfV3FormatClass
+{
+ GDwarfFormatClass parent; /* A laisser en premier */
+
+};
+
+
+/* Initialise la classe des formats de débogage DWARF v3. */
+static void g_dwarfv3_format_class_init(GDwarfV3FormatClass *);
+
+/* Initialise une instance de format de débogage DWARF v3. */
+static void g_dwarfv3_format_init(GDwarfV3Format *);
+
+/* Supprime toutes les références externes. */
+static void g_dwarfv3_format_dispose(GDwarfV3Format *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_dwarfv3_format_finalize(GDwarfV3Format *);
+
+
+
+/* Indique le type défini pour un format de débogage DWARF v3. */
+G_DEFINE_TYPE(GDwarfV3Format, g_dwarfv3_format, G_TYPE_DWARF_FORMAT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des formats de débogage DWARF v3. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv3_format_class_init(GDwarfV3FormatClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_dwarfv3_format_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_dwarfv3_format_finalize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance à initialiser. *
+* *
+* Description : Initialise une instance de format de débogage DWARF v3. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv3_format_init(GDwarfV3Format *format)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv3_format_dispose(GDwarfV3Format *format)
+{
+ G_OBJECT_CLASS(g_dwarfv3_format_parent_class)->dispose(G_OBJECT(format));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv3_format_finalize(GDwarfV3Format *format)
+{
+ G_OBJECT_CLASS(g_dwarfv3_format_parent_class)->finalize(G_OBJECT(format));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : content = contenu binaire à parcourir. *
+* parent = éventuel format exécutable déjà chargé. *
+* *
+* Description : Prend en charge un nouveau format DWARF (v3). *
+* *
+* Retour : Adresse de la structure mise en place ou NULL en cas d'échec.*
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GBinFormat *g_dwarfv3_format_new(GBinContent *content, GExeFormat *parent)
+{
+ GDwarfV3Format *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_DWARFV3_FORMAT, NULL);
+
+
+
+ g_binary_format_set_content(G_BIN_FORMAT(result), content);
+
+
+
+ return G_BIN_FORMAT(result);
+
+}
diff --git a/src/format/dwarf/v3/dwarf.h b/src/format/dwarf/v3/dwarf.h
new file mode 100644
index 0000000..2aaf891
--- /dev/null
+++ b/src/format/dwarf/v3/dwarf.h
@@ -0,0 +1,59 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * dwarf.h - prototypes pour le support du format DWARF v3
+ *
+ * Copyright (C) 2015 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 _FORMAT_DWARF_V3_DWARF_H
+#define _FORMAT_DWARF_V3_DWARF_H
+
+
+#include <glib-object.h>
+
+
+#include "../../executable.h"
+#include "../../format.h"
+
+
+
+#define G_TYPE_DWARFV3_FORMAT g_dwarfv3_format_get_type()
+#define G_DWARFV3_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dwarfv3_format_get_type(), GDwarfV3Format))
+#define G_IS_DWARFV3_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dwarfv3_format_get_type()))
+#define G_DWARFV3_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DWARFV3_FORMAT, GDwarfV3FormatClass))
+#define G_IS_DWARFV3_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DWARFV3_FORMAT))
+#define G_DWARFV3_FORMAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DWARFV3_FORMAT, GDwarfV3FormatClass))
+
+
+/* Format de débogage DWARF v3 (instance) */
+typedef struct _GDwarfV3Format GDwarfV3Format;
+
+/* Format de débogage DWARF v3 (classe) */
+typedef struct _GDwarfV3FormatClass GDwarfV3FormatClass;
+
+
+/* Indique le type défini pour un format de débogage DWARF v3. */
+GType g_dwarfv3_format_get_type(void);
+
+/* Prend en charge un nouveau format DWARF (v3). */
+GBinFormat *g_dwarfv3_format_new(GBinContent *, GExeFormat *);
+
+
+
+#endif /* _FORMAT_DWARF_V3_DWARF_H */
diff --git a/src/format/dwarf/v4/Makefile.am b/src/format/dwarf/v4/Makefile.am
new file mode 100644
index 0000000..fb3bc43
--- /dev/null
+++ b/src/format/dwarf/v4/Makefile.am
@@ -0,0 +1,12 @@
+
+noinst_LTLIBRARIES = libformatdwarfv4.la
+
+libformatdwarfv4_la_SOURCES = \
+ dwarf.h dwarf.c
+
+libformatdwarfv4_la_LDFLAGS = $(LIBGTK_LIBS)
+
+
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/src/format/dwarf/v4/dwarf.c b/src/format/dwarf/v4/dwarf.c
new file mode 100644
index 0000000..164d321
--- /dev/null
+++ b/src/format/dwarf/v4/dwarf.c
@@ -0,0 +1,171 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * dwarf.c - support du format DWARF v4
+ *
+ * Copyright (C) 2015 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/>.
+ */
+
+
+#include "dwarf.h"
+
+
+#include "../dwarf-int.h"
+
+
+
+/* Format de débogage DWARF v4 (instance) */
+struct _GDwarfV4Format
+{
+ GDwarfFormat parent; /* A laisser en premier */
+
+};
+
+/* Format de débogage DWARF v4 (classe) */
+struct _GDwarfV4FormatClass
+{
+ GDwarfFormatClass parent; /* A laisser en premier */
+
+};
+
+
+/* Initialise la classe des formats de débogage DWARF v4. */
+static void g_dwarfv4_format_class_init(GDwarfV4FormatClass *);
+
+/* Initialise une instance de format de débogage DWARF v4. */
+static void g_dwarfv4_format_init(GDwarfV4Format *);
+
+/* Supprime toutes les références externes. */
+static void g_dwarfv4_format_dispose(GDwarfV4Format *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_dwarfv4_format_finalize(GDwarfV4Format *);
+
+
+
+/* Indique le type défini pour un format de débogage DWARF v4. */
+G_DEFINE_TYPE(GDwarfV4Format, g_dwarfv4_format, G_TYPE_DWARF_FORMAT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des formats de débogage DWARF v4. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv4_format_class_init(GDwarfV4FormatClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_dwarfv4_format_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_dwarfv4_format_finalize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance à initialiser. *
+* *
+* Description : Initialise une instance de format de débogage DWARF v4. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv4_format_init(GDwarfV4Format *format)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv4_format_dispose(GDwarfV4Format *format)
+{
+ G_OBJECT_CLASS(g_dwarfv4_format_parent_class)->dispose(G_OBJECT(format));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dwarfv4_format_finalize(GDwarfV4Format *format)
+{
+ G_OBJECT_CLASS(g_dwarfv4_format_parent_class)->finalize(G_OBJECT(format));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : content = contenu binaire à parcourir. *
+* parent = éventuel format exécutable déjà chargé. *
+* *
+* Description : Prend en charge un nouveau format DWARF (v4). *
+* *
+* Retour : Adresse de la structure mise en place ou NULL en cas d'échec.*
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GBinFormat *g_dwarfv4_format_new(GBinContent *content, GExeFormat *parent)
+{
+ GDwarfV4Format *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_DWARFV4_FORMAT, NULL);
+
+
+
+ g_binary_format_set_content(G_BIN_FORMAT(result), content);
+
+
+
+ return G_BIN_FORMAT(result);
+
+}
diff --git a/src/format/dwarf/v4/dwarf.h b/src/format/dwarf/v4/dwarf.h
new file mode 100644
index 0000000..af3c2c4
--- /dev/null
+++ b/src/format/dwarf/v4/dwarf.h
@@ -0,0 +1,59 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * dwarf.h - prototypes pour le support du format DWARF v4
+ *
+ * Copyright (C) 2015 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 _FORMAT_DWARF_V4_DWARF_H
+#define _FORMAT_DWARF_V4_DWARF_H
+
+
+#include <glib-object.h>
+
+
+#include "../../executable.h"
+#include "../../format.h"
+
+
+
+#define G_TYPE_DWARFV4_FORMAT g_dwarfv4_format_get_type()
+#define G_DWARFV4_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dwarfv4_format_get_type(), GDwarfV4Format))
+#define G_IS_DWARFV4_FORMAT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dwarfv4_format_get_type()))
+#define G_DWARFV4_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DWARFV4_FORMAT, GDwarfV4FormatClass))
+#define G_IS_DWARFV4_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DWARFV4_FORMAT))
+#define G_DWARFV4_FORMAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DWARFV4_FORMAT, GDwarfV4FormatClass))
+
+
+/* Format de débogage DWARF v4 (instance) */
+typedef struct _GDwarfV4Format GDwarfV4Format;
+
+/* Format de débogage DWARF v4 (classe) */
+typedef struct _GDwarfV4FormatClass GDwarfV4FormatClass;
+
+
+/* Indique le type défini pour un format de débogage DWARF v4. */
+GType g_dwarfv4_format_get_type(void);
+
+/* Prend en charge un nouveau format DWARF (v4). */
+GBinFormat *g_dwarfv4_format_new(GBinContent *, GExeFormat *);
+
+
+
+#endif /* _FORMAT_DWARF_V4_DWARF_H */