From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id o2L3OcEdbGhhFC4AWB0awg (envelope-from ) for ; Mon, 07 Jul 2025 15:19:29 -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=OFCK4i0J; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D91B41E11C; Mon, 7 Jul 2025 15:19:29 -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.8 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,RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE 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 3A54A1E0C2 for ; Mon, 7 Jul 2025 15:19:29 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8F92385771D for ; Mon, 7 Jul 2025 19:19:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8F92385771D 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=OFCK4i0J 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 71EEF3858D32 for ; Mon, 7 Jul 2025 19:18:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 71EEF3858D32 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 71EEF3858D32 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=1751915938; cv=none; b=tz8dxv4NqGwCiQodO06Tu/aslaFIWSO++Gg6O7dlEAUZbwlmTaGGcldeWn17fcJMAZEvmtl36E7cHfNlfn3Rf6Il5M1PyvRkCoi1CgjHlyt1PRYFHDdNxVIiGByiMbJpU8jCLHXx5K6m2atRIgBko+bC2VvVOfS5BQrWS121Cm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751915938; c=relaxed/simple; bh=Fg69O4MUi9JtkygsFV1QJcpzgAxSd+adiX9H4JowNUI=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=FMtxqD6halSBjwhQOObljSuXioETAUbOdwyk9cAHYtQGicCgJ5XB38befHmAp9NQoHz8yFGwwhQ6OyemUX7llloP4NpVJXF/t1h6x8CsfDL51RSFUuCD+wa2jh4pDquTe7zTZO0aQFQ9qldNPt+K2HWqf37wjI9BScFVmF/cF8c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71EEF3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751915938; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zlj6gfQ3kofdhQNA2VE6OguL70EX3a5MlQBiU4outXg=; b=OFCK4i0Jl/GAdpGUep09U/l1wNaWo80UGaN8fhFH8ViMpk0RVZytE/dJwWihn9zPw8Z8K+ 7nUlxlg80PwBLm1T1G/2wpvxJe5Y0W5Dp5OY4llFFkH6/5auULMzNQVl6G5Fc857R1CC2j vlwsuNiJBer6doTzokANVBscS2zlkhs= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-620-PW8PjGQlOYuyIo2hYQQk2g-1; Mon, 07 Jul 2025 15:18:56 -0400 X-MC-Unique: PW8PjGQlOYuyIo2hYQQk2g-1 X-Mimecast-MFC-AGG-ID: PW8PjGQlOYuyIo2hYQQk2g_1751915935 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6fb01bb5d9aso53342396d6.3 for ; Mon, 07 Jul 2025 12:18:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751915935; x=1752520735; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zlj6gfQ3kofdhQNA2VE6OguL70EX3a5MlQBiU4outXg=; b=NlvK82q/iju2leknbzjaMfbYVhXpQg1s68qU6YSvPbDwO3iH0jiCME0259IbBM3rTg AvlRDP62WEeQ6kIt9N94HGHp0Y1TknkK+gTK7QrEyiPbayPLH/cVM2kPCjNEDaZet2lU zi8tV9lmcXZneYFsVWEQ+L3pKhJtQHJwh43Ns3LKwAlIYvvMSWoeEuiM9B6PBAagDYT3 10p2SsFnHrlb7jIFglC7j38mBY1LW8pxktO/NmtvBeajFDKX9Bhj+fFGVRp7zt83zitS 1ktBzhS1MmfuRuwUXnCXEW+BBfMzhQ5WebbzuPzmYEz2/QivEULSkg+exGvelZQDECgZ Nk5A== X-Gm-Message-State: AOJu0Ywwa2dMw4yBV6qENFDtmRnlmEW6kWu6rfQplvsdwD2axzd3Zjhm P0unq+wHG/87ITJGmjomgBFJ/gOvmmjko6LV+2UWCY8fa+cKO8hxegICCa2u3+SXXnw8xMP5h0u 9IMVdvxjYN9EAPQseFQH+AzeApA3kYpeegBfU5qUogd4iccQ3zxZ2+yhf1sVyG6E= X-Gm-Gg: ASbGncsUoz8HYuCJt2JMPM1/5VeZ8AynZo3m0lew1WzOUl17aLyPtxLspSyeMwPAxuj bNeQtrcSHnk6PRP4UDBpv+Bboo8VxqxukwG1fAy+KXyYa5o8x7beH5J2QHawvE+8/693AMR54jU zfikQWEBUxitxWKvK6yXSU0Uwht3rtITNSkHwnsCIt+zWzRMk/lEUBWkvIlGnlBjFqmdFBJUx9s whnhfteuNc3lnYdWxNMngpxANU6oYi33z50YxXHV1DTmnO5qL9JH0DOzQ3nbUXuWUWaAv6CGSG9 RWDJvwWcTdaAnRfb4Io258VntmMNJc1kBA== X-Received: by 2002:ad4:5601:0:b0:702:d83a:7148 with SMTP id 6a1803df08f44-7047dada2acmr200176d6.23.1751915935458; Mon, 07 Jul 2025 12:18:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHz4tdBy16IqoXRoCPj85QRI/fGvPQ6iKrinattAEoSYlE7vZfEKzj7xIw/DGNSuz37YKab9Q== X-Received: by 2002:ad4:5601:0:b0:702:d83a:7148 with SMTP id 6a1803df08f44-7047dada2acmr199766d6.23.1751915934889; Mon, 07 Jul 2025 12:18:54 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:9a69::1000? ([2804:14d:8084:9a69::1000]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-702c4d6043esm62986496d6.113.2025.07.07.12.18.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Jul 2025 12:18:54 -0700 (PDT) Message-ID: <48f0d017-70b3-4697-b747-67d31a544f7b@redhat.com> Date: Mon, 7 Jul 2025 16:18:52 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/3] gdb: Make the parser recognize the [[N]] syntax for variables To: Eli Zaretskii Cc: gdb-patches@sourceware.org References: <20250619180540.2315103-1-guinevere@redhat.com> <20250619180540.2315103-3-guinevere@redhat.com> <865xgqlx2m.fsf@gnu.org> From: Guinevere Larsen In-Reply-To: <865xgqlx2m.fsf@gnu.org> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: b0tkoAJaEt_crA6YTyfur-sPQ9Kc0yY1pW_3jJPibTI_1751915935 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 6/20/25 3:57 AM, Eli Zaretskii wrote: >> From: Guinevere Larsen >> Cc: Guinevere Larsen >> Date: Thu, 19 Jun 2025 15:05:39 -0300 >> >> This commit adds a couple new rules to the YACC parser, that will allow >> GDB to recognize expressions like [[N]]::var. >> >> This new syntax re-uses the existing rules for searching for "block"s, >> because it allows, with minimal changes to the .y file as a whole, while >> also allowing [[N]]::function::symbol work. Notably, [[N]]::'file.c'::var >> does not work yet, as this code change is also involved and would pollute >> the current commit, so will be done in a separate one in the same series. >> >> To restrict the search to a desired namespace, a new function is >> introduced, lookup_symbol_in_linker_namespace. This function will only >> perform the symbol lookup in the objfiles that belong to the requested >> namespace. >> >> This commit also changes the error message when "print var" if "var" is >> only present in namespaces other than the current one. Before this commit, >> lookup_minimal_symbol would find them as "external" symbols with >> incomplete information - outputting " has incomplete >> information, cast it to it's defined type." - which could be confusing for >> the users. This commit changes the parser rule "variable: name_not_typename" >> so that, if multiple namespaces are active, we'll look for minimal symbols >> only in the current namespace. >> >> Known limitations: >> * When using [[N]]::foo::var, if that specific foo version is not on the >> stack, the error will be unable to include the linker namespace >> requested. So if a user sees "foo" in the stack this could be >> confusing, but it should be mitigated when a future patch adds the >> namespace ID to the backtrace where applicable. >> * Completion is not supported. That's because the function used to >> complete symbols expects only text in the form "file.c:symbol", so >> can't handle the double colon. This isn't unique to linker >> namespaces, though, since func::var will also not complete, it is just >> a quirk of how :: completion work at this point. >> * The expression that parses [[N]] only takes an integer. That's >> because there aren't many expressions that would make sense in there, >> and the work of accepting an arbitrary expression felt too much for >> little gain. >> --- >> gdb/NEWS | 6 + >> gdb/c-exp.y | 72 ++++++++--- >> gdb/doc/gdb.texinfo | 6 + >> gdb/minsyms.c | 124 ++++++++++++------- >> gdb/minsyms.h | 8 ++ >> gdb/parser-defs.h | 7 ++ >> gdb/symtab.c | 37 ++++++ >> gdb/symtab.h | 8 ++ >> gdb/testsuite/gdb.base/dlmopen-ns-ids-lib.c | 14 +++ >> gdb/testsuite/gdb.base/dlmopen-ns-ids-main.c | 3 + >> gdb/testsuite/gdb.base/dlmopen-ns-ids.exp | 47 +++++++ >> 11 files changed, 268 insertions(+), 64 deletions(-) > Thanks. > >> --- a/gdb/NEWS >> +++ b/gdb/NEWS >> @@ -102,6 +102,12 @@ info threads [-gid] [-stopped] [-running] [ID]... >> These new flags can be useful to get a reduced list when there is a >> large number of threads. >> >> +print >> + The print command now accepts the following syntax to print values >> + from a specific linker namespace: `[[N]]::foo'. N is the namespace >> + identifier as understood by GDB. > This part is okay. > >> --- a/gdb/doc/gdb.texinfo >> +++ b/gdb/doc/gdb.texinfo >> @@ -10565,6 +10565,12 @@ you can choose a different format by specifying @samp{/@var{f}}, where >> @var{f} is a letter specifying the format; see @ref{Output Formats,,Output >> Formats}. >> >> +Additionally, if the inferior supports linker namespaces, @value{GDBN} >> +has implemented the following syntax to allow users to resolve symbols >> +to a specific namespace: @code{[[@var{n}]]::@var{symbol}}. Here @var{n} >> +is @value{GDBN}'s namespace identifier, which may be different to the >> +inferior's identifier. > This part is also okay, but please say "different from" in the last > sentence. > > Reviewed-By: Eli Zaretskii > Thanks for the review (and sorry for the delay). I fixed this locally -- Cheers, Guinevere Larsen She/Her/Hers