From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2275656092292318787==" MIME-Version: 1.0 From: Mark Wielaard To: elfutils-devel@lists.fedorahosted.org Subject: Re: Help with getting CFA for split debuginfo files Date: Thu, 08 May 2014 08:54:40 +0200 Message-ID: <1399532081.31604.10.camel@bordewijk.wildebeest.org> In-Reply-To: 20140507220614.GA20216@us.ibm.com --===============2275656092292318787== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Wed, 2014-05-07 at 15:06 -0700, Sukadev Bhattiprolu wrote: > Mark Wielaard [mjw@redhat.com] wrote: > | > $ ./crc5 80a7be3c20 80a7be3c20 /usr/lib64/libc-2.18.so > | > Error dwarf_cfi_addrframe(): : no matching address range > | > Error with addr 0x80a7be3c20 > | > = > | > $ ./crc5 80a7be3c20 80a7be3c20 /usr/lib/debug/lib64/libc.so.6.debug > | > Error dwfl_addrmodule: no error > | > Error with addr 0x80a7be3c20 > | > = > | > Pls find the code attached. Appreciate any comments on how to extend = it > | > to work with split debug info files. > | = > | The first invocation should work (it will find the separate debug info > | file that matches itself through dwfl_standard_find_debuginfo). > = > Thanks for looking into it. > = > I switched the order the dwfl_module_eh_cfi() and dwfl_module_dwarf_cfi() > and did not seem to help, until I noticed that 'bias' is always 0 for > the dwarf_cfi but 0x10000 for the eh_cfi (for the examples I tried). > = > I had code like this before: > = > cfi =3D dwfl_module_eh_cfi(mod, &bias); > = > result =3D dwarf_cfi_addrframe(cfi, pc - bias, &frame); > = > Changing 'pc - bias' to just 'pc' for the eh_cfi, the program seems to wo= rk > for several addresses in libc. Does that change make sense ? Yes, that makes sense if you take the addresses directly from the file. The bias given by dwfl_module_eh_cfi or dwfl_module_dwarf_cfi is the difference between addresses as used in the CFI (from the Elf or Dwarf file - which might be different depending on whether the Dwarf comes from a separate debuginfo file or not) and where the Dwfl_Module is "loaded". The difference matters for example if you construct a Dwfl from a life process or core file. Then the addresses found in the process or core might have to be translated back to the addresses as found in the underlying Elf or Dwarf file. Cheers, Mark --===============2275656092292318787==--