From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id lcbPEUk1AWiGmTgAWB0awg (envelope-from ) for ; Thu, 17 Apr 2025 13:07:21 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DtATLhja; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 37F171E0C3; Thu, 17 Apr 2025 13:07:21 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5352C1E05C for ; Thu, 17 Apr 2025 13:07:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C12A23857002 for ; Thu, 17 Apr 2025 17:07:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C12A23857002 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DtATLhja Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 725C7385770D for ; Thu, 17 Apr 2025 17:06:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 725C7385770D Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 725C7385770D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744909599; cv=none; b=UyNsoQ2jdD38hWQumXmcMFutyyd5iQW96hJyHoEuYLAzNmziqQUyAxLYF+xjrTy/yqJJOOHL7e6IxB1EL2tWSMwTtJ4toBWe7g2O9mRjmXW9LLSZm9qRX5AlPEdyPg7DU7nKpTawc9IVwxxugyhkRR9hyZv+l9nxSilh793R/G8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744909599; c=relaxed/simple; bh=4O+soqyxOFL5BNuCkXnhAylfwrJOhVRI07M5PtAzL/w=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=iYMKimTaD2OLMFqEQZGXrjqEYhm+KfVDga1jK5J+mOJXqLMJmA9jzyb9Bc50DuSL2nAo9/t6v3z5FlAhKRxoU7GpbJqzxa5tMWRl1AbcApeuX7TzR9DSmeBfjC5RCCMVsMlYyPkdvd3yLhig1oDCrng0G8elcNFdVnrKUSRgL50= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 725C7385770D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744909599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hukB7YMRnI9VGjV7nPoseePHiSUnRgkzNpnV0koqyg4=; b=DtATLhja7YfCcJ9273D7jHI3y0iHHqwJce7Ojf7puD0SCi+vQrjj1jWoE6h8HhTGSx2a// A/DuJED5hKwGLjCzfmfqcNMTFigTEeV+OMcU5MN7zskKc+hzJh6hsSL83kZ9pVV4ZoUgs4 ZhqqbRyzfEqSa000yKzJ9/aLEcHtvHc= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-310-e6jL7EJNNS65Rvt_eN8dng-1; Thu, 17 Apr 2025 13:06:37 -0400 X-MC-Unique: e6jL7EJNNS65Rvt_eN8dng-1 X-Mimecast-MFC-AGG-ID: e6jL7EJNNS65Rvt_eN8dng_1744909596 Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2ff8340d547so838313a91.2 for ; Thu, 17 Apr 2025 10:06:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744909596; x=1745514396; h=in-reply-to:from:cc:content-language:references:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=hukB7YMRnI9VGjV7nPoseePHiSUnRgkzNpnV0koqyg4=; b=wSw+kZHVvNnRWFcdIvatIU7MKfgtXJ9Jaz/eWJmKIQZdJBNGiytXB7oCQnjHZy8NKT StuXmcetczH0+8quvoTEysg7IJ4b/THkeqZW1nhEB+IYMgHKx8GK+8PT4v6itgfNl/6u jfXz7wlTflcXJclbnx2/H5lU3myynYkzHopTNQsrj5E/9jtsw5Nr6OUuOy0uzK7xURcT Or03+esERyLE5YTAneoPumJ3QAmFyuXrR+1LuKPsFjyGWYDGW4NIcObr2qikFpEWKcou C7w7kpY4RlrO3xuNfP59fq7RWKBlXOv1ASAh21T8RB6vQ0zuhPexM3n10mFlWsaN4FU1 6H4A== X-Forwarded-Encrypted: i=1; AJvYcCVs83adejweuzV8rZfYm4t96zSExgnzdMIToRYlXPAXJPdUnD1NsCTGsRAHH9ZkxOusApn/wsa6hBEhPg==@sourceware.org X-Gm-Message-State: AOJu0YzKeksF0anKlLBOP+hz7CUb2WrJDHj6I5VQmWKHBJ3GW/oa7V9h 0/Q+HrjheRoafBdxndDlszSsFfg9Zn92YOt9eZp+Km2jZ4rB1Ul6cNEbDsp+0TLOs60O+auafYR 9BoxHjFaxNtIVY9P5rGCcM5cDsVFre2h05ptjZtNYIm4d2aQJHpsSs2+NEHs= X-Gm-Gg: ASbGncukymHOCHBFcWntfOuoaF1zYMq7jaeXwnqrnfnCLdfmXfbr+9knnIV+crPfJr/ 8BkvYjZaKbjJv1UPeyQFlkkK2lR+8iPX1NQiJCRbJZkPQZydjJMTeoE569cm3vzAWhUC6b21mBV b4YsA5mFLywzMOKwYO2Bv6OWITSe3+LpEY8v33DBhoKgqLwL4ObDpE4hwswryPyxKBgvRdBPRHd jBhjs7p8udiGA+prH9QKYCgbVLQ2m2+J6z8nC6pSIZMdopIAlQfRCRpBqcBwQwq2Yc//tASPEvh 1znfCwvFo3GqR7CHP/lvbfQ= X-Received: by 2002:a17:90b:6c4:b0:301:1d03:93cd with SMTP id 98e67ed59e1d1-30864167feamr11094113a91.24.1744909596200; Thu, 17 Apr 2025 10:06:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkvx3HLl/uI1ttHGWKlUX33JRjpb1PxkMqMwV6KwPykIm8H88/XZxuZXayrb8udxPD+1FXHQ== X-Received: by 2002:a17:90b:6c4:b0:301:1d03:93cd with SMTP id 98e67ed59e1d1-30864167feamr11094072a91.24.1744909595848; Thu, 17 Apr 2025 10:06:35 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:9a69::1001? ([2804:14d:8084:9a69::1001]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-308611d6d58sm3952553a91.8.2025.04.17.10.06.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Apr 2025 10:06:35 -0700 (PDT) Message-ID: Date: Thu, 17 Apr 2025 14:06:31 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Document that index-cache requires build ID To: =?UTF-8?Q?Llu=C3=ADs_Batlle_i_Rossell?= , gdb-patches@sourceware.org References: Cc: "Eli Zaretskii (eliz@gnu.org)" From: Guinevere Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: km80maDG2DRMai_NEnoPZSXQSzD-phiI-ZLdLANcZGk_1744909596 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="------------VxJ08OS1wPeKWC1R89lkuCFE" Content-Language: en-US X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This is a multi-part message in MIME format. --------------VxJ08OS1wPeKWC1R89lkuCFE Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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?= 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    return global_index_cache.lookup_gdb_index (build_id, &dwarf2_per_bfd->index_cache_res); -- 2.47.0 -- Cheers, Guinevere Larsen She/Her/Hers --------------VxJ08OS1wPeKWC1R89lkuCFE Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
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
--------------VxJ08OS1wPeKWC1R89lkuCFE--