[v7,0/2] add annotation in 'info locals' command for variables shadowing case

Message ID 20241009084207.1286-1-abdul.b.ijaz@intel.com
Headers
Series add annotation in 'info locals' command for variables shadowing case |

Message

Abdul Basit Ijaz Oct. 9, 2024, 8:42 a.m. UTC
  From: "Ijaz, Abdul B" <abdul.b.ijaz@intel.com>

Hi All,

For the variable shadowing case, these 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.

Patch#1 updates "info locals" command and Path #2 is for the mi commands
'-stack-list-locals' and '-stack-list-variables'.

Last V6 Series:
https://sourceware.org/pipermail/gdb-patches/2023-December/205513.html

Documentation in V6 Series was already approved by Eli:
https://sourceware.org/pipermail/gdb-patches/2023-November/204421.html
https://sourceware.org/pipermail/gdb-patches/2023-November/204422.html

Patch#1 V6 was Reviewed-by Larsen:
https://sourceware.org/pipermail/gdb-patches/2024-January/205923.html
Patch#2 V2 was Tested-by Larsen:
https://sourceware.org/pipermail/gdb-patches/2024-January/205922.html

Changes since V6:
* This V7 series fixes the following feedback from Baris on V6:
  https://sourceware.org/pipermail/gdb-patches/2024-September/211862.html
  https://sourceware.org/pipermail/gdb-patches/2024-September/211864.html
* @Eli - Since the last approval in documentation Patch V6 only an example
  is updated in both patches as per the latest feedback.
* Update regex for the gdb.opt/inline-locals.exp test.  Because for the
  KFAIL scenario which trigger only on SLES15, shadowed variables are
  handled and also mentioned in the commit message of patch#1.

Testing is done for unix/m32/native-gdbserver configurations and no
issue is seen.

Thanks & Best Rergards
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                           |  31 ++++
 gdb/mi/mi-cmd-stack.c                         |  63 +++++++-
 gdb/printcmd.c                                |  13 +-
 gdb/stack.c                                   |  64 +++++++-
 gdb/stack.h                                   |   3 +-
 gdb/testsuite/gdb.ada/var_shadowing.exp       |  39 +++++
 .../gdb.ada/var_shadowing/var_shadowing.adb   |  30 ++++
 gdb/testsuite/gdb.base/var-shadowing.c        |  49 ++++++
 gdb/testsuite/gdb.base/var-shadowing.exp      |  92 ++++++++++++
 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.opt/inline-locals.exp       |  21 ++-
 gdb/testsuite/gdb.rust/var_reuse.exp          |  34 +++++
 gdb/testsuite/gdb.rust/var_reuse.rs           |  20 +++
 gdb/tracepoint.c                              |   3 +-
 gdb/value.h                                   |   4 +-
 17 files changed, 648 insertions(+), 23 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