public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>
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, abdul.b.ijaz@intel.com
Subject: [PATCH v3 0/2] add annotation in 'info locals' command for variables shadowing case
Date: Mon, 18 Sep 2023 18:47:36 +0200	[thread overview]
Message-ID: <20230918164738.17082-1-abdul.b.ijaz@intel.com> (raw)

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

-- 
2.34.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://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


             reply	other threads:[~2023-09-18 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 16:47 Abdul Basit Ijaz [this message]
2023-09-18 16:47 ` [PATCH v3 1/2] gdb: " Abdul Basit Ijaz
2023-09-18 22:46   ` Lancelot SIX
2023-09-19  7:50     ` Ijaz, Abdul B
2023-09-18 16:47 ` [PATCH v3 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands Abdul Basit Ijaz
2023-09-18 22:53   ` Lancelot SIX
2023-09-19 11:41     ` Ijaz, Abdul B
2023-09-19 13:20       ` Lancelot SIX
2023-09-19 15:46         ` Ijaz, Abdul B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230918164738.17082-1-abdul.b.ijaz@intel.com \
    --to=abdul.b.ijaz@intel.com \
    --cc=aburgess@redhat.com \
    --cc=christina.schimpe@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    --cc=philippe.waroquiers@skynet.be \
    --cc=tankut.baris.aktemur@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).