public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Mike Tsai via Gdb <gdb@sourceware.org>
Cc: Mike Tsai <bibibobibo@gmail.com>
Subject: Re: set sysroot and debug-file-directory don't work together?
Date: Sun, 10 Dec 2023 16:11:23 -0700	[thread overview]
Message-ID: <87zfyh64bo.fsf@tromey.com> (raw)
In-Reply-To: <CAEopbebOSwvmLEkzGxj7mmQgBSnk11wDVNBQeCZ8XDsaptnyMw@mail.gmail.com> (Mike Tsai via Gdb's message of "Mon, 27 Nov 2023 12:55:19 -0800")

>>>>> "Mike" == Mike Tsai via Gdb <gdb@sourceware.org> writes:

Mike> I have a dummy question regarding using "set sysroot LOCAL_DIR" and
Mike> "set debug-file-directory SOME_OTHER_DIR" together to find symbols for
Mike> a debug session. I was under the impression, gdb is able to fallback
Mike> to debug-file-directory and do build-id style lookup if symbols cannot
Mike> be found in "sysroot", but it does not seem to be doing that so I am
Mike> curious if it's I am doing something wrong or this is not "supported".

I didn't know the answer either, so I looked through the source a bit.

In the end it's just a pain to try to figure out what this code is
doing.  Far easier, probably, is for you to:

    set debug separate-debug-file 1

... and then try.  I think that will show exactly the paths gdb is
trying to use.

I tried it with "file /bin/ls":

    (gdb) file /bin/ls
    Reading symbols from /bin/ls...

    Looking for separate debug info (build-id) for /usr/bin/ls
      Trying /usr/lib/debug/.build-id/a1/46002a40b622e4d8420c5b96513f0784c8eb7b.debug... no, unable to compute real path
      Trying target:/usr/lib/debug/.build-id/a1/46002a40b622e4d8420c5b96513f0784c8eb7b.debug... no, unable to open.

    Looking for separate debug info (debug link) for /usr/bin/ls
      Trying /usr/bin/ls-9.1-12.fc38.x86_64.debug... no, unable to open.
      Trying /usr/bin/.debug/ls-9.1-12.fc38.x86_64.debug... no, unable to open.
      Trying /usr/lib/debug//usr/bin/ls-9.1-12.fc38.x86_64.debug... no, unable to open.
    Reading symbols from .gnu_debugdata for /usr/bin/ls...
    (No debugging symbols found in .gnu_debugdata for /usr/bin/ls)

... IMO pretty readable.

If I "set sysroot /tmp/nonesuch" first, then only that "target:" line
changes.

This order seems sort of backward to me somehow, like if I had a
complete sysroot setup (including all separate debug files), then "set
sysroot" should be sufficient and it should never check outside.  I
suppose with .build-id the idea is that the hashes are global and so it
doesn't matter exactly where gdb finds the match.

Tom

      reply	other threads:[~2023-12-10 23:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 20:55 Mike Tsai
2023-12-10 23:11 ` Tom Tromey [this message]

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=87zfyh64bo.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=bibibobibo@gmail.com \
    --cc=gdb@sourceware.org \
    /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).