Re: question about why gdb needs executable's binary

Jan Kratochvil <[email protected]>
Newsgroups gmane.comp.gdb.devel,gmane.comp.gdb.general
Message-ID <[email protected]>
On Tue, 19 Mar 2019 16:25:30 +0100, Jirka Koutný 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 first
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
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.