This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help with getting CFA for split debuginfo files


Hi Sukadev,

On Tue, 2014-05-06 at 16:32 -0700, Sukadev Bhattiprolu wrote:
> But I am not sure how to extend the code to work with PC value that points
> to, say __random(), in glibc.
> 
> I have these installed:
> 
> 	glibc-common-2.18-11.fc20.ppc64p7
> 	glibc-2.18-11.fc20.ppc64p7
> 	glibc-headers-2.18-11.fc20.ppc64p7
> 	glibc-debuginfo-common-2.18-11.fc20.ppc64p7
> 	glibc-devel-2.18-11.fc20.ppc64p7
> 	glibc-debuginfo-2.18-11.fc20.ppc64p7
> 
> 	$ objdump -D /usr/lib64/libc-2.18.so
> 
> 	....
> 	00000080a7be3bf0 <.__random>:
> 	  80a7be3bf0:   7c 08 02 a6     mflr    r0
> 	  80a7be3bf4:   fb e1 ff f8     std     r31,-8(r1)
> 	  80a7be3bf8:   60 00 00 00     nop
> 	  80a7be3bfc:   39 00 00 01     li      r8,1
> 	  80a7be3c00:   3b e2 9a f0     addi    r31,r2,-25872
> 	  80a7be3c04:   39 40 00 00     li      r10,0
> 	  80a7be3c08:   f8 01 00 10     std     r0,16(r1)
> 	  80a7be3c0c:   f8 21 ff 71     stdu    r1,-144(r1)
> 	  80a7be3c10:   7d 20 f8 29     lwarx   r9,0,r31,1
> 	  80a7be3c14:   7c 09 50 00     cmpw    r9,r10
> 	  80a7be3c18:   40 82 00 0c     bne     80a7be3c24 <.__random+0x34>
> 	  80a7be3c1c:   7d 00 f9 2d     stwcx.  r8,0,r31
>     >>>>  80a7be3c20:   40 c2 ff f0     bne-    80a7be3c10 <.__random+0x20>
> 	  ....
> 
> 	$ ./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).

You find the .debug_frame CFI through dwfl_module_dwarf_cfi and then
lookup the address using dwarf_cfi_addrframe. The .debug_frame
apparently exists but doesn't contain the requested address. You should
then try to find it through the .eh_frame CFI using dwfl_module_eh_cfi
(or just swap the dwfl_module_dwarf_cfi and dwfl_module_eh_cfi calls
since on fedora the .eh_frame should always be complete because GCC uses
-fasynchronous-unwind-tables by default).

Cheers,

Mark



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]