From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by sourceware.org (Postfix) with ESMTPS id E883B3858D20 for ; Tue, 19 Sep 2023 16:47:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E883B3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695142038; x=1726678038; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NmOGCT0wB6IbhpDOfGJXMuli9v7LOoSlzs4AbLGlU5M=; b=ZRcwtk3+CEWwBgGK8WFe5wUxcqOMtSQLFr6SJw7N5yfPmGyJZnwcw7Rn vIlF1ElDGl+djvJuj46O+HYlgK/RDFxjc+bKpdnFxU6KaXfC6kuYCIZnC msPoBxwqVAMwellgn7q/OCB36KAc9U6H50mStMIKgU4FQLiWCrfDuK/nf JIxax/Ktrq4BXb3HaJ6dAMIYjQjQieTDSGSbPzXr6L0zsqOXXx+ZrhjX1 6OS6Cz2GpkeJtHeWa5Yh+e5JnHlPp3a8qAD0YzDdz+ghl8lJtdLgtcvfK vdHj1VC++H9QyJybiieLivdbHTp9WZcSgX1wBmQ6dc7fxaxgbm4Uhe4Y1 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="382750823" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="382750823" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 09:47:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="1077056850" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="1077056850" Received: from abijaz-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.38.6]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 09:47:13 -0700 From: Abdul Basit Ijaz To: gdb-patches@sourceware.org Cc: pedro@palves.net, philippe.waroquiers@skynet.be, aburgess@redhat.com, tankut.baris.aktemur@intel.com, christina.schimpe@intel.com, lsix@lancelotsix.com, "Ijaz, Abdul B" Subject: [PATCH v4 0/2] add annotation in 'info locals' command for variables shadowing case Date: Tue, 19 Sep 2023 18:46:58 +0200 Message-Id: <20230919164700.19891-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.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 List-Id: From: "Ijaz, Abdul B" 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. V3 series: https://sourceware.org/pipermail/gdb-patches/2023-September/202574.html V2 series: https://sourceware.org/pipermail/gdb-patches/2021-December/184675.html Feedback for V2 series: 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 V3: * Improve the handling of "unordered_set" objects for both Patches 1 & 2 as per feedback from Lancelot. * Improve file path handling to get file name using function "lbasename" from libiberty.h as per feedback from Lancelot. * Regression was reported in V3 series for test "gdb.python/py-framefilter-mi.exp" which is fixed in V4. It was failing because function argument was reused in the function body and -stack-list-locals was printing location information for the reused variable. Now shadowing is not considering function arguments in "info locals/-stack-list/variables or locals" commands. So in cases similar to this test where a variable is reused in function then only printing location for this reused variable does not add value to it as the function argument is not printed with "shadowed" string for argument otherwise if it is needed then please give the feedback so instead I will update the test accordingly. * Also following prgression was reported in regression report email for V3 series. Passing 3/3 times in V4 series locally. Running gdb:gdb.base/startup-with-shell.exp ... FAIL: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension:first argument expanded GDB Testsuite is executed on Ubuntu22.04 OS using gcc64 and do not see any regression for it. 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 | 66 +++++++- gdb/printcmd.c | 11 +- gdb/stack.c | 64 +++++++- 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, 626 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 -- 2.34.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928