]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Add C++ dwarf::debug_info_entry constructor for lookup by offset, CU accessor.
authorRoland McGrath <roland@redhat.com>
Wed, 30 Sep 2009 23:17:37 +0000 (16:17 -0700)
committerRoland McGrath <roland@redhat.com>
Wed, 30 Sep 2009 23:17:37 +0000 (16:17 -0700)
libdw/ChangeLog
libdw/c++/dwarf

index dbd97019e8c17415b4be0a1a1e66d316af1d80e7..1800a2950bb8c394c7901623d58fb152e110c358 100644 (file)
@@ -1,5 +1,9 @@
 2009-09-30  Roland McGrath  <roland@redhat.com>
 
+       * 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.
 
index 3f7210e03921fb74fe5c257d192737e727d247b6..71e3185ba274486226427134cb66be6aae343fe0 100644 (file)
@@ -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;