public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Mike Tsai <bibibobibo@gmail.com>
To: gdb@sourceware.org
Subject: set sysroot and debug-file-directory don't work together?
Date: Mon, 27 Nov 2023 12:55:19 -0800	[thread overview]
Message-ID: <CAEopbebOSwvmLEkzGxj7mmQgBSnk11wDVNBQeCZ8XDsaptnyMw@mail.gmail.com> (raw)

Greetings everyone,

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

A little context, we are doing embedded device debugging for Linux
based platform hence, the target device will not have sufficient space
to host all debug symbols. We have most of the debug symbols in the
"sysroot", and for something that is built outside, we want to export
additional symbols look up through debug-file-directory and debug over
gdb+gdbserver.

I will share my gdbinit as well. It isn't terribly sophisticated :)
and I am on GNU gdb (GDB) 11.2
```
set verbose on
set pagination off
set sysroot /path/to/rootfs
set debug-file-directory /path/to/more-debug/
set substitute-path /usr/src/debug /path/to/rootfs/usr/src/debug
set detach-on-fork on
set follow-fork-mode child
target remote :5039
where
```

I am trying to debug a binary whose symbols do not exist in the
"sysroot", so I expect the symbols to be picked up from
debug-file-directory, but above isn't working as it seems if sysroot
is specified, it will not fallback to debug-file-directory. If I
comment out sysroot line, GDB will attempt to load the debug symbols
through the local build-id/ mechanism as I would expect, but then it
will not have additional libs debug provided by the "sysroot". So yap,
this is what I am struggling with currently and would like to know if
I am not configuring something right or this is expected behavior and
how to get it to work the way I intend to use this.

Thanks,
Mike

             reply	other threads:[~2023-11-27 20:55 UTC|newest]

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

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=CAEopbebOSwvmLEkzGxj7mmQgBSnk11wDVNBQeCZ8XDsaptnyMw@mail.gmail.com \
    --to=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).