Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: "Jirka Koutný" <koutnji2@gmail.com>
Cc: gdb@gnu.org
Subject: Re: question about why gdb needs executable's binary
Date: Tue, 19 Mar 2019 14:35:00 -0000	[thread overview]
Message-ID: <20190319143542.GA3498328@host1.jankratochvil.net> (raw)
In-Reply-To: <CAH5nFm_6aKmacCUfbS5rhOC99qFXQrrn7AGA2OHL11vkqo_abA@mail.gmail.com>

On Tue, 19 Mar 2019 15:25:15 +0100, Jirka Koutný wrote:
> PT_NOTE can't be read by gdb,

Various PT_NOTESs are read by GDB but not PT_NOTE of type NT_FILE.


> That being said, how about dlopen()?

That does not matter, both initially-loaded libraries and dlopen()ed libraries
are present in DT_DEBUG/_r_debug/r_debug the same way.

"initially-loaded library" (which is linked automatically, during compilation
specified by -lNAME) are present in DT_NEEDED but that is for ld.so
(/lib64/ld-linux-x86-64.so.2) and GDB does not care about those.
It would be nice if GDB did but that is an unrelated RFE:
	RFE: preload DT_NEEDED library list
	https://sourceware.org/bugzilla/show_bug.cgi?id=12249


> For what I found out about DT_DEBUG this section gets initialized by ld as

by ld.so (/lib64/ld-linux-x86-64.so.2), not /usr/bin/ld.


> you said. Do I understand you correctly, this is an alternative to the
> first option, that in fact doesn't require the executable?

yes, sort of alternative.  But NT_FILE is generated by kernel so there can
appear even shared libraries mmap()ed as data files while in
DT_DEBUG/_r_debug/r_debug can be found only libraries really opened by
DT_NEEDED or dlopen()ed.  So there is a subtle difference what those two
sources of information mean.

Also NT_FILE is generated only by Linux kernel (or GDB) while
DT_DEBUG/_r_debug/r_debug are present even on non-Linux UNIXes
(if one thinks there still exist some).


Jan


  reply	other threads:[~2019-03-19 14:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 14:25 Jirka Koutný
2019-03-13 14:34 ` Andreas Schwab
2019-03-13 15:41   ` Jirka Koutný
2019-03-13 16:22     ` John Baldwin
2019-03-14 21:51 ` Jan Kratochvil
2019-03-19 14:25   ` Jirka Koutný
2019-03-19 14:35     ` Jan Kratochvil [this message]
2019-03-19 15:25       ` Jirka Koutný
2019-03-19 15:42         ` Jan Kratochvil
2019-03-19 15:47           ` Jirka Koutný

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190319143542.GA3498328@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb@gnu.org \
    --cc=koutnji2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox