public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30871] New: [gdb/symtab] Means to control finding debuginfo (without/with sysroot prefix)
@ 2023-09-19  8:18 vries at gcc dot gnu.org
  2023-09-19  9:49 ` [Bug symtab/30871] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-19  8:18 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30871

            Bug ID: 30871
           Summary: [gdb/symtab] Means to control finding debuginfo
                    (without/with sysroot prefix)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

As documented here (
https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html ), there
are two ways to find debuginfo:
- build-id, and
- debug link.

The build-id is tried first, then the debug link.

Then each case also tries first without, then with sysroot prefix.

Together this results in 4 different ways to get to the debuginfo.

AFAIK, in the test-suite we have test-cases that exercise the build-id and
debug link scenarios individually.

But that's not the case for the without/with sysroot prefix cases.

It would be good to have a way (say a maintenance command) that determines the
ways in which debug info can be found.

That way we could enforce using the with sysroot case.

[ This is relevant in the context of containers.  Say we have a container, with
an exec and corresponding debug info installed.  When we use gdb inside the
container to debug the exec, we find the debuginfo using the without sysroot
method.  When we try the same from outside the container, the without sysroot
method fails (because the debug info is installed in the container, not
outside) and falls back to the with sysroot method, which will look for the
debug info inside the container. ]

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug symtab/30871] [gdb/symtab] Means to control finding debuginfo (without/with sysroot prefix)
  2023-09-19  8:18 [Bug symtab/30871] New: [gdb/symtab] Means to control finding debuginfo (without/with sysroot prefix) vries at gcc dot gnu.org
@ 2023-09-19  9:49 ` vries at gcc dot gnu.org
  2024-05-20 14:17 ` aburgess at redhat dot com
  2024-05-22 14:04 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-19  9:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30871

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Put differently, with this patch applied:
...
diff --git a/gdb/build-id.c b/gdb/build-id.c
index f68384f0197..1ab9fd8b4c5 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -174,6 +174,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte
*build_id,
       if (debug_bfd != NULL)
        return debug_bfd;

+#if 0
       /* Try to look under the sysroot as well.  If the sysroot is
         "/the/sysroot", it will give
         "/the/sysroot/usr/lib/debug/.build-id/ab/cdef.debug".  */
@@ -185,6 +186,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte
*build_id,
          if (debug_bfd != NULL)
            return debug_bfd;
        }
+#endif
     }

   return {};
...
no test-case in the test suite starts failing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug symtab/30871] [gdb/symtab] Means to control finding debuginfo (without/with sysroot prefix)
  2023-09-19  8:18 [Bug symtab/30871] New: [gdb/symtab] Means to control finding debuginfo (without/with sysroot prefix) vries at gcc dot gnu.org
  2023-09-19  9:49 ` [Bug symtab/30871] " vries at gcc dot gnu.org
@ 2024-05-20 14:17 ` aburgess at redhat dot com
  2024-05-22 14:04 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: aburgess at redhat dot com @ 2024-05-20 14:17 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30871

Andrew Burgess <aburgess at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aburgess at redhat dot com

--- Comment #2 from Andrew Burgess <aburgess at redhat dot com> ---
Hi Tom,

I was taking a look at this, and I wasn't clear on why we need a new
maintenance command?

Your point seems solid: there are no tests for finding debug information using
the sysroot, but isn't the fix to that just to add such a test?  How does the
new maintenance command help us?

Anyway, I posted this:

https://inbox.sourceware.org/gdb-patches/cover.1716214388.git.aburgess@redhat.com

As an attempt to address this patch.  I can look at extending it if some case
isn't being covered sufficiently.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug symtab/30871] [gdb/symtab] Means to control finding debuginfo (without/with sysroot prefix)
  2023-09-19  8:18 [Bug symtab/30871] New: [gdb/symtab] Means to control finding debuginfo (without/with sysroot prefix) vries at gcc dot gnu.org
  2023-09-19  9:49 ` [Bug symtab/30871] " vries at gcc dot gnu.org
  2024-05-20 14:17 ` aburgess at redhat dot com
@ 2024-05-22 14:04 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-22 14:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30871

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Andrew Burgess from comment #2)
> Hi Tom,
> 
> I was taking a look at this, and I wasn't clear on why we need a new
> maintenance command?
> 
> Your point seems solid: there are no tests for finding debug information
> using the sysroot, but isn't the fix to that just to add such a test?  How
> does the new maintenance command help us?
> 
> Anyway, I posted this:
> 
> https://inbox.sourceware.org/gdb-patches/cover.1716214388.git.
> aburgess@redhat.com
> 
> As an attempt to address this patch.  I can look at extending it if some
> case isn't being covered sufficiently.

Hi Andrew,

I think you're right, a new (maintenance) command isn't necessary to test the
behaviour.

I think I conflated two ideas in this PR:
- IWBN to have a command to show and control how debuginfo is found,
determining
  allowed methods (build-id/debug-link/both, with/without sysroot/both) and
  order in which they're tried.
- a test-case for finding debuginfo via the sysroot is missing

When filing the PR I thought of the test-case in terms of using the command. 
But it's also possible to write a test-case to check one scenario by making
sure the other scenarios will fail, which I suppose is what you have done in
the patch series.

Anyway, I'll take a look at the series, thanks for taking care of the missing
test-case.

You mention extending the test-case, and one thing I can think of that is
nice-to-have, is using symlinks, in other words exercising PR30866 and adding a
KFAIL for that.

As for the command, AFAIC it's a nice-to-have which could be useful.  For
instance, my guess is that users who set up debug info on the sysroot might
want to have a means to skip trying to look up debug packages without the
sysroot prefix.  But if there's no demand for it, I'm more than happy to drop
it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-22 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-19  8:18 [Bug symtab/30871] New: [gdb/symtab] Means to control finding debuginfo (without/with sysroot prefix) vries at gcc dot gnu.org
2023-09-19  9:49 ` [Bug symtab/30871] " vries at gcc dot gnu.org
2024-05-20 14:17 ` aburgess at redhat dot com
2024-05-22 14:04 ` vries at gcc dot gnu.org

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).