Gdb, PIE and scan_dyntag(DT_DEBUG)

Robert Jarzmik <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.