From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id V4dILz500GfxUwwAWB0awg (envelope-from ) for ; Tue, 11 Mar 2025 13:34:54 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=rA+80yiZ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B28E71E105; Tue, 11 Mar 2025 13:34:54 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) 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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 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 C7B1D1E08E for ; Tue, 11 Mar 2025 13:34:52 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 592B53857831 for ; Tue, 11 Mar 2025 17:34:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 592B53857831 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=rA+80yiZ Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id AAB9A3857739 for ; Tue, 11 Mar 2025 17:34:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AAB9A3857739 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AAB9A3857739 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741714454; cv=none; b=BjcLu5Xh1o1AK0pPduCo2bsO5rEmpR8bWh2B3jJaVocEzwIh2MKH15/6fFjaMEWvUb4qMBgT3Vs2PfJTERhK5kyrO2SfBK4fmWa4B0nsBIol2EgDXxBc9uVs9SSrLoH3mMyKPcUyaIlmdOHjvCGoM6VbM4SRlpTAnN3K+3M9YX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741714454; c=relaxed/simple; bh=zbDnoadHuHhko4TJSoNQ06CzZ+y2J2iytuc2PcGoV/w=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=o/k6itwc1OLe08CR9o0UYJMMe74dRaWw4HuRNrH37HyLxch8Jwkn/1UrTPIrV2aqP4GohNVn0z93FEe3RSsdIlchdlyr+9Pdl+/fxCSI5rpWJ7RCOfh+F+DgK75NNN+6NjFuyhGIPBIcGWTCrbh0W1Jrr/SG/cQ4nYvXeu/DAjk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AAB9A3857739 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ts3Ua-00068f-Nw; Tue, 11 Mar 2025 13:34:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=8ShkOQbu6tCHqsojH6K9Y1iApzEXrhWzPPqafk1xC/M=; b=rA+80yiZ6YwZ 7s64SgbMpSaLPzBTootII9G9NPCentizcDHjoxyIKBAfMkkI4d2BKAnkITb2rdZ9YT08jJyG0fmU0 oCCMx8xxTefmIpKb9c8bDqJD4NEK5vw5+EK6oUeKlNKCiqOwG2woD6TIoNNhjPvp4vREOrbfmHcnq 8Y5YHcVR95OSPcjZAReBo5+p0i8DvKJMcZeaQwZ6GX5MX7+AGUJzlvYG19gLuvXKx+qIVDd2Diqgf VGqVSG/R2aqSIF5umNPjbgArCWTCne/43n648xTm59kCjX749Pz8m4oqh5N8fqcKhL+lWsRtiZaFR 7og1hvmPeKYcyxY3jb06GA==; Date: Tue, 11 Mar 2025 19:33:40 +0200 Message-Id: <865xkfbhfv.fsf@gnu.org> From: Eli Zaretskii To: dominikmascherbauer Cc: gdb-patches@sourceware.org In-Reply-To: <9c04ac7d791b96d90c624fba5333f2e9009393a3.1741701275.git.dominik.mascherbauer@oracle.com> (message from dominikmascherbauer on Tue, 11 Mar 2025 15:57:18 +0100) Subject: Re: [PATCH 1/3] Add new commands for controlling type signature fallback. References: <9c04ac7d791b96d90c624fba5333f2e9009393a3.1741701275.git.dominik.mascherbauer@oracle.com> 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 > From: dominikmascherbauer > Cc: dominikmascherbauer > Date: Tue, 11 Mar 2025 15:57:18 +0100 > > 'set dwarf-type-signature-fallback (off|main|full)': > Enable type signature fallback. > If a type signature is not found in the current objfile, either looks up the 'main' objfile or all objfiles in a progspace to find the type signature. > Usually a type signature is unique, ther should only be one type unit for each type signature. > Therefore, it should be okay to check other objfile for a type signature. > However, whether this is really the case depends on the debug info producer. > This is why its disabled by default. > > 'set dwarf-type-signature-fallback-jit': > Whether the type signature fallback is enabled for only JIT objfiles. > JIT objfiles are self-contained, but usually share most debug info with some already loaded objfile. > This is why JIT objfiles are a major use case for the type signature fallback. > This option is added to restrict the type signature fallback to match this exact use-case and provides a more granular use of the type signature fallback. > --- > gdb/NEWS | 14 +++++++++ > gdb/doc/gdb.texinfo | 26 +++++++++++++++++ > gdb/dwarf2/read.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 110 insertions(+) Thanks. > diff --git a/gdb/NEWS b/gdb/NEWS > index 2c504a9b603..53368d7463c 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -261,6 +261,20 @@ disable missing-objfile-handler LOCUS HANDLER > or can be a regular expression which is matched against the filename > of the primary executable in each program space. > > +set dwarf-type-signature-fallback (off|main|full) > + New command which enables a type signature lookup fallback, if a > + dwarf objfile from a JIT compilation does not provide its own type > + units, but relies on type units from other objfiles. The 'main' > + setting allows to limit the scope of the lookup to just the main > + symfile objfile, 'full' uses all objfiles in a progspace. > + The default value is 'off'. > + > +set dwarf-type-signature-fallback-jit on|off > + New command that is used in combination with type-signature-fallback > + and is on by default. If type signature fallback is enabled, > + this restricts the fallback to objfiles that were loaded with the > + JIT debug interface. > + > * Changed commands > > remove-symbol-file > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 04719bf65e6..901152dd15e 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -42325,6 +42325,32 @@ Symbol "argc" is a complex DWARF expression: > For more information on these expressions, see > @uref{http://www.dwarfstd.org/, the DWARF standard}. > > +@kindex set dwarf-type-signature-fallback > +@kindex show dwarf-type-signature-fallback > +@item set dwarf-type-signature-fallback @samp{full|main|off} > +@itemx show dwarf-type-signature-fallback > +Control the behavior of the type signature lookup for type units if a > +type signature is undefined within an objfile. > + > +The default is @code{off}, which means @value{GDBN} will not use other > +objfiles in the progspace to lookup missing type signatures. When > +@code{main}, @value{GDBN} will check the current main objfile for a > +missing signatured type. When @code{full}, all objfiles in the current > +progspace will be searched for the missing signatured type. > + > +@kindex set dwarf-type-signature-fallback-jit > +@kindex show dwarf-type-signature-fallback-jit > +@item set dwarf-type-signature-fallback-jit > +@itemx show dwarf-type-signature-fallback-jit > + > +Control whether @code{dwarf type-signature-fallback} is limited to > +objfiles originated from the JIT interface (@pxref{JIT Interface}) > +or all objfiles with a missing signatured type. > + > +The default is @code{on}, which limits the type signature fallback to > +only objfiles from the JIT interface. When @code{off}, the type signature > +fallback will look for missing signatured types for all objfiles. Please leave two spaces between sentences, otherwise the printed version will be typeset sub-optimally. More generally, I think both NEWS and the text for the manual doesn't tell what this means in practical terms and when it would be useful to fiddle with these options. I find myself wondering why and when would I need to help GDB look up type signature, and even what is a "type signature" (it is used in the manual only once, without any explanations). I think at least the manual should answer these questions. > + add_setshow_enum_cmd ("dwarf-type-signature-fallback", class_support, > + type_signature_fallback_enums, &type_signature_fallback, > + _ ("\ > +Set resolution of type signatures with other objfiles as fallback."), _ ("\ > +Show resolution of type signatures with other objfiles as fallback."), _ ("\ > +This option will only take effect if set before loading symbols.\n\ > +off == turn type signature fallback off\n\ > +main == use the main symbolfile as fallback objfile\n\ > + for type signature resolution\n\ > +full == use all objfiles with type units in the current progspace\n\ > + as fallback objfiles for type signature resolution."), The list of possible values should probably start with "main" or "full", as otherwise the reference to "fallback" in "off" will not be understood. Also note that you use "resolution" in the above doc strings, but "look up" in the manual and NEWS. I think it's better to use the same terminology; "look up" sounds more accurate to me. Reviewed-By: Eli Zaretskii