Re: set sysroot and debug-file-directory don't work together?

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
>>>>> "Mike" == Mike Tsai via Gdb <[email protected]> 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
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.