Hello,
When attaching to a process without the executable file, gdb reads
pheaders from the target (solib-svr4.c: read_program_header).
However, it does not take into account possibility of having PIE
executable on the other end, resulting in trying to read from
unrelocated phdr address.
This patch addresses the issue by looking for PT_PHDR; if found, uses it
to determine relocation and adjusts address before reading it from
target memory.
Testsuite on x86_64-unknown-linux-gnu did not show any regressions.
Thanks,
Aleksandar Ristovski
QNX Software Systems
... Aleksandar Ristovski <aristovski@qnx.com>
* solib-svr4.c (read_program_header): If PT_PHDR is present, use it
to calculate correct address in case of PIE.