Re: question about why gdb needs executable's binary

Jirka Koutný <[email protected]> Tue, 19 Mar 2019 15:47:36 +0000
Newsgroups gmane.comp.gdb.devel,gmane.comp.gdb.general
Message-ID <CAH5nFm8eK0uOWtgm2rvpeHBSVN6f_PqW2Wd98RGaUuKR6evMxA@mail.gmail.com>
Aha, perfect, now it makes sense, thank you very much for your patience :)

Den tir. 19. mar. 2019 kl. 15:41 skrev Jan Kratochvil <
[email protected]>:

> On Tue, 19 Mar 2019 16:25:30 +0100, Jirka Koutn=C3=BD wrote:
> > I see, just to make sure - DT_DEBUG gets dumped into the corefile, is
> that
> > correct?
>
> The PT_DYNAMIC segment containing the DT_DEBUG pointer (pointing to
> r_debug/_r_debug) normally gets dumped into the core file. The problem is
> that
> without having the main executable one cannot much find where is the
> DT_DEBUG
> pointer located in the core file. Core file has for example NT_AUXV where
> is
> AT_PHDR and from program headers one could find PT_DYNAMIC where is
> DT_DEBUG.
> But core file does not have to contain the program headers as those may be
> in
> a read-only page of the main executable. Nowadays with dumping of the fir=
st
> page of any ELF (even if it is read-only, for its NT_GNU_BUILD_ID) one can
> probably find the program headers there. But then one can also just read
> NT_FILE nowadays.
>
>
> Jan
>