This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Gdb, PIE and scan_dyntag(DT_DEBUG)
- From: Robert Jarzmik <robert dot jarzmik at free dot fr>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb at sourceware dot org, robert dot jarzmik at intel dot com
- Date: Tue, 01 Apr 2014 00:56:59 +0200
- Subject: Re: Gdb, PIE and scan_dyntag(DT_DEBUG)
- Authentication-results: sourceware.org; auth=none
- References: <87bnwuuhzp dot fsf at free dot fr> <20140331184724 dot GA6038 at host2 dot jankratochvil dot net>
Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> On Tue, 25 Mar 2014 21:43:22 +0100, Robert Jarzmik wrote:
>> I have a problem with gdb not finding the shared library list when analyzing a
>> core dump of an ELF-X86-64 binary on Linux.
>
> The problem is it works for me. Tested on Fedora 20 x86_64 although I am not
> aware of any distro-specific stuff which could affect this functionality.
> It is also relevant to know prelink status but I have tested this
> functionality now even with unprelinked ld.so and libc.so:
OK, you're right.
I finally found the culprit : in my case, it was the linker and strip
discrepency.
To be more precise, the ELF program headers of the unstripped binary and the
stripped binary didn't match, as in the unstripped one the .bss section was
aligned (fileoffset wise) on 8 bytes, while in the stripped version it was
aligned on 4 (as the .bss section alignement).
This was creating different filesizes for the segment containing the .bss
section, and therefore gdb's svr4_relocate_*() function was lost and did not
relocate my PIE executable.
GDB was right, it's the linker which was faulty in my case.
Cheers.
--
Robert