summaryrefslogtreecommitdiff
path: root/src/format/dwarf
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2008-08-24 19:34:50 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2008-08-24 19:34:50 (GMT)
commit2d9a76d0989ba0a1020dd333df3852ab6fc675de (patch)
treeb0d2724e915c99a66078445cbe309ba91044d3b9 /src/format/dwarf
parent7af746b641de4a8d6d99ceb2bfd7f77af824bbcf (diff)
Got and inserted debug comments into code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@21 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/dwarf')
-rw-r--r--src/format/dwarf/d_dwarf.c36
-rw-r--r--src/format/dwarf/d_dwarf.h2
2 files changed, 38 insertions, 0 deletions
diff --git a/src/format/dwarf/d_dwarf.c b/src/format/dwarf/d_dwarf.c
index 17dc711..ae7e4c0 100644
--- a/src/format/dwarf/d_dwarf.c
+++ b/src/format/dwarf/d_dwarf.c
@@ -75,4 +75,40 @@ dwarf_format *load_dwarf(const uint8_t *content, off_t length, exe_format *e_for
}
+/******************************************************************************
+* *
+* Paramètres : format = informations chargées à consulter. *
+* comments = liste des commentaires à insérer. [OUT] *
+* offsets = liste des indices des commentaires. [OUT] *
+* *
+* Description : Récupère tous les commentaires à insérer dans le code. *
+* *
+* Retour : Nombre d'éléments mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+size_t get_dwarf_comments(const dwarf_format *format, const char ***comments, uint64_t **offsets)
+{
+ size_t result; /* Quantité à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = format->dbg_fc_count;
+
+ if (result > 0)
+ {
+ *comments = (char **)calloc(result, sizeof(char *));
+ *offsets = (uint64_t *)calloc(result, sizeof(uint64_t));
+
+ for (i = 0; i < result; i++)
+ {
+ (*comments)[i] = format->dbg_functions[i]->prototype;
+ (*offsets)[i] = format->dbg_functions[i]->low_pc;
+ }
+
+ }
+
+ return result;
+
+}
diff --git a/src/format/dwarf/d_dwarf.h b/src/format/dwarf/d_dwarf.h
index d432d5a..9b05adb 100644
--- a/src/format/dwarf/d_dwarf.h
+++ b/src/format/dwarf/d_dwarf.h
@@ -41,6 +41,8 @@ typedef struct _dwarf_format dwarf_format;
/* Prend en charge un nouveau DWARF. */
dwarf_format *load_dwarf(const uint8_t *, off_t, exe_format *);
+/* Récupère tous les commentaires à insérer dans le code. */
+size_t get_dwarf_comments(const dwarf_format *, const char ***, uint64_t **);