Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Document that index-cache requires build ID
@ 2025-04-06 11:15 Lluís Batlle i Rossell
  2025-04-17 17:06 ` Guinevere Larsen
  0 siblings, 1 reply; 4+ messages in thread
From: Lluís Batlle i Rossell @ 2025-04-06 11:15 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 9 bytes --]

Attached

[-- Attachment #2: 0001-Document-that-index-cache-requires-build-ID.patch --]
[-- Type: text/plain, Size: 1655 bytes --]

From 4dfcd1888e3fc3c5707e3f697268d820679a1c7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= <viric@viric.name>
Date: Sun, 6 Apr 2025 13:11:06 +0200
Subject: [PATCH] Document that index-cache requires build ID

---
 gdb/doc/gdb.texinfo | 2 ++
 gdb/dwarf2/read.c   | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e034ac53295..37b65ab72ac 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22934,6 +22934,8 @@ Indices only work when using DWARF debugging information, not stabs.
 It is possible for @value{GDBN} to automatically save a copy of this index in a
 cache on disk and retrieve it from there when loading the same binary in the
 future.  This feature can be turned on with @kbd{set index-cache enabled on}.
+Note that the cache will use the ELF build ID to identify the cached indices,
+so files without Build ID will not have their index cached.
 The following commands can be used to tweak the behavior of the index cache.
 
 @table @code
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 71fd352343a..f6a221a57de 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2237,7 +2237,11 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
 {
   const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ());
   if (build_id == nullptr)
+  {
+    dwarf_read_debug_printf ("Not using index-cache for %s due to missing build-id",
+            objfile_name (obj));
     return {};
+  }
 
   return global_index_cache.lookup_gdb_index (build_id,
 					      &dwarf2_per_bfd->index_cache_res);
-- 
2.47.0


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

* Re: [PATCH] Document that index-cache requires build ID
  2025-04-06 11:15 [PATCH] Document that index-cache requires build ID Lluís Batlle i Rossell
@ 2025-04-17 17:06 ` Guinevere Larsen
  2025-04-18  5:34   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Guinevere Larsen @ 2025-04-17 17:06 UTC (permalink / raw)
  To: Lluís Batlle i Rossell, gdb-patches; +Cc: Eli Zaretskii (eliz@gnu.org)

