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;
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
#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>
{
/* 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)
# include <stdbool.h>
#endif
- struct hl_ctx;
-
struct sec
{
GElf_Shdr shdr;
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);
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;