From: Roland McGrath Date: Wed, 30 Sep 2009 23:17:37 +0000 (-0700) Subject: Add C++ dwarf::debug_info_entry constructor for lookup by offset, CU accessor. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=308f2d00aa894cf9dcba9f19726f2c8717cb67fa;p=thirdparty%2Felfutils.git Add C++ dwarf::debug_info_entry constructor for lookup by offset, CU accessor. --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index dbd97019e..1800a2950 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,9 @@ 2009-09-30 Roland McGrath + * c++/dwarf (dwarf::debug_info_entry): Make constructor from file and + offset public. + (dwarf::debug_info_entry::compile_unit): New method. + * c++/dwarf_comparator (dwarf_comparator::reference_match): Use the subtracker/subcomparator for attributes too. diff --git a/libdw/c++/dwarf b/libdw/c++/dwarf index 3f7210e03..71e3185ba 100644 --- a/libdw/c++/dwarf +++ b/libdw/c++/dwarf @@ -437,13 +437,22 @@ namespace elfutils memset (&_m_die, 0, sizeof _m_die); } + public: + debug_info_entry (const debug_info_entry &die) : _m_die (die._m_die) {} + inline debug_info_entry (const dwarf &dw, ::Dwarf_Off off) { dw.xif (::dwarf_offdie (dw._m_dw, off, &_m_die) == NULL); } - public: - debug_info_entry (const debug_info_entry &die) : _m_die (die._m_die) {} + /* Return the compile_unit entry containing this entry. + Note this might be a DW_TAG_partial_unit. */ + inline debug_info_entry compile_unit () const + { + debug_info_entry result; + xif (::dwarf_diecu (thisdie (), &result._m_die, NULL, NULL) == NULL); + return result; + } // Containers, see class definitions below. class raw_children_type;