[-- Attachment #1: Type: text/plain, Size: 2988 bytes --]

On 4/6/25 8:15 AM, Lluís Batlle i Rossell wrote:
> Attached

Thanks for your patch! If you plan to continue contributing to GDB, we 
tend to prefer patches in the body of the email, as it makes for an 
easier time reviewing. But as your first submission, its absolutely 
fine. I've added the patch here for comments:


     From 4dfcd1888e3fc3c5707e3f697268d820679a1c7b Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= <viric@viric.name>
    Date: Sun, 6 Apr 2025 13:11:06 +0200
    Subject: [PATCH] Document that index-cache requires build ID

    ---
      gdb/doc/gdb.texinfo | 2 ++
      gdb/dwarf2/read.c   | 4 ++++
      2 files changed, 6 insertions(+)

    diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
    index e034ac53295..37b65ab72ac 100644
    --- a/gdb/doc/gdb.texinfo
    +++ b/gdb/doc/gdb.texinfo
    @@ -22934,6 +22934,8 @@ Indices only work when using DWARF debugging
    information, not stabs.
      It is possible for @value{GDBN} to automatically save a copy of
    this index in a
      cache on disk and retrieve it from there when loading the same
    binary in the
      future.  This feature can be turned on with @kbd{set index-cache
    enabled on}.
    +Note that the cache will use the ELF build ID to identify the
    cached indices,
    +so files without Build ID will not have their index cached.
      The following commands can be used to tweak the behavior of the
    index cache.

Since there are documentation changes, we need Eli Zaretskii to approve 
this change. I've CC'd him in this email.


      @table @code
    diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
    index 71fd352343a..f6a221a57de 100644
    --- a/gdb/dwarf2/read.c
    +++ b/gdb/dwarf2/read.c
    @@ -2237,7 +2237,11 @@ get_gdb_index_contents_from_cache (objfile
    *obj, dwarf2_per_bfd *dwarf2_per_bfd)
      {
        const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ());
        if (build_id == nullptr)
    +  {
    +    dwarf_read_debug_printf ("Not using index-cache for %s due to
    missing build-id",
    +            objfile_name (obj));
          return {};
    +  }

At first I thought this was better suited for an index_cache_debug 
version - since it already exists. But since we already have a dwarf 
debug printf related to index-cache, I think this should be fine.

One note for future patches, our style is to increase the indentation 
for the braces by 2 spaces, and 2 further spaces for code. And if we 
break up arguments for a function call, we align them in columns. These 
can be fixed by the maintainer who pushes your patch, though.

With the styling issues fixed, I'm happy to give my review tag, and hope 
this is approved soon!

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>


        return global_index_cache.lookup_gdb_index (build_id,
    &dwarf2_per_bfd->index_cache_res);
    -- 
    2.47.0


-- 
Cheers,
Guinevere Larsen
She/Her/Hers

[-- Attachment #2: Type: text/html, Size: 4220 bytes --]

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

* Re: [PATCH] Document that index-cache requires build ID
  2025-04-17 17:06 ` Guinevere Larsen
@ 2025-04-18  5:34   ` Eli Zaretskii
  2026-02-21 17:15     ` Sam James
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2025-04-18  5:34 UTC (permalink / raw)
  To: Guinevere Larsen; +Cc: viric, gdb-patches

> Date: Thu, 17 Apr 2025 14:06:31 -0300
> Cc: "Eli Zaretskii (eliz@gnu.org)" <eliz@gnu.org>
> From: Guinevere Larsen <guinevere@redhat.com>
> 
>  From 4dfcd1888e3fc3c5707e3f697268d820679a1c7b Mon Sep 17 00:00:00 2001
>  From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= <viric@viric.name>
>  Date: Sun, 6 Apr 2025 13:11:06 +0200
>  Subject: [PATCH] Document that index-cache requires build ID
> 
>  ---
>   gdb/doc/gdb.texinfo | 2 ++
>   gdb/dwarf2/read.c   | 4 ++++
>   2 files changed, 6 insertions(+)
> 
>  diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
>  index e034ac53295..37b65ab72ac 100644
>  --- a/gdb/doc/gdb.texinfo
>  +++ b/gdb/doc/gdb.texinfo
>  @@ -22934,6 +22934,8 @@ Indices only work when using DWARF debugging information, not stabs.
>   It is possible for @value{GDBN} to automatically save a copy of this index in a
>   cache on disk and retrieve it from there when loading the same binary in the
>   future.  This feature can be turned on with @kbd{set index-cache enabled on}.
>  +Note that the cache will use the ELF build ID to identify the cached indices,
>  +so files without Build ID will not have their index cached.
>   The following commands can be used to tweak the behavior of the index cache.
> 
> Since there are documentation changes, we need Eli Zaretskii to approve this change. I've CC'd him in this
> email.

Sorry for missing the original submission.

The patch for gdb.texinfo is okay, but please use "build ID", not
"Build ID", for the second instance, to be consistent about the
letter-case.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>

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

* Re: [PATCH] Document that index-cache requires build ID
  2025-04-18  5:34   ` Eli Zaretskii
@ 2026-02-21 17:15     ` Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2026-02-21 17:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Guinevere Larsen, viric, gdb-patches


[-- Attachment #1.1: Type: text/plain, Size: 1884 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Thu, 17 Apr 2025 14:06:31 -0300
>> Cc: "Eli Zaretskii (eliz@gnu.org)" <eliz@gnu.org>
>> From: Guinevere Larsen <guinevere@redhat.com>
>> 
>>  From 4dfcd1888e3fc3c5707e3f697268d820679a1c7b Mon Sep 17 00:00:00 2001
>>  From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= <viric@viric.name>
>>  Date: Sun, 6 Apr 2025 13:11:06 +0200
>>  Subject: [PATCH] Document that index-cache requires build ID
>> 
>>  ---
>>   gdb/doc/gdb.texinfo | 2 ++
>>   gdb/dwarf2/read.c   | 4 ++++
>>   2 files changed, 6 insertions(+)
>> 
>>  diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
>>  index e034ac53295..37b65ab72ac 100644
>>  --- a/gdb/doc/gdb.texinfo
>>  +++ b/gdb/doc/gdb.texinfo
>>  @@ -22934,6 +22934,8 @@ Indices only work when using DWARF debugging information, not stabs.
>>   It is possible for @value{GDBN} to automatically save a copy of this index in a
>>   cache on disk and retrieve it from there when loading the same binary in the
>>   future.  This feature can be turned on with @kbd{set index-cache enabled on}.
>>  +Note that the cache will use the ELF build ID to identify the cached indices,
>>  +so files without Build ID will not have their index cached.
>>   The following commands can be used to tweak the behavior of the index cache.
>> 
>> Since there are documentation changes, we need Eli Zaretskii to approve this change. I've CC'd him in this
>> email.
>
> Sorry for missing the original submission.
>
> The patch for gdb.texinfo is okay, but please use "build ID", not
> "Build ID", for the second instance, to be consistent about the
> letter-case.
>
> Reviewed-By: Eli Zaretskii <eliz@gnu.org>

I've gone ahead and taken the liberty to push this as obvious enough,
having run into this again recently. I applied your casing tweak and the
style tweaks from Guinevere.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Document-that-index-cache-requires-build-ID.patch --]
[-- Type: text/x-patch, Size: 1966 bytes --]

From 10b5513e6d9a5a8d72bff272b6f254a3b68abc56 Mon Sep 17 00:00:00 2001
Message-ID: <10b5513e6d9a5a8d72bff272b6f254a3b68abc56.1771693680.git.sam@gentoo.org>
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= <viric@viric.name>
Date: Sun, 6 Apr 2025 13:11:06 +0200
Subject: [PATCH] Document that index-cache requires build ID

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
---
 gdb/doc/gdb.texinfo | 2 ++
 gdb/dwarf2/read.c   | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5b99c2b2e23..3b2401117c7 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -23198,6 +23198,8 @@ Indices only work when using DWARF debugging information.
 It is possible for @value{GDBN} to automatically save a copy of this index in a
 cache on disk and retrieve it from there when loading the same binary in the
 future.  This feature can be turned on with @kbd{set index-cache enabled on}.
+Note that the cache will use the ELF build ID to identify the cached indices,
+so files without build ID will not have their index cached.
 The following commands can be used to tweak the behavior of the index cache.
 
 @table @code
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 5f18d5f2e9a..302b137526f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2302,7 +2302,11 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
 {
   const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ());
   if (build_id == nullptr)
-    return {};
+    {
+      dwarf_read_debug_printf ("Not using index-cache for %s due to missing build-id",
+			       objfile_name (obj));
+      return {};
+    }
 
   return global_index_cache.lookup_gdb_index (build_id,
 					      &dwarf2_per_bfd->index_cache_res);

base-commit: 646982f4295bf0a1e64867606d496c34c9a15a0c
-- 
2.53.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 418 bytes --]

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

end of thread, other threads:[~2026-02-21 17:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-06 11:15 [PATCH] Document that index-cache requires build ID Lluís Batlle i Rossell
2025-04-17 17:06 ` Guinevere Larsen
2025-04-18  5:34   ` Eli Zaretskii
2026-02-21 17:15     ` Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox