]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Move ref_record to addr-record.h/.cc
authorPetr Machata <pmachata@redhat.com>
Wed, 21 Oct 2009 21:39:09 +0000 (23:39 +0200)
committerPetr Machata <pmachata@redhat.com>
Wed, 18 Aug 2010 12:55:12 +0000 (14:55 +0200)
src/dwarflint/addr-record.cc
src/dwarflint/addr-record.h
src/dwarflint/low.c
src/dwarflint/low.h

index 6eb4dac7f2ac4dbadf3b28ef049c3da0ef6af82b..fb8c778a545575da398c480800cf63b0957550e2 100644 (file)
@@ -56,3 +56,19 @@ addr_record_free (struct addr_record *ar)
   if (ar != NULL)
     free (ar->addrs);
 }
+
+void
+ref_record_add (struct ref_record *rr, uint64_t addr, struct where *referrer)
+{
+  REALLOC (rr, refs);
+  struct ref *ref = rr->refs + rr->size++;
+  ref->addr = addr;
+  ref->who = *referrer;
+}
+
+void
+ref_record_free (struct ref_record *rr)
+{
+  if (rr != NULL)
+    free (rr->refs);
+}
index 95185ffd2e62a2d7f0d1d5f90e162b0a33dc523d..042af2a5dc496b4af3957470decbfe8b27cc316c 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <stdlib.h>
 #include <stdint.h>
+#include "where.h"
 #ifdef __cplusplus
 extern "C"
 {
@@ -10,22 +11,44 @@ extern "C"
 # include <stdbool.h>
 #endif
 
-/* Functions and data structures for address record handling.  We use
-   that to check that all DIE references actually point to an existing
-   die, not somewhere mid-DIE, where it just happens to be
-   interpretable as a DIE.  */
+  /* Functions and data structures for address record handling.  We
+     use that to check that all DIE references actually point to an
+     existing die, not somewhere mid-DIE, where it just happens to be
+     interpretable as a DIE.  */
 
-struct addr_record
-{
-  size_t size;
-  size_t alloc;
-  uint64_t *addrs;
-};
-
-size_t addr_record_find_addr (struct addr_record *ar, uint64_t addr);
-bool addr_record_has_addr (struct addr_record *ar, uint64_t addr);
-void addr_record_add (struct addr_record *ar, uint64_t addr);
-void addr_record_free (struct addr_record *ar);
+  struct addr_record
+  {
+    size_t size;
+    size_t alloc;
+    uint64_t *addrs;
+  };
+
+  size_t addr_record_find_addr (struct addr_record *ar, uint64_t addr);
+  bool addr_record_has_addr (struct addr_record *ar, uint64_t addr);
+  void addr_record_add (struct addr_record *ar, uint64_t addr);
+  void addr_record_free (struct addr_record *ar);
+
+  /* Functions and data structures for reference handling.  Just like
+     the above, we use this to check validity of DIE references.
+     Unlike the above, this is not stored as sorted set, but simply as
+     an array of records, because duplicates are unlikely.  */
+
+  struct ref
+  {
+    uint64_t addr; // Referree address
+    struct where who;  // Referrer
+  };
+
+  struct ref_record
+  {
+    size_t size;
+    size_t alloc;
+    struct ref *refs;
+  };
+
+  void ref_record_add (struct ref_record *rr, uint64_t addr,
+                      struct where *referrer);
+  void ref_record_free (struct ref_record *rr);
 
 #ifdef __cplusplus
 }
index 02a2ee11185c76e00cb79f8083496609011f705a..0f748232c05d6a2b329e6b5b155a1f9efdfd95e7 100644 (file)
@@ -66,18 +66,6 @@ check_category (enum message_category cat)
 #define PRI_LACK_RELOCATION ": %s seems to lack a relocation.\n"
 
 
-/* Functions and data structures related to raw (i.e. unassisted by
-   libdw) Dwarf abbreviation handling.  */
-
-
-/* Functions and data structures for reference handling.  Just like
-   the above, we use this to check validity of DIE references.  Unlike
-   the above, this is not stored as sorted set, but simply as an array
-   of records, because duplicates are unlikely.  */
-
-static void ref_record_add (struct ref_record *rr, uint64_t addr, struct where *referrer);
-static void ref_record_free (struct ref_record *rr);
-
 static struct cu *cu_find_cu (struct cu *cu_chain, uint64_t offset);
 
 static bool check_location_expression (struct elf_file *file,
@@ -600,22 +588,6 @@ abbrev_table_find_abbrev (struct abbrev_table *abbrevs, uint64_t abbrev_code)
   return NULL;
 }
 
-static void
-ref_record_add (struct ref_record *rr, uint64_t addr, struct where *referrer)
-{
-  REALLOC (rr, refs);
-  struct ref *ref = rr->refs + rr->size++;
-  ref->addr = addr;
-  ref->who = *referrer;
-}
-
-static void
-ref_record_free (struct ref_record *rr)
-{
-  if (rr != NULL)
-    free (rr->refs);
-}
-
 bool
 found_hole (uint64_t start, uint64_t length, void *data)
 {
index 5a0f2836ebe9d32db9af85595613befddcf4634b..9a651c339ef90757be4c167c85721b845da92399 100644 (file)
@@ -226,19 +226,6 @@ extern "C"
                           abbrevs should be skipped.  */
   };
 
-  struct ref
-  {
-    uint64_t addr; // Referree address
-    struct where who;  // Referrer
-  };
-
-  struct ref_record
-  {
-    size_t size;
-    size_t alloc;
-    struct ref *refs;
-  };
-
   struct cu
   {
     struct cu *next;