From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oB5iEfbx82fuXioAWB0awg (envelope-from ) for ; Mon, 07 Apr 2025 11:40:38 -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=kmFhFT36; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 381301E0C3; Mon, 7 Apr 2025 11:40:38 -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,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 210731E05C for ; Mon, 7 Apr 2025 11:40:36 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B67C13845873 for ; Mon, 7 Apr 2025 15:40:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B67C13845873 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=kmFhFT36 Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id B86B73845860 for ; Mon, 7 Apr 2025 15:40:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B86B73845860 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 B86B73845860 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=1744040402; cv=none; b=vcMkaAkNZ0VYmyk7if4JyQzeR1IgiwBtCwU0Dgh5RRJs8I0ttNf77RSCk+kJic+tbMawRNHBR4nhhqylVoU0NleW5cIEJSKLtUpux8gQoi0PQ2UH7x1nfOsnLneajAIRA7uGe2ZShNDB6J7yzW38YM6AsReogLEO+wu/KkzIvCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744040402; c=relaxed/simple; bh=53MfiQF2YNv3YHIY6HbTIGbVxJcSGTwnj9caAQjJXts=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=YbtjP8vNDC89oJRJfpIqKfd3sVGnFKlfKCfqoFSbvNvaDma4QZcusFbrHA/1XtEbz9UhIFjlCSEmwOEq6eAj9NuQrYI7zGe2/qeZsBWGZLxsqitCTv96Rze+lMfdYAukSg6a3hCkLVRKLdPw0kgOREDnGD2Z8p5+IPbrrgKgAfc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B86B73845860 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 1u1oZs-00023z-Ow; Mon, 07 Apr 2025 11:40:00 -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=STSFiLfLzbfaRnJqMTNAUPtEHhcBsjcLFxOlcASKuTs=; b=kmFhFT36iKLP sYiYriJmLRJy664UUATRLEYNVIwGLOoE6632Zdo3YvNJKN4uU4IoyHAHx9RB4WexWA+ZnL07965dm lpH5jQO5Ke0MQQ5kdysTBg8i5AGMTYztX3MWmrijLJ2E2HyqFaqPzn35y9nYiRPl5yai+G9LEIOP8 UJpz7RmzvEmQ2xNbrJog/ihNhzxl1ZQYGLdBjRuzggd6oezkt97w3ersJknM6KdIe4/6UYpxpP6uY 6vQXS4KuVUS4Nv+aVyOEYQPDWoNyl3rncLFnmJXQgCfvakbP+1GpZMPpoJp2TSs7wg2TJcd5kvcCS ckyCoj8NJksttUMWwd4vvA==; Date: Mon, 07 Apr 2025 18:39:56 +0300 Message-Id: <86mscst1yr.fsf@gnu.org> From: Eli Zaretskii To: Guinevere Larsen Cc: gdb-patches@sourceware.org In-Reply-To: <20250407145443.1895323-2-guinevere@redhat.com> (message from Guinevere Larsen on Mon, 7 Apr 2025 11:54:41 -0300) Subject: Re: [PATCH 1/3] gdb: add convenience variables around linker namespace debugging References: <20250407145443.1895323-1-guinevere@redhat.com> <20250407145443.1895323-2-guinevere@redhat.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: Guinevere Larsen > Cc: Guinevere Larsen > Date: Mon, 7 Apr 2025 11:54:41 -0300 > > This commit adds 2 simple built-in convenience variables to help users > debug an inferior with multiple linker namespaces. The first is > $_active_namespaces, which just counts how many namespaces have SOs > loaded onto them. The second is $_current_namespace, and it tracks which > namespace does the current location in the inferior belongs to. > > This commit also introduces a test ensuring that we track namespaces > correctly, and that a user can use the $_current_namespace variable to > set a conditional breakpoint, while linespec changes aren't finalized to > make it more convenient. > --- > gdb/NEWS | 5 ++ > gdb/doc/gdb.texinfo | 12 +++++ > gdb/solib-svr4.c | 6 +++ > gdb/solib.c | 42 +++++++++++++++ > gdb/testsuite/gdb.base/default.exp | 2 + > gdb/testsuite/gdb.base/dlmopen-ns-ids-main.c | 6 +++ > gdb/testsuite/gdb.base/dlmopen-ns-ids.exp | 55 ++++++++++++++++++++ > 7 files changed, 128 insertions(+) Thanks. > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -40,6 +40,11 @@ > namespace into which the library was loaded, if more than one namespace > is active. > > +* New built-in convenience variables $_active_namespaces and > + $_current_namespace. These show the number of active linkage namespaces, > + and which one the current location belongs to. In systems that don't ^^ Two spaces there, please. Also, I find the following minor rewording easier to grasp: These show the number of active linkage namespaces, and the namespace to which the current location belongs. > +@item $_active_namespaces > +@vindex $_active_namespaces@r{, convenience variable} Please always put the indexing commands _before_ the @item which they index, so that the corresponding command in the Info reader moves the cursor to the @item and not after it. > +@item $_current_namespace > +@vindex $_current_namespace@r{, convenience variable} Likewise. > +Which namespace contains the current location in the inferior. "The namespace which contains the current location in the inferior." > This returns > +GDB's internal identifier for namespaces, which is @samp{[[]]} with an > +integer in the middle. It is better to show than to describe: This returns @value{GDBN}'s internal identifier for namespaces, which is @samp{[[@var{n}]]}, where @var{n} is a zero-based namespace number. Reviewed-By: Eli Zaretskii