From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8544160341893930601==" MIME-Version: 1.0 From: Mark Wielaard To: elfutils-devel@lists.fedorahosted.org Subject: Re: [PATCH 1/2] libdw: Add new function dwarf_cu_getdwarf. Date: Mon, 18 Aug 2014 16:03:38 +0200 Message-ID: <1408370618.3370.8.camel@bordewijk.wildebeest.org> In-Reply-To: 87bnrjs80u.fsf@redhat.com --===============8544160341893930601== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Sun, 2014-08-17 at 12:52 +0200, Dodji Seketeli wrote: > Mark Wielaard writes: > = > > In both systemtap and libabigail there is a need to get the actual Dwarf > > underlying an Dwarf_Die or Dwarf_Attribute. Following a DIE reference > > might end up in an alternate Dwarf since the addition of DWZ multifile > > forms. Both Dwarf_Die and Dwarf_Attribute already contain a Dwarf_CU > > handle. Add a function dwarf_cu_getdwarf to retrieve the underlying > > Dwarf using the Dwarf_CU. > = > Thanks Mark! > = > This, indeed, is going to be useful for libabigail at least. This new > dwarf_cu_getdwarf function, along with the existing dwarf_diecu function > will allow us to get the actual Dwarf a given DIE comes from. And with > the recently added dwarf_getalt function, we'll be able to tel if the > DIE comes from the alternate Dwarf or not. This is awesome. Glad it is useful. Do note that the existing dwarf_diecu gives you the top-level Dwarf_Die for the CU, not a Dwarf_CU. Both the original Dwarf_Die and the result from dwarf_diecu should have the same Dwarf_CU handle that you can use with dwarf_cu_getdwarf. The Dwarf_CU represents the actual DWARF CU concept, from which you can get some extra information not like address or offset size used in the particular DIE tree (see also dwarf_cudie that returns both that extra information and the top level Dwarf_DIE for the CU). While the top-level Dwarf_Die is the compile/partial/type_unit DIE (all other DIEs in the CU are children of this DIE). Cheers, Mark --===============8544160341893930601==--