From 308f2d00aa894cf9dcba9f19726f2c8717cb67fa Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 30 Sep 2009 16:17:37 -0700 Subject: [PATCH] Add C++ dwarf::debug_info_entry constructor for lookup by offset, CU accessor. --- libdw/ChangeLog | 4 ++++ libdw/c++/dwarf | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) 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; -- 2.47.3