From: Petr Machata Date: Tue, 21 Sep 2010 20:29:05 +0000 (+0200) Subject: dwarflint: More moving stuff around X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8b99c520e4db0ef3e3c740f986432f4ddbe863ff;p=thirdparty%2Felfutils.git dwarflint: More moving stuff around --- diff --git a/dwarflint/check_debug_abbrev.cc b/dwarflint/check_debug_abbrev.cc index 8cff94e23..8e6da4990 100644 --- a/dwarflint/check_debug_abbrev.cc +++ b/dwarflint/check_debug_abbrev.cc @@ -33,6 +33,8 @@ #include "tables.hh" #include "sections.hh" #include "checked_read.h" +#include "messages.h" +#include "tables.h" #include #include @@ -413,7 +415,7 @@ namespace << "excessive DW_AT_sibling attribute at childless abbrev." << std::endl; - switch (check_sibling_form (ver, attrib_form)) + switch (dwver_check_sibling_form (ver, attrib_form)) { case -1: wr_message (where, cat (mc_die_rel, mc_impact_2)) @@ -524,14 +526,17 @@ check_debug_abbrev::~check_debug_abbrev () } } -int -check_sibling_form (dwarf_version_h ver, uint64_t form) +bool +is_location_attrib (uint64_t name) { - if (!dwver_form_allowed (ver, DW_AT_sibling, form)) - return -2; - else if (form == DW_FORM_ref_addr) - return -1; - else - return 0; + switch (name) + { + case DW_AT_location: + case DW_AT_frame_base: + case DW_AT_data_location: + case DW_AT_data_member_location: + return true; + default: + return false; + } } - diff --git a/dwarflint/check_debug_abbrev.hh b/dwarflint/check_debug_abbrev.hh index e9bb451c2..dbd8eff6f 100644 --- a/dwarflint/check_debug_abbrev.hh +++ b/dwarflint/check_debug_abbrev.hh @@ -48,6 +48,8 @@ public: ~check_debug_abbrev (); }; -int check_sibling_form (dwarf_version_h ver, uint64_t form); +// xxx When dwarf version objects are properly implemented, that's +// where this should end up in. +bool is_location_attrib (uint64_t name); #endif//DWARFLINT_CHECK_DEBUG_ABBREV_HH diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc index e6e91aea7..48f58199a 100644 --- a/dwarflint/check_debug_info.cc +++ b/dwarflint/check_debug_info.cc @@ -33,6 +33,7 @@ #include "../libdw/dwarf.h" #include "messages.h" +#include "tables.h" #include "pri.hh" #include "option.hh" #include "sections.hh" @@ -638,7 +639,7 @@ namespace form = value; if (it->name == DW_AT_sibling) - switch (check_sibling_form (ver, form)) + switch (dwver_check_sibling_form (ver, form)) { case -1: wr_message (where, cat (mc_die_rel, mc_impact_2)) diff --git a/dwarflint/check_debug_line.cc b/dwarflint/check_debug_line.cc index a4ea25514..046364e28 100644 --- a/dwarflint/check_debug_line.cc +++ b/dwarflint/check_debug_line.cc @@ -28,6 +28,7 @@ #include "sections.hh" #include "pri.hh" #include "checked_read.h" +#include "messages.h" #include #include "../libdw/known-dwarf.h" diff --git a/dwarflint/check_debug_pub.cc b/dwarflint/check_debug_pub.cc index 2a7c0dd3f..e649888d1 100644 --- a/dwarflint/check_debug_pub.cc +++ b/dwarflint/check_debug_pub.cc @@ -28,6 +28,7 @@ #include "sections.hh" #include "pri.hh" #include "checked_read.h" +#include "messages.h" template check_debug_pub::check_debug_pub (checkstack &stack, dwarflint &lint) diff --git a/dwarflint/check_expected_trees.cc b/dwarflint/check_expected_trees.cc index c90a488dc..0f8f369f5 100644 --- a/dwarflint/check_expected_trees.cc +++ b/dwarflint/check_expected_trees.cc @@ -33,6 +33,7 @@ #include "../src/dwarfstrings.h" #include "../libdw/c++/dwarf-knowledge.cc" #include "pri.hh" +#include "messages.h" using elfutils::dwarf; diff --git a/dwarflint/low.c b/dwarflint/low.c index da078859e..49cf303a5 100644 --- a/dwarflint/low.c +++ b/dwarflint/low.c @@ -27,26 +27,9 @@ # include #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../libdw/dwarf.h" -#include "../libebl/libebl.h" -#include "../src/dwarfstrings.h" #include "low.h" -#include "readctx.h" -#include "tables.h" +#include "messages.h" +#include bool address_aligned (uint64_t addr, uint64_t align) @@ -60,21 +43,6 @@ necessary_alignment (uint64_t start, uint64_t length, uint64_t align) return address_aligned (start + length, align) && length < align; } -bool -is_location_attrib (uint64_t name) -{ - switch (name) - { - case DW_AT_location: - case DW_AT_frame_base: - case DW_AT_data_location: - case DW_AT_data_member_location: - return true; - default: - return false; - } -} - bool supported_version (unsigned version, size_t num_supported, struct where *where, ...) diff --git a/dwarflint/low.h b/dwarflint/low.h index 0527c5c2d..76da44a1e 100644 --- a/dwarflint/low.h +++ b/dwarflint/low.h @@ -29,11 +29,8 @@ #include "../libdw/libdw.h" #include "../libebl/libebl.h" #include "coverage.h" -#include "messages.h" -#include "readctx.h" #include "addr-record.h" #include "reloc.h" -#include "tables.h" #ifdef __cplusplus extern "C" @@ -115,11 +112,6 @@ extern "C" bool allow_overlap; }; - // xxx low-level check entry points, will go away - - extern int check_sibling_form (dwarf_version_h ver, uint64_t form); - extern bool is_location_attrib (uint64_t name); - struct abbrev_attrib { struct where where; diff --git a/dwarflint/main.cc b/dwarflint/main.cc index 53a61a444..823022af3 100644 --- a/dwarflint/main.cc +++ b/dwarflint/main.cc @@ -38,6 +38,7 @@ #include "readctx.h" #include "checks.hh" #include "option.hh" +#include "messages.h" /* Messages that are accepted (and made into warning). */ struct message_criteria warning_criteria; diff --git a/dwarflint/reloc.cc b/dwarflint/reloc.cc index df7164ead..392eb71de 100644 --- a/dwarflint/reloc.cc +++ b/dwarflint/reloc.cc @@ -29,6 +29,8 @@ #include "reloc.h" #include "messages.h" #include "low.h" +#include "readctx.h" + #include #include #include diff --git a/dwarflint/tables.cc b/dwarflint/tables.cc index 4eaff7d81..82d4dd4b5 100644 --- a/dwarflint/tables.cc +++ b/dwarflint/tables.cc @@ -425,6 +425,17 @@ dwver_form_allowed_in (dwarf_version const *ver, int attr, int form, int tag) return ver->form_allowed (attr, form, tag); } +int +dwver_check_sibling_form (dwarf_version_h ver, int form) +{ + if (!dwver_form_allowed (ver, DW_AT_sibling, form)) + return -2; + else if (form == DW_FORM_ref_addr) + return -1; + else + return 0; +} + #if 0 .at (DW_AT_abstract_origin) diff --git a/dwarflint/tables.h b/dwarflint/tables.h index 7bfe2d932..0aa5384eb 100644 --- a/dwarflint/tables.h +++ b/dwarflint/tables.h @@ -1,6 +1,6 @@ /* Dwarf version tables, C binding. - 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 @@ -49,6 +49,8 @@ extern "C" 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