]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Move abbrev-related data structures to check_debug_abbrev
authorPetr Machata <pmachata@redhat.com>
Tue, 21 Sep 2010 20:47:34 +0000 (22:47 +0200)
committerPetr Machata <pmachata@redhat.com>
Tue, 21 Sep 2010 20:47:34 +0000 (22:47 +0200)
dwarflint/check_debug_abbrev.cc
dwarflint/check_debug_abbrev.hh
dwarflint/check_debug_info.cc
dwarflint/low.h

index 8e6da49908aad758342a0a715bc21f1ff5565535..27effb5d357d9d47207422f233dad73a1c2be3e1 100644 (file)
@@ -77,18 +77,17 @@ check_debug_abbrev::descriptor ()
   return &cd;
 }
 
-struct abbrev *
-abbrev_table_find_abbrev (struct abbrev_table const *abbrevs,
-                         uint64_t abbrev_code)
+abbrev *
+abbrev_table::find_abbrev (uint64_t abbrev_code) const
 {
   size_t a = 0;
-  size_t b = abbrevs->size;
+  size_t b = size;
   struct abbrev *ab = NULL;
 
   while (a < b)
     {
       size_t i = (a + b) / 2;
-      ab = abbrevs->abbr + i;
+      ab = abbr + i;
 
       if (ab->code > abbrev_code)
        b = i;
@@ -278,7 +277,7 @@ namespace
            assert (ver != NULL);
          }
 
-       struct abbrev *original = abbrev_table_find_abbrev (section, abbr_code);
+       struct abbrev *original = section->find_abbrev (abbr_code);
        if (unlikely (original != NULL))
          wr_error (where)
            << "duplicate abbrev code " << abbr_code
index dbd8eff6f1a42dd44c8570d519b2d1bf496ca5ac..f905bd24f94a2db11149eeafdf9300fd8663b50a 100644 (file)
 #ifndef DWARFLINT_CHECK_DEBUG_ABBREV_HH
 #define DWARFLINT_CHECK_DEBUG_ABBREV_HH
 
-#include "low.h"
 #include "checks.hh"
 #include "sections.ii"
 #include "check_debug_info.ii"
 
+struct abbrev_attrib
+{
+  struct where where;
+  uint16_t name;
+  uint8_t form;
+};
+
+struct abbrev
+{
+  uint64_t code;
+  struct where where;
+
+  /* Attributes.  */
+  struct abbrev_attrib *attribs;
+  size_t size;
+  size_t alloc;
+
+  /* While ULEB128 can hold numbers > 32bit, these are not legal
+     values of many enum types.  So just use as large type as
+     necessary to cover valid values.  */
+  uint16_t tag;
+  bool has_children;
+
+  /* Whether some DIE uses this abbrev.  */
+  bool used;
+};
+
+struct abbrev_table
+{
+  struct abbrev_table *next;
+  struct abbrev *abbr;
+  uint64_t offset;
+  size_t size;
+  size_t alloc;
+  bool used;           /* There are CUs using this table.  */
+
+  abbrev *find_abbrev (uint64_t abbrev_code) const;
+};
+
 class check_debug_abbrev
   : public check<check_debug_abbrev>
 {
index 48f58199abefc697f94674118a65a0141a214516..8489819d870f57317dd0142eb83c7b99d1c4831d 100644 (file)
@@ -597,7 +597,7 @@ namespace
 
        /* Find the abbrev matching the code.  */
        prev_abbrev = abbrev;
-       abbrev = abbrev_table_find_abbrev (abbrevs, abbr_code);
+       abbrev = abbrevs->find_abbrev (abbr_code);
        if (abbrev == NULL)
          {
            wr_error (where)
index 76da44a1e7f3d320f704a247693e9ad5d509fbbf..14728a6b4be6f494309580bedd179260f45f370f 100644 (file)
@@ -39,8 +39,6 @@ extern "C"
 # include <stdbool.h>
 #endif
 
-  struct hl_ctx;
-
   struct sec
   {
     GElf_Shdr shdr;
@@ -71,22 +69,6 @@ extern "C"
                              different from the host.  */
   };
 
-  /* Check that .debug_aranges and .debug_ranges match.  */
-  extern bool elf_file_init (struct elf_file *file, Elf *elf);
-
-  struct abbrev_table
-  {
-    struct abbrev_table *next;
-    struct abbrev *abbr;
-    uint64_t offset;
-    size_t size;
-    size_t alloc;
-    bool used;         /* There are CUs using this table.  */
-  };
-
-  // xxx some of that will go away
-  extern struct abbrev *abbrev_table_find_abbrev (struct abbrev_table const *abbrevs,
-                                                 uint64_t abbrev_code);
   extern bool address_aligned (uint64_t addr, uint64_t align);
   extern bool necessary_alignment (uint64_t start, uint64_t length,
                                   uint64_t align);
@@ -112,33 +94,6 @@ extern "C"
     bool allow_overlap;
   };
 
-  struct abbrev_attrib
-  {
-    struct where where;
-    uint16_t name;
-    uint8_t form;
-  };
-
-  struct abbrev
-  {
-    uint64_t code;
-    struct where where;
-
-    /* Attributes.  */
-    struct abbrev_attrib *attribs;
-    size_t size;
-    size_t alloc;
-
-    /* While ULEB128 can hold numbers > 32bit, these are not legal
-       values of many enum types.  So just use as large type as
-       necessary to cover valid values.  */
-    uint16_t tag;
-    bool has_children;
-
-    /* Whether some DIE uses this abbrev.  */
-    bool used;
-  };
-
   struct cu_head
   {
     uint64_t offset;