public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Norbert Lange <nolange79@gmail.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: "Frank Ch. Eigler" <fche@redhat.com>,
	gdb@sourceware.org, Gary Benson <gbenson@redhat.com>
Subject: Re: Automatically fetching Build ID from remote libraries and resole them locally?
Date: Mon, 30 Mar 2020 11:04:30 +0200	[thread overview]
Message-ID: <CADYdroM7B-SSLKRYXJkTcQLbqmwDPkemAs0JPugi2LuYhfV-Sw@mail.gmail.com> (raw)
In-Reply-To: <20200330084522.GA1075780@host1.jankratochvil.net>

Am Mo., 30. März 2020 um 10:45 Uhr schrieb Jan Kratochvil
<jan.kratochvil@redhat.com>:
>
> On Mon, 30 Mar 2020 10:35:30 +0200, Norbert Lange via Gdb wrote:
> > Currently its not possible to detect the Build ID without transferring the
> > whole library from Remote target to the local gdb. I suppose with coredumps
> > its a similar problem. What I would like is using build IDs wherever
> > possible. That means retrieve them from the remote, and maybe define some
> > fileformat to augment coredumps with the information.
>
> Coredumps already contain build-ids of executables + shared libraries as long
> as it is enabled (it is by default):
>         https://www.kernel.org/doc/Documentation/filesystems/proc.txt
>   - (bit 4) ELF header pages in file-backed private memory areas (it is
>             effective only if the bit 2 is cleared)
>
> build-id loading from remote files should be also somehow supported by recent
> GDBs (done by Gary Benson).

Thats great then.

>
> Fedora+RHEL GDB has patchset
>         https://src.fedoraproject.org/rpms/gdb/blob/master/f/gdb-6.6-buildid-locate.patch
>         https://src.fedoraproject.org/rpms/gdb/blob/master/f/gdb-6.6-buildid-locate-solib-missing-ids.patch
>         https://src.fedoraproject.org/rpms/gdb/blob/master/f/gdb-6.6-buildid-locate-core-as-arg.patch
> to locate appropriate executable + shared libraries from such core file by
> build-id - it locates then through symlinks in:
>         /usr/lib/debug/.build-id/6b/6cd649300ec28b47638e766e9cbb58648cbdac{,.debug}
>
> IIUC that patchset should be now being replaced by the elfutils debuginfod.

Still thinking you are misunderstanding me, debuginfod aint helping here.

I am running gdbserver on 'remote' and gdb on 'localpc',
then attaching to the remote target.

I have a version of the libraries on 'localpc' (almost mirrored for
compiling), but they might
not be the exact ones used on the 'remote' (rebuilds, additional libs, etc..)
I would want to use 'set sysroot /path/to/staging/dir', but the downside is that
mismatches will not be detected and can badly mess up debugging.
GDB 9.0 certainly does not use *Build-Ids from the 'remote'*,
neither for files existing on the 'localpc' or not (used strace to
monitor the file lookups).

I could only set 'set sysroot target:/',
at which point all DSOs will be transmitted from 'remote' to
'localpc'. Not exactly what I had in mind.

So, instead I would want GDB to just inspect the Build-ID's from 'remote',
and look them up from 'localpc' (whether its using debuginfod or not,
this is irrelevant here).

Norbert

  reply	other threads:[~2020-03-30  9:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 14:20 Norbert Lange
2020-03-28  0:40 ` Frank Ch. Eigler
2020-03-30  8:35   ` Norbert Lange
2020-03-30  8:45     ` Jan Kratochvil
2020-03-30  9:04       ` Norbert Lange [this message]
2020-03-30  9:19         ` Jan Kratochvil
2020-03-30 18:43           ` Gary Benson
2020-04-06 11:31           ` Norbert Lange
2020-04-06 11:49             ` Jan Kratochvil
2020-04-06 12:08               ` Norbert Lange
2020-04-06 12:16                 ` Jan Kratochvil
2020-04-06 12:53                   ` Norbert Lange
2020-04-06 14:41                     ` Norbert Lange

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=CADYdroM7B-SSLKRYXJkTcQLbqmwDPkemAs0JPugi2LuYhfV-Sw@mail.gmail.com \
    --to=nolange79@gmail.com \
    --cc=fche@redhat.com \
    --cc=gbenson@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).