This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about why gdb needs executable's binary


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]