Message ID | 20230918164738.17082-1-abdul.b.ijaz@intel.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 024BF3858017 for <patchwork@sourceware.org>; Mon, 18 Sep 2023 16:48:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 024BF3858017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695055710; bh=yUTxU483lQsA4MR3iEZ+cgWC8/TQ6U6JF2SfklTVYtw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=OtxOggQhNvsaIXVX1ln/zAiQQYJ1JlDe4Vz6tW/ReOyE9/P8g+lVSXRGhP4FKB53J XZhqXVqYEVOu6fTpCUItZf/HaYq9+iOGIFMBJe9X1aNOXflijDCLa/gwh313udmVTX UfKWtzcVjvTMXuRziSPtdmVrhRjQxnlGpc+hBn2E= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by sourceware.org (Postfix) with ESMTPS id A00EC3858D32 for <gdb-patches@sourceware.org>; Mon, 18 Sep 2023 16:48:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A00EC3858D32 X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="378621084" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="378621084" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 09:48:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="861136994" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="861136994" Received: from abijaz-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.37.223]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 09:47:59 -0700 To: gdb-patches@sourceware.org Subject: [PATCH v3 0/2] add annotation in 'info locals' command for variables shadowing case Date: Mon, 18 Sep 2023 18:47:36 +0200 Message-Id: <20230918164738.17082-1-abdul.b.ijaz@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_NONE, 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Abdul Basit Ijaz via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Abdul Basit Ijaz <abdul.b.ijaz@intel.com> Cc: abdul.b.ijaz@intel.com, pedro@palves.net Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
add annotation in 'info locals' command for variables shadowing case
|
|
Message
Ijaz, Abdul B
Sept. 18, 2023, 4:47 p.m. UTC
From: "Ijaz, Abdul B" <abdul.b.ijaz@intel.com>
Hi All,
For the variable shadowing case, these V3 patches add the annotation "shadowed" and location information to the shadowed variables so that it is easier for the end user to identify which variable was shadowed.
V2 of this series can be found at:
https://sourceware.org/pipermail/gdb-patches/2021-December/184675.html
Latest feedback for the changes:
https://sourceware.org/pipermail/gdb-patches/2022-January/184822.html
https://sourceware.org/pipermail/gdb-patches/2022-January/184819.html
V1 series:
https://sourceware.org/pipermail/gdb-patches/2021-July/181174.html
Patch#1 updates "info locals" command and Path #2 is for the mi commands
'-stack-list-locals' and '-stack-list-variables'.
Changes since V2:
* Update the way shadowed annotation as per the feedback and also now print the location info as well for such variables.
* Add variable shadowing test for Ada language.
* Rebase patches to current master.
Please verify if "info locals" command output for shadowed variables looks fine now. Location information is added only to the shadowed variables and not by default. This change now prints "shadowed" only to the outermost scope variables and for the innermost variable, only the location is printed.
GDB Testsuite is executed on Ubuntu22.04 OS using gcc64/gcc32/gdbserver-native/native-extended-gdbserver and there is no regression seen with this change.
Also, to validate file_path handling on Windows command line, manually tested var_shadowing.c test just to confirm if file name extraction works fine on Windows for "info locals" command, which has also shown file name as expected.
Thanks & Best Regards,
Abdul Basit
Ijaz, Abdul B (2):
gdb: add annotation in 'info locals' command for variables shadowing
case
gdb: add shadowed field in '-stack-list-locals/variables' mi commands
gdb/doc/gdb.texinfo | 26 ++++
gdb/mi/mi-cmd-stack.c | 73 ++++++++-
gdb/printcmd.c | 14 +-
gdb/stack.c | 67 ++++++++-
gdb/stack.h | 3 +-
gdb/testsuite/gdb.ada/var_shadowing.exp | 38 +++++
.../gdb.ada/var_shadowing/var_shadowing.adb | 30 ++++
gdb/testsuite/gdb.base/var-shadowing.c | 49 ++++++
gdb/testsuite/gdb.base/var-shadowing.exp | 90 +++++++++++
gdb/testsuite/gdb.base/var-shadowing2.c | 16 ++
gdb/testsuite/gdb.mi/mi-var-shadowing.c | 48 ++++++
gdb/testsuite/gdb.mi/mi-var-shadowing.exp | 141 ++++++++++++++++++
gdb/testsuite/gdb.rust/var_reuse.exp | 32 ++++
gdb/testsuite/gdb.rust/var_reuse.rs | 20 +++
gdb/tracepoint.c | 3 +-
gdb/value.h | 4 +-
16 files changed, 639 insertions(+), 15 deletions(-)
create mode 100644 gdb/testsuite/gdb.ada/var_shadowing.exp
create mode 100644 gdb/testsuite/gdb.ada/var_shadowing/var_shadowing.adb
create mode 100755 gdb/testsuite/gdb.base/var-shadowing.c
create mode 100755 gdb/testsuite/gdb.base/var-shadowing.exp
create mode 100644 gdb/testsuite/gdb.base/var-shadowing2.c
create mode 100644 gdb/testsuite/gdb.mi/mi-var-shadowing.c
create mode 100644 gdb/testsuite/gdb.mi/mi-var-shadowing.exp
create mode 100755 gdb/testsuite/gdb.rust/var_reuse.exp
create mode 100755 gdb/testsuite/gdb.rust/var_reuse.rs