This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Gdb, PIE and scan_dyntag(DT_DEBUG)
- From: Robert Jarzmik <robert dot jarzmik at free dot fr>
- To: gdb at sourceware dot org
- Cc: robert dot jarzmik at intel dot com
- Date: Tue, 25 Mar 2014 21:43:22 +0100
- Subject: Gdb, PIE and scan_dyntag(DT_DEBUG)
- Authentication-results: sourceware.org; auth=none
Hello,
I'm pretty sure this was already covered somewhere, so a pointer would be great.
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.
After putting traces here and there, it boils down to :
- the executable is placed at a random address (ASLR in linux)
- the displacement is correctly input in AUXV
- the linker base is not correctly computed
The trouble lies in the scan_dyntag(DT_DEBUG) called by elf_locate_base() for me
:
- it tries first target_ops=core_ops, and looks at non-displaced address of
.dynamic => failure => that's great
- it then tries target_ops=exec_ops, and looks at non-displaced address of
.dynamic => it succeeds, returning 0 => that's my problem
As the call succeeded, elf_locate_base() won't call scan_dyntag_auxv()
I manually "forced" elf_locate_base() to call scan_dyntag_aux() and then all my
shared libraries appear.
Could somebody tell me what's wrong in my core/executable/whatever, and why GDB
is looking at the executable file .dynamic section before attempting AUXV
AT_BASE reading and memory read accordingly ?
Cheers.
--
Robert
PS: I'm using GDB 7.6. If it was fixed later I'll happily cherry-pick the patch.