dwarflint.cc dwarflint.hh dwarflint.ii misc.h \
low.cc low.h elf_file.ii \
expected-at.cc expected.hh \
- coverage.cc coverage.h \
+ coverage.cc coverage.hh \
readctx.c readctx.h \
- checked_read.cc checked_read.h \
+ checked_read.cc checked_read.hh \
pri.cc pri.hh \
- messages.cc messages.h \
- section_id.cc section_id.h \
+ messages.cc messages.hh \
+ section_id.cc section_id.hh \
where.c where.h \
option.cc option.hh \
- addr-record.cc addr-record.h \
- reloc.cc reloc.h \
- tables.cc tables.hh tables.h \
+ addr-record.cc addr-record.hh \
+ reloc.cc reloc.hh \
+ tables.cc tables.hh \
all-dies-it.hh \
checks.cc checks.hh checks.ii \
sections.cc sections.hh sections.ii \
Network licensing program, please visit www.openinventionnetwork.com
<http://www.openinventionnetwork.com>. */
-#include "addr-record.h"
+#include "addr-record.hh"
#include "misc.h"
size_t
#include "pri.hh"
#include "tables.hh"
#include "sections.hh"
-#include "checked_read.h"
-#include "messages.h"
-#include "tables.h"
+#include "checked_read.hh"
+#include "messages.hh"
+#include "misc.h"
#include <dwarf.h>
#include <sstream>
struct where where = WHERE (sec_abbrev, NULL);
// Tolerate failure here.
- dwarf_version_h ver = NULL;
+ dwarf_version const *ver = NULL;
if (cu_headers == NULL)
{
wr_error (where)
<< "couldn't load CU headers; assuming CUs are of latest DWARF flavor."
<< std::endl;
- ver = get_latest_dwarf_version ();
+ ver = dwarf_version::get_latest ();
}
where.addr1 = 0;
if (it->abbrev_offset == abbr_off)
{
section->used = true;
- dwarf_version_h nver = get_dwarf_version (it->version);
+ dwarf_version const *nver
+ = dwarf_version::get (it->version);
if (ver == NULL)
ver = nver;
else if (nver != ver)
// table without knowing what version to use.
wr_error (where)
<< "abbreviation table is never used." << std::endl;
- ver = get_latest_dwarf_version ();
+ ver = dwarf_version::get_latest ();
}
}
assert (ver != NULL);
<< "excessive DW_AT_sibling attribute at childless abbrev."
<< std::endl;
- switch (dwver_check_sibling_form (ver, attrib_form))
+ switch (ver->check_sibling_form (attrib_form))
{
case -1:
wr_message (where, cat (mc_die_rel, mc_impact_2))
/* Similar for DW_AT_location and friends. */
else if (is_location_attrib (attrib_name))
{
- if (!dwver_form_allowed (ver, attrib_name, attrib_form))
+ if (!ver->form_allowed (attrib_name, attrib_form))
complain_invalid_form (where, attrib_name, attrib_form,
"location attribute");
}
#include "check_debug_info.hh"
#include "check_debug_loc_range.hh"
#include "cu_coverage.hh"
-#include "checked_read.h"
+#include "checked_read.hh"
checkdescriptor const *
check_debug_aranges::descriptor ()
#include <algorithm>
#include "../libdw/dwarf.h"
-#include "messages.h"
-#include "tables.h"
+#include "messages.hh"
+#include "tables.hh"
#include "pri.hh"
#include "option.hh"
#include "sections.hh"
-#include "checked_read.h"
+#include "checked_read.hh"
#include "check_debug_loc_range.hh"
#include "check_debug_abbrev.hh"
#include "check_debug_info.hh"
#include "check_debug_line.hh"
+#include "misc.h"
checkdescriptor const *
read_cu_headers::descriptor ()
wr_error (head.where) << "can't read version." << std::endl;
throw check_base::failed ();
}
- if (get_dwarf_version (version) == NULL)
+ if (dwarf_version::get (version) == NULL)
{
wr_error (head.where) << "unsupported CU version "
<< version << '.' << std::endl;
+1 in case some dies were actually loaded
*/
int
- read_die_chain (dwarf_version_h ver,
+ read_die_chain (dwarf_version const *ver,
elf_file const &file,
struct read_ctx *ctx,
struct cu *cu,
"indirect attribute form"))
return -1;
- if (!dwver_form_valid (ver, form))
+ if (!ver->form_allowed (form))
{
wr_error (where)
<< "invalid indirect form " << pri::hex (value)
form = value;
if (it->name == DW_AT_sibling)
- switch (dwver_check_sibling_form (ver, form))
+ switch (ver->check_sibling_form (form))
{
case -1:
wr_message (where, cat (mc_die_rel, mc_impact_2))
fprintf (stderr, "%s: CU starts\n", where_fmt (&cu->head->where, NULL));
bool retval = true;
- dwarf_version_h ver = get_dwarf_version (cu->head->version);
+ dwarf_version const *ver = dwarf_version::get (cu->head->version);
assert (ver != NULL);
/* Look up Abbrev table for this CU. */
#define DWARFLINT_CHECK_DEBUG_INFO_HH
#include <libdw.h>
-#include "addr-record.h"
+#include "addr-record.hh"
#include "elf_file.ii"
#include "coverage.hh"
#include "checks.hh"
#include "check_debug_info.hh"
#include "sections.hh"
#include "pri.hh"
-#include "checked_read.h"
-#include "messages.h"
+#include "checked_read.hh"
+#include "messages.hh"
#include <dwarf.h>
#include "../libdw/known-dwarf.h"
#include "check_debug_loc_range.hh"
#include "check_debug_info.hh"
#include "sections.hh"
-#include "checked_read.h"
+#include "checked_read.hh"
#include "../src/dwarf-opcodes.h"
#include "pri.hh"
+#include "misc.h"
bool do_range_coverage = false; // currently no option
#include "checks.hh"
#include "sections.ii"
#include "check_debug_info.ii"
-#include "messages.h"
+#include "messages.hh"
#include "coverage.hh"
struct section_coverage
#include "check_debug_info.hh"
#include "sections.hh"
#include "pri.hh"
-#include "checked_read.h"
-#include "messages.h"
+#include "checked_read.hh"
+#include "messages.hh"
template<section_id sec_id>
check_debug_pub<sec_id>::check_debug_pub (checkstack &stack, dwarflint &lint)
#include "highlevel_check.hh"
#include "all-dies-it.hh"
#include "pri.hh"
-#include "messages.h"
+#include "messages.hh"
#include <map>
using elfutils::dwarf;
/* Pedantic checking of DWARF files.
- Copyright (C) 2009 Red Hat, Inc.
+ Copyright (C) 2009, 2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
#include "../src/dwarfstrings.h"
#include "all-dies-it.hh"
#include "pri.hh"
-#include "messages.h"
+#include "messages.hh"
#include <map>
using elfutils::dwarf;
#include "../src/dwarfstrings.h"
#include "../libdw/c++/dwarf-knowledge.cc"
#include "pri.hh"
-#include "messages.h"
+#include "messages.hh"
using elfutils::dwarf;
<http://www.openinventionnetwork.com>. */
#include "checks.hh"
-#include "messages.h"
+#include "messages.hh"
#include "sections.hh"
#include "option.hh"
#include "coverage.hh"
#include "pri.hh"
#include "check_debug_loc_range.hh"
+#include "misc.h"
using elfutils::dwarf;
#endif
#include <dwarf.h>
-#include "checked_read.h"
-#include "messages.h"
+#include "checked_read.hh"
+#include "messages.hh"
bool
read_size_extra (struct read_ctx *ctx, uint32_t size32, uint64_t *sizep,
/* Implementation of coverage analysis.
- Copyright (C) 2008,2009 Red Hat, Inc.
+ Copyright (C) 2008, 2009, 2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
#include "coverage.hh"
#include "pri.hh"
+#include "misc.h"
#include <stdbool.h>
#include <assert.h>
+++ /dev/null
-/* Coverage analysis.
-
- Copyright (C) 2008,2009 Red Hat, Inc.
- This file is part of Red Hat elfutils.
-
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
-
- Red Hat elfutils is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
-
-#ifndef DWARFLINT_COVERAGE_H
-#define DWARFLINT_COVERAGE_H
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "misc.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/* Functions and data structures for handling of address range
- coverage. We use that to find holes of unused bytes in DWARF
- string table. */
-
-struct cov_range
-{
- uint64_t start;
- uint64_t length;
-
-#ifdef __cplusplus
- uint64_t end () const { return start + length; }
-#endif
-};
-
-struct coverage
-{
- struct cov_range *ranges;
- size_t size;
- size_t alloc;
-
-#ifdef __cplusplus
- cov_range &back () { return ranges[size - 1]; }
- cov_range const &back () const { return ranges[size - 1]; }
-#endif
-};
-
-char *range_fmt (char *buf, size_t buf_size,
- uint64_t start, uint64_t end);
-
-struct coverage *coverage_clone (struct coverage const *cov)
- __attribute__ ((malloc));
-void coverage_free (struct coverage *cov);
-
-void coverage_add (struct coverage *cov, uint64_t start, uint64_t length);
-void coverage_add_all (struct coverage *__restrict__ cov,
- struct coverage const *__restrict__ other);
-
-/* Returns true if something was actually removed, false if whole
- range falls into hole in coverage. */
-bool coverage_remove (struct coverage *cov, uint64_t start, uint64_t length);
-
-/* Returns true if something was actually removed, false if whole
- range falls into hole in coverage. */
-bool coverage_remove_all (struct coverage *__restrict__ cov,
- struct coverage const *__restrict__ other);
-
-/* Returns true if whole range ADDRESS/LENGTH is covered by COV.
- LENGTH may not be zero. */
-bool coverage_is_covered (struct coverage const *cov,
- uint64_t start, uint64_t length);
-
-/* Returns true if at least some of the range ADDRESS/LENGTH is
- covered by COV. Zero-LENGTH range never overlaps. */
-bool coverage_is_overlap (struct coverage const *cov,
- uint64_t start, uint64_t length);
-
-bool coverage_find_holes (struct coverage const *cov,
- uint64_t start, uint64_t length,
- bool (*cb)(uint64_t start, uint64_t length,
- void *data),
- void *data);
-bool coverage_find_ranges (struct coverage const *cov,
- bool (*cb)(uint64_t start, uint64_t length,
- void *data),
- void *data);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif//DWARFLINT_COVERAGE_H
/* Coverage analysis, C++ support.
- Copyright (C) 2008,2009 Red Hat, Inc.
+ Copyright (C) 2008, 2009, 2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
#include <string>
#include <sstream>
-#include "coverage.h"
+
+/* Functions and data structures for handling of address range
+ coverage. We use that to find holes of unused bytes in DWARF
+ string table. */
+
+struct cov_range
+{
+ uint64_t start;
+ uint64_t length;
+
+#ifdef __cplusplus
+ uint64_t end () const { return start + length; }
+#endif
+};
+
+struct coverage
+{
+ struct cov_range *ranges;
+ size_t size;
+ size_t alloc;
+
+#ifdef __cplusplus
+ cov_range &back () { return ranges[size - 1]; }
+ cov_range const &back () const { return ranges[size - 1]; }
+#endif
+};
+
+char *range_fmt (char *buf, size_t buf_size,
+ uint64_t start, uint64_t end);
+
+struct coverage *coverage_clone (struct coverage const *cov)
+ __attribute__ ((malloc));
+void coverage_free (struct coverage *cov);
+
+void coverage_add (struct coverage *cov, uint64_t start, uint64_t length);
+void coverage_add_all (struct coverage *__restrict__ cov,
+ struct coverage const *__restrict__ other);
+
+/* Returns true if something was actually removed, false if whole
+ range falls into hole in coverage. */
+bool coverage_remove (struct coverage *cov, uint64_t start, uint64_t length);
+
+/* Returns true if something was actually removed, false if whole
+ range falls into hole in coverage. */
+bool coverage_remove_all (struct coverage *__restrict__ cov,
+ struct coverage const *__restrict__ other);
+
+/* Returns true if whole range ADDRESS/LENGTH is covered by COV.
+ LENGTH may not be zero. */
+bool coverage_is_covered (struct coverage const *cov,
+ uint64_t start, uint64_t length);
+
+/* Returns true if at least some of the range ADDRESS/LENGTH is
+ covered by COV. Zero-LENGTH range never overlaps. */
+bool coverage_is_overlap (struct coverage const *cov,
+ uint64_t start, uint64_t length);
+
+bool coverage_find_holes (struct coverage const *cov,
+ uint64_t start, uint64_t length,
+ bool (*cb)(uint64_t start, uint64_t length,
+ void *data),
+ void *data);
+bool coverage_find_ranges (struct coverage const *cov,
+ bool (*cb)(uint64_t start, uint64_t length,
+ void *data),
+ void *data);
namespace cov
{
#include "cu_coverage.hh"
#include "check_debug_info.hh"
#include "check_debug_loc_range.hh"
+#include <cstring>
checkdescriptor const *
cu_coverage::descriptor ()
: _m_info (lint.check (stack, _m_info))
, _m_ranges (lint.check_if (_m_info->need_ranges (), stack, _m_ranges))
{
- memset (&cov, 0, sizeof (cov));
+ std::memset (&cov, 0, sizeof (cov));
coverage_add_all (&cov, &_m_info->cov ());
if (_m_ranges)
coverage_add_all (&cov, &_m_ranges->cov ());
<http://www.openinventionnetwork.com>. */
#include "dwarflint.hh"
-#include "messages.h"
+#include "messages.hh"
#include "checks.hh"
#include "main.hh"
<http://www.openinventionnetwork.com>. */
#include "highlevel_check.hh"
-#include "messages.h"
+#include "messages.hh"
#include "sections.hh"
#include "lowlevel_checks.hh"
#include "highlevel_check.hh"
#include "all-dies-it.hh"
#include "option.hh"
-#include "messages.h"
+#include "messages.hh"
#include "pri.hh"
#include <sstream>
#endif
#include "low.h"
-#include "messages.h"
+#include "messages.hh"
#include <stdarg.h>
bool
#include "../libdw/libdw.h"
#include "../libebl/libebl.h"
-#include "reloc.h"
+#include "reloc.hh"
#ifdef __cplusplus
extern "C"
#include "readctx.h"
#include "checks.hh"
#include "option.hh"
-#include "messages.h"
+#include "messages.hh"
/* Messages that are accepted (and made into warning). */
struct message_criteria warning_criteria;
/* Pedantic checking of DWARF files
- Copyright (C) 2009,2010 Red Hat, Inc.
+ Copyright (C) 2009, 2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
Network licensing program, please visit www.openinventionnetwork.com
<http://www.openinventionnetwork.com>. */
-#include "messages.h"
+#include "messages.hh"
#include "misc.h"
-#include "coverage.h"
+#include "coverage.hh"
#include <vector>
#include <sstream>
Network licensing program, please visit www.openinventionnetwork.com
<http://www.openinventionnetwork.com>. */
-#ifndef DWARFLINT_MESSAGES_H
-#define DWARFLINT_MESSAGES_H
+#ifndef DWARFLINT_MESSAGES_HH
+#define DWARFLINT_MESSAGES_HH
#include "where.h"
#include "libdw.h"
-
-#ifdef __cplusplus
-# define IF_CPLUSPLUS(X) X
-# include <string>
-extern "C"
-{
-#endif
+#include <string>
#define MESSAGE_CATEGORIES \
/* Severity: */ \
MC (mac, 22) /* messages related to .debug_mac */ \
MC (other, 31) /* messages unrelated to any of the above */
- enum message_category
+enum message_category
{
mc_none = 0,
-#define MC(CAT, ID)\
+#define MC(CAT, ID) \
mc_##CAT = 1u << ID,
MESSAGE_CATEGORIES
#undef MC
};
- struct message_term
- {
- /* Given a term like A && !B && C && !D, we decompose it thus: */
- unsigned long positive; /* non-zero bits for plain predicates */
- unsigned long negative; /* non-zero bits for negated predicates */
-
-#ifdef __cplusplus
- message_term (unsigned long pos, unsigned long neg)
- : positive (pos), negative (neg)
- {}
- std::string str () const;
-#endif
- };
+struct message_term
+{
+ /* Given a term like A && !B && C && !D, we decompose it thus: */
+ unsigned long positive; /* non-zero bits for plain predicates */
+ unsigned long negative; /* non-zero bits for negated predicates */
+
+ message_term (unsigned long pos, unsigned long neg)
+ : positive (pos), negative (neg)
+ {}
+ std::string str () const;
+};
- struct message_criteria
+struct message_criteria
+{
+ struct message_term *terms;
+ size_t size;
+ size_t alloc;
+
+ message_criteria ()
+ : terms (NULL), size (0), alloc (0)
+ {}
+
+ ~message_criteria ()
{
- struct message_term *terms;
- size_t size;
- size_t alloc;
-
-#ifdef __cplusplus
- message_criteria ()
- : terms (NULL), size (0), alloc (0)
- {}
- ~message_criteria ()
- {
- free (terms);
- }
-
- void operator |= (message_term const &term);
- void operator &= (message_term const &term);
- std::string str () const;
-#endif
- };
+ free (terms);
+ }
-#ifdef __cplusplus
- message_criteria operator ! (message_term const &);
-#endif
+ void operator |= (message_term const &term);
+ void operator &= (message_term const &term);
+ std::string str () const;
+};
- extern void wr_error (const struct where *wh, const char *format, ...)
- __attribute__ ((format (printf, 2, 3)));
+message_criteria operator ! (message_term const &);
- extern void wr_warning (const struct where *wh, const char *format, ...)
- __attribute__ ((format (printf, 2, 3)));
+extern void wr_error (const struct where *wh, const char *format, ...)
+ __attribute__ ((format (printf, 2, 3)));
- extern void wr_message (unsigned long category, const struct where *wh,
- const char *format, ...)
- __attribute__ ((format (printf, 3, 4)));
+extern void wr_warning (const struct where *wh, const char *format, ...)
+ __attribute__ ((format (printf, 2, 3)));
- extern void wr_format_padding_message (unsigned long category,
- struct where const *wh,
- uint64_t start, uint64_t end,
- char const *kind);
+extern void wr_message (unsigned long category, const struct where *wh,
+ const char *format, ...)
+ __attribute__ ((format (printf, 3, 4)));
- extern void wr_format_leb128_message (struct where const *where,
- const char *what,
- const char *purpose,
- const unsigned char *begin,
- const unsigned char *end);
+extern void wr_format_padding_message (unsigned long category,
+ struct where const *wh,
+ uint64_t start, uint64_t end,
+ char const *kind);
- extern void wr_message_padding_0 (unsigned long category,
- struct where const *wh,
- uint64_t start, uint64_t end);
+extern void wr_format_leb128_message (struct where const *where,
+ const char *what,
+ const char *purpose,
+ const unsigned char *begin,
+ const unsigned char *end);
- extern void wr_message_padding_n0 (unsigned long category,
- struct where const *wh,
- uint64_t start, uint64_t end);
+extern void wr_message_padding_0 (unsigned long category,
+ struct where const *wh,
+ uint64_t start, uint64_t end);
- extern bool message_accept (struct message_criteria const *cri,
- unsigned long cat);
+extern void wr_message_padding_n0 (unsigned long category,
+ struct where const *wh,
+ uint64_t start, uint64_t end);
+extern bool message_accept (struct message_criteria const *cri,
+ unsigned long cat);
- extern unsigned error_count;
- /* Messages that are accepted (and made into warning). */
- extern struct message_criteria warning_criteria;
+extern unsigned error_count;
- /* Accepted (warning) messages, that are turned into errors. */
- extern struct message_criteria error_criteria;
+/* Messages that are accepted (and made into warning). */
+extern struct message_criteria warning_criteria;
-#ifdef __cplusplus
-}
+/* Accepted (warning) messages, that are turned into errors. */
+extern struct message_criteria error_criteria;
inline message_category
cat (message_category c1,
std::ostream &wr_error ();
std::ostream &wr_message (where const &wh, message_category cat);
std::ostream &wr_message (message_category cat);
-#endif
-#endif//DWARFLINT_MESSAGES_H
+#endif//DWARFLINT_MESSAGES_HH
#define __STDC_FORMAT_MACROS
#include "low.h"
-#include "reloc.h"
-#include "messages.h"
+#include "reloc.hh"
+#include "messages.hh"
#include "misc.h"
#include "readctx.h"
#include <libelf.h>
#include <gelf.h>
-#ifdef __cplusplus
-extern "C"
+struct relocation
{
-#else
-# include <stdbool.h>
-#endif
-
- struct relocation
- {
- uint64_t offset;
- uint64_t addend;
- int symndx;
- int type;
- bool invalid; /* Whether this one relocation should be
- ignored. Necessary so that we don't report
- invalid & missing relocation twice. */
- };
-
- struct relocation_data
- {
- Elf_Data *symdata; /* Symbol table associated with this
- relocation section. */
- size_t type; /* SHT_REL or SHT_RELA. */
-
- struct relocation *rel; /* Array of relocations. May be NULL
- if there are no associated
- relocation data. */
- size_t size;
- size_t alloc;
- size_t index; /* Current index. */
- };
-
- enum skip_type
+ uint64_t offset;
+ uint64_t addend;
+ int symndx;
+ int type;
+ bool invalid; /* Whether this one relocation should be
+ ignored. Necessary so that we don't report
+ invalid & missing relocation twice. */
+};
+
+struct relocation_data
+{
+ Elf_Data *symdata; /* Symbol table associated with this
+ relocation section. */
+ size_t type; /* SHT_REL or SHT_RELA. */
+
+ struct relocation *rel; /* Array of relocations. May be NULL if
+ there are no associated relocation
+ data. */
+ size_t size;
+ size_t alloc;
+ size_t index; /* Current index. */
+};
+
+enum skip_type
{
skip_unref = 0,
skip_mismatched = 1,
skip_ok,
};
- bool read_rel (struct elf_file *file, struct sec *sec,
- Elf_Data *reldata, bool elf_64);
+bool read_rel (struct elf_file *file, struct sec *sec,
+ Elf_Data *reldata, bool elf_64);
- struct relocation *relocation_next (struct relocation_data *reloc,
- uint64_t offset,
- struct where const *where,
- enum skip_type st);
+struct relocation *relocation_next (struct relocation_data *reloc,
+ uint64_t offset,
+ struct where const *where,
+ enum skip_type st);
- void relocation_reset (struct relocation_data *reloc);
+void relocation_reset (struct relocation_data *reloc);
- void relocation_skip (struct relocation_data *reloc, uint64_t offset,
- struct where const *where, enum skip_type st);
+void relocation_skip (struct relocation_data *reloc, uint64_t offset,
+ struct where const *where, enum skip_type st);
- void relocation_skip_rest (struct relocation_data *reloc,
- enum section_id id);
+void relocation_skip_rest (struct relocation_data *reloc,
+ enum section_id id);
- void relocate_one (struct elf_file const *file,
- struct relocation_data *reloc,
- struct relocation *rel,
- unsigned width, uint64_t *value,
- struct where const *where,
- enum section_id offset_into, GElf_Sym **symptr);
+void relocate_one (struct elf_file const *file,
+ struct relocation_data *reloc,
+ struct relocation *rel,
+ unsigned width, uint64_t *value,
+ struct where const *where,
+ enum section_id offset_into, GElf_Sym **symptr);
#define PRI_LACK_RELOCATION ": %s seems to lack a relocation.\n"
-#ifdef __cplusplus
-}
-#endif
-
#endif//DWARFLINT_RELOC_H
Network licensing program, please visit www.openinventionnetwork.com
<http://www.openinventionnetwork.com>. */
-#include "section_id.h"
+#include "section_id.hh"
#include <stdlib.h>
/* Pedantic checking of DWARF files
- Copyright (C) 2009,2010 Red Hat, Inc.
+ Copyright (C) 2009, 2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
Network licensing program, please visit www.openinventionnetwork.com
<http://www.openinventionnetwork.com>. */
-#ifndef DWARFLINT_SECTION_ID_H
-#define DWARFLINT_SECTION_ID_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
+#ifndef DWARFLINT_SECTION_ID_HH
+#define DWARFLINT_SECTION_ID_HH
#define DEBUGINFO_SECTIONS \
SEC (info) \
SEC (mac) \
SEC (ranges)
- enum section_id
+enum section_id
{
sec_invalid = 0,
rel_exec, /* Some as above, but we expect EXEC bit. */
};
- // section_name[0] is for sec_invalid. The last index is for
- // count_debuginfo_sections and is NULL.
- extern char const *section_name[];
-
-#ifdef __cplusplus
-}
-#endif
+// section_name[0] is for sec_invalid. The last index is for
+// count_debuginfo_sections and is NULL.
+extern char const *section_name[];
-#endif//DWARFLINT_SECTION_ID_H
+#endif//DWARFLINT_SECTION_ID_HH
#include "../libelf/gelf.h"
#include "sections.hh"
-#include "messages.h"
+#include "messages.hh"
#include "pri.hh"
#include "misc.h"
-#include "section_id.h"
+#include "section_id.hh"
template<enum section_id> class section;
// a version in its own.
#include "tables.hh"
-#include "tables.h"
#include "../libdw/dwarf.h"
#include <map>
std_dwarf dwarf4 (dwarf_4_at_table, dwarf_4_form_table, &dwarf3);
}
-dwarf_version_h
-get_dwarf_version (unsigned version)
+dwarf_version const *
+dwarf_version::get (unsigned version)
{
switch (version)
{
};
}
-dwarf_version_h
-get_latest_dwarf_version ()
+dwarf_version const *
+dwarf_version::get_latest ()
{
- return &dwarf4;
-}
-
-bool
-dwver_form_valid (dwarf_version const *ver, int form)
-{
- return ver->form_allowed (form);
-}
-
-bool
-dwver_form_allowed (dwarf_version const *ver, int attr, int form)
-{
- return ver->form_allowed (attr, form);
-}
-
-bool
-dwver_form_allowed_in (dwarf_version const *ver, int attr, int form, int tag)
-{
- return ver->form_allowed (attr, form, tag);
+ return get (4);
}
int
-dwver_check_sibling_form (dwarf_version_h ver, int form)
+dwarf_version::check_sibling_form (int form) const
{
- if (!dwver_form_allowed (ver, DW_AT_sibling, form))
+ if (!form_allowed (DW_AT_sibling, form))
return -2;
else if (form == DW_FORM_ref_addr)
return -1;
+++ /dev/null
-/* Dwarf version tables, C binding.
-
- Copyright (C) 2009, 2010 Red Hat, Inc.
- This file is part of Red Hat elfutils.
-
- Red Hat elfutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by the
- Free Software Foundation; version 2 of the License.
-
- Red Hat elfutils is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with Red Hat elfutils; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
-
- Red Hat elfutils is an included package of the Open Invention Network.
- An included package of the Open Invention Network is a package for which
- Open Invention Network licensees cross-license their patents. No patent
- license is granted, either expressly or impliedly, by designation as an
- included package. Should you wish to participate in the Open Invention
- Network licensing program, please visit www.openinventionnetwork.com
- <http://www.openinventionnetwork.com>. */
-
-#ifndef DWARFLINT_TABLES_H
-#define DWARFLINT_TABLES_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#else
-# include <stdbool.h>
-#endif
-
- struct dwarf_version;
- typedef struct dwarf_version const *dwarf_version_h;
-
- dwarf_version_h get_dwarf_version (unsigned version)
- __attribute__ ((pure));
-
- dwarf_version_h get_latest_dwarf_version ()
- __attribute__ ((pure));
-
- bool dwver_form_valid (dwarf_version_h ver, int form);
-
- bool dwver_form_allowed (dwarf_version_h ver, int attr, int form);
-
- bool dwver_form_allowed_in (dwarf_version_h ver, int attr,int form, int tag);
-
- int dwver_check_sibling_form (dwarf_version_h ver, int form);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif//DWARFLINT_TABLES_H
/* Dwarf version tables.
- Copyright (C) 2009 Red Hat, Inc.
+ Copyright (C) 2009, 2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
{
return find_form (allowed_forms (at, tag), f);
}
+
+ int check_sibling_form (int form) const;
+
+ static dwarf_version const *get (unsigned version)
+ __attribute__ ((pure));
+
+ static dwarf_version const *get_latest ()
+ __attribute__ ((pure));
};
#endif//DWARFLINT_TABLES_HH
#ifndef DWARFLINT_WHERE_H
#define DWARFLINT_WHERE_H
-#include "section_id.h"
+#include "section_id.hh"
#include <stdint.h>
#include <stdlib.h>