diff options
-rw-r--r-- | libdw/c++/dwarf | 99 | ||||
-rw-r--r-- | libdw/c++/dwarf_comparator | 18 | ||||
-rw-r--r-- | libdw/c++/dwarf_edit | 32 | ||||
-rw-r--r-- | libdw/c++/dwarf_tracker | 10 | ||||
-rw-r--r-- | src/dwarfcmp.cc | 13 | ||||
-rw-r--r-- | src/dwarflint-hl.cc | 9 | ||||
-rw-r--r-- | tests/dwarf-print.cc | 4 |
7 files changed, 100 insertions, 85 deletions
diff --git a/libdw/c++/dwarf b/libdw/c++/dwarf index fab89611..cf24cc20 100644 --- a/libdw/c++/dwarf +++ b/libdw/c++/dwarf @@ -440,14 +440,14 @@ namespace elfutils debug_info_entry (const debug_info_entry &die) : _m_die (die._m_die) {} // Containers, see class definitions below. - class raw_children; - inline raw_children raw_children () const; - class raw_attributes; - raw_attributes raw_attributes () const; - class children; - inline children children () const; - class attributes; - attributes attributes () const; + class raw_children_type; + inline raw_children_type raw_children () const; + class raw_attributes_type; + raw_attributes_type raw_attributes () const; + class children_type; + inline children_type children () const; + class attributes_type; + attributes_type attributes () const; inline int tag () const { @@ -501,19 +501,21 @@ namespace elfutils // Container for raw list of child DIEs, intended to be a compatible with // a read-only, unidirectional subset of std::list<debug_info_entry>. - class debug_info_entry::raw_children + class debug_info_entry::raw_children_type { friend class debug_info_entry; private: const debug_info_entry &_m_die; protected: - inline raw_children (const debug_info_entry &die) : _m_die (die) {} + inline raw_children_type (const debug_info_entry &die) : _m_die (die) {} public: typedef debug_info_entry value_type; - inline raw_children (const raw_children &c) : _m_die (c._m_die) {} + inline raw_children_type (const raw_children_type &c) + : _m_die (c._m_die) + {} bool empty () const { @@ -618,18 +620,22 @@ namespace elfutils // Container for list of raw attributes as (name, value) pairs, // intended to be compatible with a read-only, unidirectional // subset of std::list<std::pair<int, attr_value>>. - class debug_info_entry::raw_attributes + class debug_info_entry::raw_attributes_type { friend class debug_info_entry; private: const debug_info_entry &_m_die; - raw_attributes (const debug_info_entry &die) : _m_die (die) {} + raw_attributes_type (const debug_info_entry &die) + : _m_die (die) + {} public: typedef attribute value_type; - inline raw_attributes (const raw_attributes &a) : _m_die (a._m_die) {} + inline raw_attributes_type (const raw_attributes_type &a) + : _m_die (a._m_die) + {} size_t size () const; inline bool empty () const @@ -640,7 +646,7 @@ namespace elfutils class const_iterator : public std::iterator<std::input_iterator_tag, attribute> { - friend class raw_attributes; + friend class raw_attributes_type; private: debug_info_entry _m_die; ptrdiff_t _m_offset; // Offset for next iteration in dwarf_getattrs. @@ -733,29 +739,32 @@ namespace elfutils // Container for list of child DIEs, intended to be a compatible with // a read-only, unidirectional subset of std::list<debug_info_entry>. // Same as raw_children, but flattens DW_TAG_imported_unit children. - class debug_info_entry::children : public debug_info_entry::raw_children + class debug_info_entry::children_type + : public debug_info_entry::raw_children_type { friend class debug_info_entry; private: - inline children (const debug_info_entry &die) - : raw_children::raw_children (die) {} + inline children_type (const debug_info_entry &die) + : raw_children_type::raw_children_type (die) {} public: typedef debug_info_entry value_type; - inline children (const children &c) : raw_children (c) {} + inline children_type (const children_type &c) + : raw_children_type (c) + {} class const_iterator : public std::iterator<std::input_iterator_tag, debug_info_entry> { - friend class children; + friend class children_type; private: - typedef raw_children::const_iterator raw_iterator; + typedef raw_children_type::const_iterator raw_iterator; std::stack<raw_iterator> _m_stack; - /* Push and pop until either _m_stack.top () == raw_children::end () + /* Push and pop until _m_stack.top () == raw_children_type::end () or it's looking at a DIE other than DW_TAG_imported_unit. */ inline void jiggle () { @@ -763,7 +772,7 @@ namespace elfutils { raw_iterator &i = _m_stack.top (); - if (i == raw_children::end ()) + if (i == raw_children_type::end ()) { /* We're at the end of this raw DIE. Pop out to the iterator on the importing unit. */ @@ -846,11 +855,11 @@ namespace elfutils const_iterator begin () const { - return const_iterator (raw_children::begin ()); + return const_iterator (raw_children_type::begin ()); } const_iterator end () const { - return const_iterator (raw_children::end ()); + return const_iterator (raw_children_type::end ()); } template<typename other_children> @@ -872,20 +881,19 @@ namespace elfutils } // Circumvent C++ namespace lookup. - typedef class debug_info_entry::raw_attributes debug_info_entry_raw_attrs; - typedef skipping_wrapper<debug_info_entry_raw_attrs, - attribute, attribute, skip_sibling> + typedef class debug_info_entry::raw_attributes_type die_raw_attrs; + typedef skipping_wrapper<die_raw_attrs, attribute, attribute, skip_sibling> attributes_base; public: // Container for attributes, indexed by name, intended to be compatible // with a read-only subset of std::unordered_map<int, attr_value>. // This excludes DW_AT_sibling. - class debug_info_entry::attributes : public attributes_base + class debug_info_entry::attributes_type : public attributes_base { friend class dwarf; private: - inline attributes (const class raw_attributes &raw) + inline attributes_type (const raw_attributes_type &raw) : attributes_base (raw) {} public: @@ -895,8 +903,9 @@ namespace elfutils static const bool ordered = false; - inline attributes (const class attributes &a) - : attributes_base (a) {} + inline attributes_type (const attributes_type &a) + : attributes_base (a) + {} typedef attributes_base::const_iterator const_iterator; @@ -1100,11 +1109,13 @@ namespace elfutils inline std::string to_string () const; // Return an iterator on which * will yield the referent debug_info_entry. - inline debug_info_entry::raw_children::const_iterator reference () const + inline debug_info_entry::raw_children_type::const_iterator + reference () const { - return debug_info_entry::raw_children::const_iterator (thisattr ()); + return (debug_info_entry::raw_children_type::const_iterator + (thisattr ())); } - inline debug_info_entry::raw_children::const_iterator + inline debug_info_entry::raw_children_type::const_iterator unit_reference () const { return reference (); @@ -1837,7 +1848,7 @@ namespace elfutils // This describes one attribute, equivalent to pair<const int, attr_value>. class attribute { - friend class debug_info_entry::raw_attributes::const_iterator; + friend class debug_info_entry::raw_attributes_type::const_iterator; friend class attr_value; private: inline ::Dwarf_Attribute *thisattr () const @@ -2315,28 +2326,28 @@ namespace elfutils } }; - inline class dwarf::debug_info_entry::raw_children + inline class dwarf::debug_info_entry::raw_children_type dwarf::debug_info_entry::raw_children () const { - return raw_children::raw_children (*this); + return raw_children_type::raw_children_type (*this); } - inline class dwarf::debug_info_entry::children + inline class dwarf::debug_info_entry::children_type dwarf::debug_info_entry::children () const { - return children::children (*this); + return children_type::children_type (*this); } - inline class dwarf::debug_info_entry::raw_attributes + inline class dwarf::debug_info_entry::raw_attributes_type dwarf::debug_info_entry::raw_attributes () const { - return raw_attributes::raw_attributes (*this); + return raw_attributes_type::raw_attributes_type (*this); } - inline class dwarf::debug_info_entry::attributes + inline class dwarf::debug_info_entry::attributes_type dwarf::debug_info_entry::attributes () const { - return attributes::attributes (raw_attributes ()); + return attributes_type::attributes_type (raw_attributes ()); } inline dwarf::location_attr::const_iterator diff --git a/libdw/c++/dwarf_comparator b/libdw/c++/dwarf_comparator index 827ddf39..8042a949 100644 --- a/libdw/c++/dwarf_comparator +++ b/libdw/c++/dwarf_comparator @@ -62,10 +62,12 @@ namespace elfutils protected: typedef typename dwarf1::compile_units::const_iterator cu1; typedef typename dwarf2::compile_units::const_iterator cu2; - typedef typename dwarf1::debug_info_entry::children::const_iterator die1; - typedef typename dwarf2::debug_info_entry::children::const_iterator die2; - typedef typename dwarf1::debug_info_entry::attributes::const_iterator attr1; - typedef typename dwarf2::debug_info_entry::attributes::const_iterator attr2; + typedef typename dwarf1::debug_info_entry dwarf1_die; + typedef typename dwarf2::debug_info_entry dwarf2_die; + typedef typename dwarf1_die::children_type::const_iterator die1; + typedef typename dwarf2_die::children_type::const_iterator die2; + typedef typename dwarf1_die::attributes_type::const_iterator attr1; + typedef typename dwarf2_die::attributes_type::const_iterator attr2; public: inline void start_walk (const cu1 &a, const cu2 &b) @@ -212,8 +214,8 @@ namespace elfutils o.insert (std::make_pair ((*i).first, i)); } - typedef typename dwarf1::debug_info_entry::attributes attributes1; - typedef typename dwarf2::debug_info_entry::attributes attributes2; + typedef typename dwarf1::debug_info_entry::attributes_type attributes1; + typedef typename dwarf2::debug_info_entry::attributes_type attributes2; typedef typename attributes1::const_iterator ait1; typedef typename attributes2::const_iterator ait2; typedef std::map<int, ait1> ait1_map; @@ -306,8 +308,8 @@ namespace elfutils return false; } - typedef typename dwarf1::debug_info_entry::children children1; - typedef typename dwarf2::debug_info_entry::children children2; + typedef typename dwarf1::debug_info_entry::children_type children1; + typedef typename dwarf2::debug_info_entry::children_type children2; typedef typename children1::const_iterator cit1; typedef typename children2::const_iterator cit2; struct die_matcher diff --git a/libdw/c++/dwarf_edit b/libdw/c++/dwarf_edit index c99d6763..00698b54 100644 --- a/libdw/c++/dwarf_edit +++ b/libdw/c++/dwarf_edit @@ -93,30 +93,30 @@ namespace elfutils { public: - class children : public std::list<debug_info_entry> + class children_type : public std::list<debug_info_entry> { friend class debug_info_entry; private: - children () {} + children_type () {} template<typename childrens> - children (const childrens &other) + children_type (const childrens &other) : std::list<debug_info_entry> (other.begin (), other.end ()) {} public: typedef debug_info_entry value_type; }; - class attributes : public std::map<int, attr_value> + class attributes_type : public std::map<int, attr_value> { friend class debug_info_entry; private: typedef std::map<int, attr_value> base_type; - attributes () {} + attributes_type () {} template<typename attrs> - attributes (const attrs &other) + attributes_type (const attrs &other) : std::map<int, attr_value> (other.begin (), other.end ()) {} public: @@ -135,8 +135,8 @@ namespace elfutils private: const int _m_tag; - attributes _m_attributes; - children _m_children; + attributes_type _m_attributes; + children_type _m_children; public: debug_info_entry (int t) : _m_tag (t) @@ -164,20 +164,20 @@ namespace elfutils return !_m_children.empty (); } - inline class children &children () + inline children_type &children () { return _m_children; } - inline const class children &children () const + inline const children_type &children () const { return _m_children; } - inline class attributes &attributes () + inline attributes_type &attributes () { return _m_attributes; } - inline const class attributes &attributes () const + inline const attributes_type &attributes () const { return _m_attributes; } @@ -206,7 +206,7 @@ namespace elfutils } }; - typedef debug_info_entry::attributes::value_type attribute; + typedef debug_info_entry::attributes_type::value_type attribute; class compile_unit : public debug_info_entry { @@ -813,8 +813,8 @@ namespace elfutils struct value_reference : public value_dispatch { - debug_info_entry::children::iterator ref; - value_reference (const debug_info_entry::children::iterator &i) + debug_info_entry::children_type::iterator ref; + value_reference (const debug_info_entry::children_type::iterator &i) : ref (i) {} template<typename iter> // XXX dummy @@ -1030,7 +1030,7 @@ namespace elfutils return variant<value_address> ().addr; } - inline debug_info_entry::children::iterator reference () const + inline debug_info_entry::children_type::iterator reference () const { return variant<value_reference> ().ref; } diff --git a/libdw/c++/dwarf_tracker b/libdw/c++/dwarf_tracker index 4432d4e1..8382d2e1 100644 --- a/libdw/c++/dwarf_tracker +++ b/libdw/c++/dwarf_tracker @@ -60,10 +60,12 @@ namespace elfutils class dwarf_ref_tracker : public dwarf_tracker_base<dwarf1, dwarf2> { private: - typedef typename dwarf1::compile_units::const_iterator cu1; - typedef typename dwarf2::compile_units::const_iterator cu2; - typedef typename dwarf1::debug_info_entry::children::const_iterator die1; - typedef typename dwarf2::debug_info_entry::children::const_iterator die2; + typedef dwarf_tracker_base<dwarf1, dwarf2> _base; + + typedef typename _base::cu1 cu1; + typedef typename _base::cu2 cu2; + typedef typename _base::die1 die1; + typedef typename _base::die2 die2; /* We maintain the current path down the logical DIE tree from the CU as a stack of iterators pointing to the DIE at each level. */ diff --git a/src/dwarfcmp.cc b/src/dwarfcmp.cc index d4c32108..ecadfd52 100644 --- a/src/dwarfcmp.cc +++ b/src/dwarfcmp.cc @@ -127,12 +127,13 @@ open_file (const char *fname, int *fdp) template<class dwarf1, class dwarf2> struct talker : public dwarf_ref_tracker<dwarf1, dwarf2> { - typedef typename dwarf1::compile_units::const_iterator cu1; - typedef typename dwarf2::compile_units::const_iterator cu2; - typedef typename dwarf1::debug_info_entry::children::const_iterator die1; - typedef typename dwarf2::debug_info_entry::children::const_iterator die2; - typedef typename dwarf1::debug_info_entry::attributes::const_iterator attr1; - typedef typename dwarf2::debug_info_entry::attributes::const_iterator attr2; + typedef dwarf_tracker_base<dwarf1, dwarf2> _base; + typedef typename _base::cu1 cu1; + typedef typename _base::cu2 cu2; + typedef typename _base::die1 die1; + typedef typename _base::die2 die2; + typedef typename die1::value_type::attributes_type::const_iterator attr1; + typedef typename die2::value_type::attributes_type::const_iterator attr2; const typename dwarf1::debug_info_entry *a_; const typename dwarf2::debug_info_entry *b_; diff --git a/src/dwarflint-hl.cc b/src/dwarflint-hl.cc index 0663114f..5a8c4347 100644 --- a/src/dwarflint-hl.cc +++ b/src/dwarflint-hl.cc @@ -209,9 +209,8 @@ recursively_validate (elfutils::dwarf::compile_unit const &cu, }; } - // Check present attributes for expected-ness, and validate value - // space. - for (elfutils::dwarf::debug_info_entry::attributes::const_iterator jt + // Check present attributes for expected-ness, and validate value space. + for (elfutils::dwarf::debug_info_entry::attributes_type::const_iterator jt = parent.attributes ().begin (), jte = parent.attributes ().end (); jt != jte; ++jt) { @@ -244,9 +243,9 @@ recursively_validate (elfutils::dwarf::compile_unit const &cu, } // Check children recursively. - class elfutils::dwarf::debug_info_entry::children const &children + elfutils::dwarf::debug_info_entry::children_type const &children = parent.children (); - for (elfutils::dwarf::debug_info_entry::children::const_iterator jt + for (elfutils::dwarf::debug_info_entry::children_type::const_iterator jt = children.begin (); jt != children.end (); ++jt) recursively_validate (cu, *jt); } diff --git a/tests/dwarf-print.cc b/tests/dwarf-print.cc index ef2536d8..d37a006a 100644 --- a/tests/dwarf-print.cc +++ b/tests/dwarf-print.cc @@ -66,7 +66,7 @@ print_die (const dwarf::debug_info_entry &die, cout << prefix << "<" << tag << " offset=[" << die.offset () << "]"; - for (dwarf::debug_info_entry::attributes::const_iterator i + for (dwarf::debug_info_entry::attributes_type::const_iterator i = die.attributes ().begin (); i != die.attributes ().end (); ++i) cout << " " << (*i).to_string (); @@ -80,7 +80,7 @@ print_die (const dwarf::debug_info_entry &die, cout << ">\n"; - for (dwarf::debug_info_entry::children::const_iterator i + for (dwarf::debug_info_entry::children_type::const_iterator i = die.children ().begin (); i != die.children ().end (); ++i) print_die (*i, indent + 1, limit); |