From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id RH8FGwDVCGVUwxgAWB0awg (envelope-from ) for ; Mon, 18 Sep 2023 18:53:52 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Me3+prxj; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6336C1E0C3; Mon, 18 Sep 2023 18:53:52 -0400 (EDT) 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 5529E1E028 for ; Mon, 18 Sep 2023 18:53:50 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC6CB385840B for ; Mon, 18 Sep 2023 22:53:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC6CB385840B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695077629; bh=EAGNkefblatcBBSAV7Nx+F5tRzFrkkdnkmKGlZUFTJI=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Me3+prxjO3XkBJaP8ZK7jQlAk7kTXu0VW/p7SwSTCn2JlLOvFXSHdyoXkyh2FP9Tw VwkR0chqHs+R+6sODHplsjZBfvKalVMi0WG7MlrzTHKdAYX+GsZdedmoCuOzg0S3VB H0E16q1UaBnRdo1mywtsA+hL0XhUHw+I7gcClico= Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 967DE3858D32 for ; Mon, 18 Sep 2023 22:53:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 967DE3858D32 Received: from octopus (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id B30E5813EC; Mon, 18 Sep 2023 22:53:28 +0000 (UTC) Date: Mon, 18 Sep 2023 23:53:23 +0100 To: Abdul Basit Ijaz Cc: gdb-patches@sourceware.org, pedro@palves.net Subject: Re: [PATCH v3 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands Message-ID: <20230918225323.n526b3ubkkzvzsbe@octopus> References: <20230918164738.17082-1-abdul.b.ijaz@intel.com> <20230918164738.17082-3-abdul.b.ijaz@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230918164738.17082-3-abdul.b.ijaz@intel.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (lndn.lancelotsix.com [0.0.0.0]); Mon, 18 Sep 2023 22:53:28 +0000 (UTC) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi Abdul, I think some of the comments I had on the previous patch also apply to this one. > diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c > index e473be7d465..7e4658ef415 100644 > --- a/gdb/mi/mi-cmd-stack.c > +++ b/gdb/mi/mi-cmd-stack.c > @@ -559,6 +575,30 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, > } > uiout->field_stream ("value", stb); > } > + > + /* Only for C/C++/Fortran/Ada languages, in case of variables shadowing > + print shadowed field after the superblock variable and only location > + of the variables in the innerblock. */ > + if ((current_language->la_language == language_c > + || current_language->la_language == language_cplus > + || current_language->la_language == language_fortran > + || current_language->la_language == language_ada) > + && !(values == PRINT_NO_VALUES && what == locals) > + && shadowed) > + { > + std::string file_path = arg->sym->owner.symtab->filename; > + size_t slash_index = file_path.find_last_of ("\\/"); > + std::string file_name = (!file_path.empty () > + ? file_path.substr (slash_index + 1) > + : "NA"); > + uiout->field_string ("file", file_name); > + if (arg->sym->m_line > 0) > + uiout->field_unsigned ("line", arg->sym->m_line); > + else > + uiout->field_string ("line", "NA"); > + if (already_printed) > + uiout->field_string ("Shadowed", "True"); ^ I don't use MI much, but the uppercase 'S' seems odd. For consistency, I think it would be better left lowercase. WDYT? Best, Lancelot. > + } > } > > /* Print a list of the objects for the frame FI in a certain form,