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
  0 siblings, 1 reply; 2+ 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] 2+ 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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2023-09-19  9:49 UTC | newest]

Thread overview: 2+ 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

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