Re: [patch] Relocate phdr in read_program_header

Jan Kratochvil
2011-10-18T13:32:22Z

On Mon, 17 Oct 2011 18:26:28 +0200, Aleksandar Ristovski wrote:
> I was contemplating a testcase but I couldn't think of a trick to
> "make" gdb not find the executable... Thanks for the test.

The testcase of mine has a problem it will stop working in future.
[patch] Attach to running but deleted executable
http://sourceware.org/ml/gdb-patches/2010-03/msg00950.html

The problem is the patch above is not so useful as it still does not work for
deleted libraries, there was discussed some Linux kernel support like
/proc/PID/mappedfileshandlesdirectory/ but it probably has not happened yet.

Anyway one could also use gdbserver - which is probably the case your fix
targets IIUC, the testcase will regress with a fix like above.

> <date> Aleksandar Ristovski <aristovski@qnx.com>
>
> * solib-svr4.c (read_program_header): New variable pt_phdr,
> initialize
> it from target PT_PHDR p_vaddr, relocate sect_addr by it.

There should be now two new variables pt_phdr and pt_phdr_p. :-)

OK with that ChangeLog change in a single commit with my testcase.

Thanks,
Jan