summaryrefslogtreecommitdiff
path: root/src/format/dwarf/dwarf.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-03-14 22:18:27 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-03-14 22:18:27 (GMT)
commitfab9d7cd46922abea7d94f36dcd4630cdf3f4719 (patch)
treead41bb921db17631104a069e4df64fb4fc5ccfc1 /src/format/dwarf/dwarf.c
parent8d8e5c02096f59a7227308a591fc5050ea5d92ff (diff)
Improved the basic support of Dwarf information.
Diffstat (limited to 'src/format/dwarf/dwarf.c')
-rw-r--r--src/format/dwarf/dwarf.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/format/dwarf/dwarf.c b/src/format/dwarf/dwarf.c
index 519aa49..3fe5e88 100644
--- a/src/format/dwarf/dwarf.c
+++ b/src/format/dwarf/dwarf.c
@@ -24,7 +24,10 @@
#include "dwarf.h"
+#include "abbrev.h"
#include "dwarf-int.h"
+#include "info.h"
+#include "symbols.h"
#include "../../common/cpp.h"
@@ -120,6 +123,9 @@ FormatMatchStatus dwarf_is_matching(GBinContent *content, GExeFormat *parent, vo
if (parent == NULL)
return FMS_UNKNOWN;
+ return FMS_UNKNOWN;
+ *key = strdup("dwarf_v4");
+ return FMS_MATCHED;
/* Lecture des indices présents */
@@ -145,6 +151,9 @@ FormatMatchStatus dwarf_is_matching(GBinContent *content, GExeFormat *parent, vo
equal = true;
for (k = 0; k < count && equal; k++)
+ printf(" -> %hhu vs %hhu\n", ref[k], cur[k]);
+
+ for (k = 0; k < count && equal; k++)
equal = (cur[k] == 0) || (ref[k] == cur[k]);
return equal;
@@ -158,6 +167,8 @@ FormatMatchStatus dwarf_is_matching(GBinContent *content, GExeFormat *parent, vo
* du fait de l'absence de section, donc il n'y aura pas d'incompatibilité.
*/
+ printf("---dwarf v4\n");
+
found = check_dwarf_version(dwarf_v4_versions, current_versions, ARRAY_SIZE(section_names));
if (found)
@@ -168,6 +179,8 @@ FormatMatchStatus dwarf_is_matching(GBinContent *content, GExeFormat *parent, vo
if (result == FMS_UNKNOWN)
{
+ printf("---dwarf v3\n");
+
found = check_dwarf_version(dwarf_v3_versions, current_versions, ARRAY_SIZE(section_names));
if (found)
@@ -180,6 +193,8 @@ FormatMatchStatus dwarf_is_matching(GBinContent *content, GExeFormat *parent, vo
if (result == FMS_UNKNOWN)
{
+ printf("---dwarf v2\n");
+
found = check_dwarf_version(dwarf_v2_versions, current_versions, ARRAY_SIZE(section_names));
if (found)
@@ -277,3 +292,46 @@ static void g_dwarf_format_finalize(GDwarfFormat *format)
G_OBJECT_CLASS(g_dwarf_format_parent_class)->finalize(G_OBJECT(format));
}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = description du binaire de débogage à compléter. *
+* executable = référence vers le binaire exécutable à lier. *
+* *
+* Description : Charge de façon générique toutes les informations DWARF. *
+* *
+* Retour : Bilan du chargement : réussi ou non ? *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_dwarf_format_load(GDwarfFormat *format, GExeFormat *executable)
+{
+ bool result; /* Bilan à faire remonter */
+
+ result = true;
+
+ g_debuggable_format_attach_executable(G_DBG_FORMAT(format), executable);
+
+ printf("Loading abbrev...\n");
+
+ result &= load_all_dwarf_abbreviations(format);
+
+ printf("Loading debug info...\n");
+
+ result &= load_dwarf_debug_information(format);
+
+ printf("Done!\n");
+
+ result &= load_dwarf_symbols(format);
+
+ printf("Got symbols...\n");
+
+ exit(0);
+
+ return result;
+
+}
+