From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lancelotsix.com; s=2021; t=1695077608; bh=mAxdkmsoweI1Vesne/qytwyqR6FVcyGum+L037CYcTY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q3sWip4CZx4a3VPd48RdRSfkegpuwuDNDMqSKzkIeC9VqC4Cp0nyohsBFD43oAR9g T11hT2+o0/VyysZ5MFwuxr9Wd44MIet8zIkofS3djmi23VmSomajjZnV7KEfuvdkG0 52NXovYZd/1yRqk2fLlq5k9MUqHXC999mNEehmIlul4gnCK+BCsJATH8AOdZGPnIpg gPwGL41UPRUXa+MjSj5EpmhptFGVA3HwY+H3oxWJxBC5mJ8F6zHUc6UUvfMtHRWhcl 5REBS/rbEvIJuyZIBx02QhMHFsc6V5OD1jjpDYBjQuXngZsdrE7Z4KZi6bByVcVZxy JVnaTWUu22ygQ== Date: Mon, 18 Sep 2023 23:53:23 +0100 From: Lancelot SIX 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 List-Id: 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,