* [PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case
@ 2024-10-09 8:42 Abdul Basit Ijaz
2024-10-09 8:42 ` [PATCH v7 1/2] gdb: " Abdul Basit Ijaz
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Abdul Basit Ijaz @ 2024-10-09 8:42 UTC (permalink / raw)
To: gdb-patches
Cc: pedro, philippe.waroquiers, aburgess, tankut.baris.aktemur,
christina.schimpe, lsix, eliz, abdul.b.ijaz
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
--
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: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v7 1/2] gdb: add annotation in 'info locals' command for variables shadowing case
2024-10-09 8:42 [PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case Abdul Basit Ijaz
@ 2024-10-09 8:42 ` Abdul Basit Ijaz
2024-10-09 12:50 ` Eli Zaretskii
2024-10-09 8:42 ` [PATCH v7 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands Abdul Basit Ijaz
2024-10-25 14:47 ` [PING][PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case Ijaz, Abdul B
2 siblings, 1 reply; 7+ messages in thread
From: Abdul Basit Ijaz @ 2024-10-09 8:42 UTC (permalink / raw)
To: gdb-patches
Cc: pedro, philippe.waroquiers, aburgess, tankut.baris.aktemur,
christina.schimpe, lsix, eliz, abdul.b.ijaz
From: "Ijaz, Abdul B" <abdul.b.ijaz@intel.com>
For C/C++/Fortran/Ada languages GDB prints same name variable multiple
times in case of variable shadowing and it is confusing for user to identify
which variable belongs to the current scope. So for such cases add location
info to the innermost listed variables and for super block variables add
"shadowed" annotation in the form of "<file.c:line, shadowed>".
Suppose we have
1:int x = 42;
2: {
3: int x = 99;
4: int y = 52;
5: x = 99; /* break here */
6: }
Currently:
(gdb) info locals
x = 99
x = 42
y = 52
After applying this patch, we obtain:
(gdb) info locals
x = 99 <file.c:3>
y = 52
x = 42 <file.c:1, shadowed>
The patch adds the location annotations by keeping track of inner block
and already printed variables to identify shadowing. So, GDB now prints
"<file.c:line, shadowed>" for shadowed super-block variables and
"<file.c:line>" for innermost declarations of such variables only.
The location annotations are printed for shadowed variables in case of
C/C++/Fortran/Ada languages. In Rust, it is possible to declare a
variable with the same name many times. So in this case, just the first
instance of the variable is printed. RUST language test "var_reuse.exp"
fails with rustc compiler version >= 1.73 so XFAIL is added accordingly.
Fix regex expression in gdb.opt/inline-locals.exp test according to
this change.
---
gdb/doc/gdb.texinfo | 16 ++++
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.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 +-
14 files changed, 385 insertions(+), 19 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 100755 gdb/testsuite/gdb.rust/var_reuse.exp
create mode 100755 gdb/testsuite/gdb.rust/var_reuse.rs
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 46ca62ec0c3..cd62756f4a1 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -8888,6 +8888,22 @@ The optional flag @samp{-q}, which stands for @samp{quiet}, disables
printing header information and messages explaining why no local variables
have been printed.
+@smallexample
+1: int x = 3;
+2: @{
+3: int x = 4;
+4: x = 99; // breakpt
+5: @}
+(gdb) info locals
+x = 4 <file.c:3>
+x = 3 <file.c:1, shadowed>
+@end smallexample
+
+A variable is shadowed when there's another variable by the same
+name which is declared within an inner scope (decision block,
+method, or inner class). For such cases, its location for the
+outermost scope is followed by @samp{shadowed}.
+
@item info locals [-q] [-t @var{type_regexp}] [@var{regexp}]
Like @kbd{info locals}, but only print the local variables selected
with the provided regexp(s).
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index f1aaa644042..d2c5c4f5998 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -58,6 +58,7 @@
#include "gdbsupport/gdb-safe-ctype.h"
#include "gdbsupport/rsp-low.h"
#include "inferior.h"
+#include "include/libiberty.h"
/* Chain containing all defined memory-tag subcommands. */
@@ -2333,7 +2334,8 @@ clear_dangling_display_expressions (struct objfile *objfile)
void
print_variable_and_value (const char *name, struct symbol *var,
const frame_info_ptr &frame,
- struct ui_file *stream, int indent)
+ struct ui_file *stream, int indent,
+ bool shadowed, bool printed)
{
if (!name)
@@ -2346,6 +2348,7 @@ print_variable_and_value (const char *name, struct symbol *var,
{
struct value *val;
struct value_print_options opts;
+ const char *file_name = lbasename (var->owner.symtab->filename);
/* READ_VAR_VALUE needs a block in order to deal with non-local
references (i.e. to handle nested functions). In this context, we
@@ -2355,6 +2358,14 @@ print_variable_and_value (const char *name, struct symbol *var,
get_user_print_options (&opts);
opts.deref_ref = true;
common_val_print_checked (val, stream, indent, &opts, current_language);
+
+ if (shadowed)
+ {
+ /* Print location and shadowed variable information. */
+ fprintf_styled (stream, metadata_style.style (),
+ _("\t<%s:%d%s>"), file_name,
+ var->line (), printed ? ", shadowed" : "");
+ }
}
catch (const gdb_exception_error &except)
{
diff --git a/gdb/stack.c b/gdb/stack.c
index 4a3e7e4ff00..fcb0b7331de 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -58,6 +58,7 @@
#include "cli/cli-option.h"
#include "cli/cli-style.h"
#include "gdbsupport/buildargv.h"
+#include <unordered_set>
/* The possible choices of "set print frame-arguments", and the value
of this setting. */
@@ -2214,10 +2215,16 @@ backtrace_command_completer (struct cmd_list_element *ignore,
static void
iterate_over_block_locals (const struct block *b,
- iterate_over_block_arg_local_vars_cb cb)
+ iterate_over_block_arg_local_vars_cb cb,
+ const std::unordered_set<std::string> *shadowed_vars,
+ std::unordered_set<std::string> &printed_vars)
{
for (struct symbol *sym : block_iterator_range (b))
{
+ const char *name = sym->print_name ();
+ bool already_printed = !printed_vars.insert (name).second;
+ bool shadowed = shadowed_vars->find (name) != shadowed_vars->end ();
+
switch (sym->aclass ())
{
case LOC_CONST:
@@ -2230,7 +2237,25 @@ iterate_over_block_locals (const struct block *b,
break;
if (sym->domain () == COMMON_BLOCK_DOMAIN)
break;
- cb (sym->print_name (), sym);
+ /* Only for C/C++/Fortran/Ada languages, in case of variables
+ shadowing print <file:line, shadowed> annotation after
+ the superblock variable. Iteration of block starts from inner
+ block which is printed only with location information. */
+ 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)
+ && shadowed)
+ cb (name, sym, true, already_printed);
+ /* In case of Rust language it is possible to declare variable with
+ same name multiple times and only innermost instance of variable
+ is accessible. So print only the innermost instance and there is
+ no need of printing duplicates. */
+ else if (current_language->la_language == language_rust
+ && shadowed && already_printed)
+ break;
+ else
+ cb (name, sym, false, false);
break;
default:
@@ -2247,9 +2272,31 @@ void
iterate_over_block_local_vars (const struct block *block,
iterate_over_block_arg_local_vars_cb cb)
{
+ std::unordered_set<std::string> collected_vars, shadowed_vars, printed_vars;
+ const struct block *orig_block = block;
+
+ /* Iterate over all the local variables in a block and store the list of
+ shadowed variables to later distinguish them from other variables. */
+ while (block != nullptr)
+ {
+ for (struct symbol *sym : block_iterator_range (block))
+ {
+ if (!sym->is_argument ())
+ {
+ const char *name = sym->print_name ();
+ if (!collected_vars.insert (name).second)
+ shadowed_vars.insert (name);
+ }
+ }
+ if (block->function ())
+ break;
+ block = block->superblock ();
+ }
+
+ block = orig_block;
while (block)
{
- iterate_over_block_locals (block, cb);
+ iterate_over_block_locals (block, cb, &shadowed_vars, printed_vars);
/* After handling the function's top-level block, stop. Don't
continue to its superblock, the block of per-file
symbols. */
@@ -2271,14 +2318,16 @@ struct print_variable_and_value_data
struct ui_file *stream;
int values_printed;
- void operator() (const char *print_name, struct symbol *sym);
+ void operator() (const char *print_name, struct symbol *sym, bool shadowed,
+ bool printed);
};
/* The callback for the locals and args iterators. */
void
print_variable_and_value_data::operator() (const char *print_name,
- struct symbol *sym)
+ struct symbol *sym,
+ bool shadowed, bool printed)
{
frame_info_ptr frame;
@@ -2298,7 +2347,8 @@ print_variable_and_value_data::operator() (const char *print_name,
return;
}
- print_variable_and_value (print_name, sym, frame, stream, num_tabs);
+ print_variable_and_value (print_name, sym, frame, stream, num_tabs, shadowed,
+ printed);
values_printed = 1;
}
@@ -2476,7 +2526,7 @@ iterate_over_block_arg_vars (const struct block *b,
struct symbol *sym2
= lookup_symbol_search_name (sym->search_name (),
b, SEARCH_VAR_DOMAIN).symbol;
- cb (sym->print_name (), sym2);
+ cb (sym->print_name (), sym2, false, false);
}
}
}
diff --git a/gdb/stack.h b/gdb/stack.h
index e7242c71036..37aa6844cf3 100644
--- a/gdb/stack.h
+++ b/gdb/stack.h
@@ -24,7 +24,8 @@ gdb::unique_xmalloc_ptr<char> find_frame_funname (const frame_info_ptr &frame,
enum language *funlang,
struct symbol **funcp);
-typedef gdb::function_view<void (const char *print_name, struct symbol *sym)>
+typedef gdb::function_view<void (const char *print_name, struct symbol *sym,
+ bool shadowed, bool printed)>
iterate_over_block_arg_local_vars_cb;
void iterate_over_block_arg_vars (const struct block *block,
diff --git a/gdb/testsuite/gdb.ada/var_shadowing.exp b/gdb/testsuite/gdb.ada/var_shadowing.exp
new file mode 100644
index 00000000000..9d446790254
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/var_shadowing.exp
@@ -0,0 +1,39 @@
+# Copyright 2023-2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+require allow_ada_tests
+
+standard_ada_testfile var_shadowing
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" \
+ executable [list debug]] != "" } {
+ return -1
+}
+
+clean_restart ${testfile}
+
+set i_level1 [gdb_get_line_number "I-Level1"]
+set i_level2 [gdb_get_line_number "I-Level2"]
+set i_level3 [gdb_get_line_number "I-Level3"]
+set bp_location [gdb_get_line_number "BREAK"]
+runto "var_shadowing.adb:$bp_location"
+
+gdb_test "info locals" [multi_line \
+ "i = 111\t<$testfile.adb:$i_level3>" \
+ "i = 11\t<$testfile.adb:$i_level2, shadowed>" \
+ "i = 1\t<$testfile.adb:$i_level1, shadowed>" \
+] "info locals at innermost level"
diff --git a/gdb/testsuite/gdb.ada/var_shadowing/var_shadowing.adb b/gdb/testsuite/gdb.ada/var_shadowing/var_shadowing.adb
new file mode 100644
index 00000000000..55be43b77e2
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/var_shadowing/var_shadowing.adb
@@ -0,0 +1,30 @@
+-- Copyright 2023-2024 Free Software Foundation, Inc.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure Varshadow is
+ I : Integer := 1; -- I-Level1
+begin
+ declare
+ I : Integer := 11; -- I-Level2
+ begin
+ declare
+ I : Integer := 111; -- I-Level3
+ begin
+ Put_Line ("hello"); -- BREAK
+ end;
+ end;
+end;
diff --git a/gdb/testsuite/gdb.base/var-shadowing.c b/gdb/testsuite/gdb.base/var-shadowing.c
new file mode 100755
index 00000000000..a0763419b38
--- /dev/null
+++ b/gdb/testsuite/gdb.base/var-shadowing.c
@@ -0,0 +1,49 @@
+/* Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+
+void
+shadowing (void)
+{
+ int a = 100; /* bp for entry */
+ unsigned int val1 = 1; /* val1-d1 */
+ unsigned int val2 = 2; /* val2-d1 */
+ a = 101; /* bp for locals 1 */
+ {
+ unsigned int val2 = 3; /* val2-d2 */
+ unsigned int val3 = 4; /* val3-d1 */
+ a = 102; /* bp for locals 2 */
+ {
+ unsigned int val1 = 5; /* val1-d2 */
+ a = 103; /* bp for locals 3 */
+ {
+ #include "var-shadowing2.c"
+ unsigned int val1 = 6; /* val1-d3 */
+ unsigned int val2 = 7; /* val2-d3 */
+ unsigned int val3 = 8; /* val3-d2 */
+ a = 104; /* bp for locals 4 */
+ }
+ }
+ }
+ a = 105;
+} /* bp for locals 5 */
+
+int
+main (void)
+{
+ shadowing ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/var-shadowing.exp b/gdb/testsuite/gdb.base/var-shadowing.exp
new file mode 100755
index 00000000000..68372091330
--- /dev/null
+++ b/gdb/testsuite/gdb.base/var-shadowing.exp
@@ -0,0 +1,92 @@
+# Copyright 2023-2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile
+if [prepare_for_testing "failed to prepare" $testfile $srcfile] {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+set bp_line1 [gdb_get_line_number "bp for locals 1"]
+set bp_line2 [gdb_get_line_number "bp for locals 2"]
+set bp_line3 [gdb_get_line_number "bp for locals 3"]
+set bp_line4 [gdb_get_line_number "bp for locals 4"]
+set bp_line5 [gdb_get_line_number "bp for locals 5"]
+
+set val1_d1 [gdb_get_line_number "val1-d1"]
+set val1_d2 [gdb_get_line_number "val1-d2"]
+set val1_d3 [gdb_get_line_number "val1-d3"]
+set val2_d1 [gdb_get_line_number "val2-d1"]
+set val2_d2 [gdb_get_line_number "val2-d2"]
+set val2_d3 [gdb_get_line_number "val2-d3"]
+set val3_d1 [gdb_get_line_number "val3-d1"]
+set val3_d2 [gdb_get_line_number "val3-d2"]
+set a_line [gdb_get_line_number "bp for entry"]
+
+gdb_breakpoint $srcfile:$bp_line1
+gdb_continue_to_breakpoint "continue to outermost level" \
+ ".*$srcfile:$bp_line1.*"
+gdb_test "info locals" [multi_line \
+ "val1 = 1" \
+ "val2 = 2" \
+ ] "info locals at outermost level"
+
+gdb_breakpoint $srcfile:$bp_line2
+gdb_continue_to_breakpoint "continue to first level" ".*$srcfile:$bp_line2.*"
+gdb_test "info locals" [multi_line \
+ "val2 = 3\t<$srcfile:$val2_d2>" \
+ "val3 = 4" \
+ "a = 101" \
+ "val1 = 1" \
+ "val2 = 2\t<$srcfile:$val2_d1, shadowed>" \
+ ] "info locals first level"
+
+gdb_breakpoint $srcfile:$bp_line3
+gdb_continue_to_breakpoint "continue to second level" ".*$srcfile:$bp_line3.*"
+gdb_test "info locals" [multi_line \
+ "val1 = 5\t<$srcfile:$val1_d2>" \
+ "val2 = 3\t<$srcfile:$val2_d2>" \
+ "val3 = 4" \
+ "a = 102" \
+ "val1 = 1\t<$srcfile:$val1_d1, shadowed>" \
+ "val2 = 2\t<$srcfile:$val2_d1, shadowed>" \
+ ] "info locals second level"
+
+gdb_breakpoint $srcfile:$bp_line4
+gdb_continue_to_breakpoint "continue to innermost level" ".*$srcfile:$bp_line4.*"
+gdb_test "info locals" [multi_line \
+ "a = 999\t<${testfile}2.c:16>" \
+ "val1 = 6\t<$srcfile:$val1_d3>" \
+ "val2 = 7\t<$srcfile:$val2_d3>" \
+ "val3 = 8\t<$srcfile:$val3_d2>" \
+ "val1 = 5\t<$srcfile:$val1_d2, shadowed>" \
+ "val2 = 3\t<$srcfile:$val2_d2, shadowed>" \
+ "val3 = 4\t<$srcfile:$val3_d1, shadowed>" \
+ "a = 103\t<$srcfile:$a_line, shadowed>" \
+ "val1 = 1\t<$srcfile:$val1_d1, shadowed>" \
+ "val2 = 2\t<$srcfile:$val2_d1, shadowed>" \
+ ] "info locals at innermost level"
+
+gdb_breakpoint $srcfile:$bp_line5
+gdb_continue_to_breakpoint "continue to outermost level last" \
+ ".*$srcfile:$bp_line5.*"
+gdb_test "info locals" [multi_line \
+ "a = 105" \
+ "val1 = 1" \
+ "val2 = 2" \
+ ] "info locals at outermost level last"
diff --git a/gdb/testsuite/gdb.base/var-shadowing2.c b/gdb/testsuite/gdb.base/var-shadowing2.c
new file mode 100644
index 00000000000..8223e11ec17
--- /dev/null
+++ b/gdb/testsuite/gdb.base/var-shadowing2.c
@@ -0,0 +1,16 @@
+/* Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int a = 999;
diff --git a/gdb/testsuite/gdb.opt/inline-locals.exp b/gdb/testsuite/gdb.opt/inline-locals.exp
index 358a8d29d89..e12f79fa94e 100644
--- a/gdb/testsuite/gdb.opt/inline-locals.exp
+++ b/gdb/testsuite/gdb.opt/inline-locals.exp
@@ -42,9 +42,11 @@ if { ! $no_frames } {
"backtrace from bar 2"
gdb_test "up" "#1 .*func1 .* at .*" "up from bar 2"
gdb_test "info frame" ".*inlined into frame.*" "func1 inlined 2"
- set pass_re "array = \\{0 <repeats 64 times>\\}"
+ set shadowed_pass_re "\t<$srcfile:$decimal>"
+ set shadowed_fail_re "\t<$srcfile:$decimal, shadowed>"
+ set pass_re "array = \\{0 <repeats 64 times>\\}($shadowed_pass_re)?"
set kfail_re [multi_line $pass_re \
- "array = <optimized out>"]
+ "array = <optimized out>$shadowed_fail_re"]
gdb_test_multiple "info locals" "info locals above bar 2" {
-re -wrap $pass_re {
pass $gdb_test_name
@@ -91,9 +93,9 @@ if { ! $no_frames } {
"backtrace from bar 3"
gdb_test "up" "#1 .*func1 .* at .*" "up from bar 3"
gdb_test "info frame" ".*inlined into frame.*" "func1 inlined 3"
- set pass_re "array = {$decimal, \[^\r\n\]*}"
+ set pass_re "array = {$decimal, \[^\r\n\]*}($shadowed_pass_re)?"
set kfail_re [multi_line $pass_re \
- "array = <optimized out>"]
+ "array = <optimized out>$shadowed_fail_re"]
gdb_test_multiple "info locals" "info locals above bar 3" {
-re -wrap $pass_re {
pass $gdb_test_name
@@ -133,7 +135,8 @@ proc check_scoped_locals {bp_label pass_re} {
gdb_breakpoint $srcfile:$locals_bp
gdb_continue_to_breakpoint "$bp_label" ".*$srcfile:$locals_bp.*"
- set kfail_re [multi_line $pass_re ".*<optimized out>"]
+ set kfail_re [multi_line $pass_re \
+ ".*<optimized out>(.*<$srcfile:$::decimal, shadowed>)?"]
gdb_test_multiple "info locals" "scoped info locals at $bp_label" {
-re -wrap $pass_re {
pass $gdb_test_name
@@ -149,7 +152,9 @@ proc check_scoped_locals {bp_label pass_re} {
}
if {! $no_frames } {
- check_scoped_locals "bp for locals 1" "loc2 = 20\r\nloc1 = 10"
- check_scoped_locals "bp for locals 2" "loc3 = 30\r\nloc2 = 20\r\nloc1 = 10"
- check_scoped_locals "bp for locals 3" "loc1 = 10"
+ check_scoped_locals "bp for locals 1" \
+ "loc2 = 20(\t<$srcfile:$decimal>)?\r\nloc1 = 10(\t<$srcfile:$decimal>)?"
+ check_scoped_locals "bp for locals 2" \
+ "loc3 = 30(\t<$srcfile:$decimal>)?\r\nloc2 = 20(\t<$srcfile:$decimal>)?\r\nloc1 = 10(\t<$srcfile:$decimal>)?"
+ check_scoped_locals "bp for locals 3" "loc1 = 10(\t<$srcfile:$decimal>)?"
}
diff --git a/gdb/testsuite/gdb.rust/var_reuse.exp b/gdb/testsuite/gdb.rust/var_reuse.exp
new file mode 100755
index 00000000000..1ed96830556
--- /dev/null
+++ b/gdb/testsuite/gdb.rust/var_reuse.exp
@@ -0,0 +1,34 @@
+# Copyright 2023-2024 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib rust-support.exp
+require allow_rust_tests
+require {can_compile rust}
+
+standard_testfile .rs
+if {[prepare_for_testing "failed to prepare" \
+ $testfile $srcfile {debug rust}]} {
+ return -1
+}
+
+set line [gdb_get_line_number "set breakpoint here"]
+if {![runto ${srcfile}:$line]} {
+ untested "could not run to breakpoint"
+ return -1
+}
+
+# Wrong local values are shown for rustc version >= 1.73.
+setup_xfail "*-*-*" "gdb/31079"
+gdb_test "info local _x" "_x = 12" "print local _x variable"
diff --git a/gdb/testsuite/gdb.rust/var_reuse.rs b/gdb/testsuite/gdb.rust/var_reuse.rs
new file mode 100755
index 00000000000..09f2fcd008c
--- /dev/null
+++ b/gdb/testsuite/gdb.rust/var_reuse.rs
@@ -0,0 +1,20 @@
+// Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+fn main() {
+ let _x = 5;
+ let _x = _x + 7;
+ let _y = 8; // set breakpoint here
+}
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index d11c3f8a6be..cfce3002dd9 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1046,7 +1046,8 @@ collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
int count = 0;
auto do_collect_symbol = [&] (const char *print_name,
- struct symbol *sym)
+ struct symbol *sym,
+ bool shadowed, bool printed)
{
collect_symbol (sym, gdbarch, frame_regno,
frame_offset, pc, trace_string);
diff --git a/gdb/value.h b/gdb/value.h
index 13cfb007aa2..069bcffa5cc 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1559,7 +1559,9 @@ extern void print_variable_and_value (const char *name,
struct symbol *var,
const frame_info_ptr &frame,
struct ui_file *stream,
- int indent);
+ int indent,
+ bool shadowed,
+ bool printed);
extern void typedef_print (struct type *type, struct symbol *news,
struct ui_file *stream);
--
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: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v7 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands
2024-10-09 8:42 [PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case Abdul Basit Ijaz
2024-10-09 8:42 ` [PATCH v7 1/2] gdb: " Abdul Basit Ijaz
@ 2024-10-09 8:42 ` Abdul Basit Ijaz
2024-10-09 12:51 ` Eli Zaretskii
2024-10-25 14:47 ` [PING][PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case Ijaz, Abdul B
2 siblings, 1 reply; 7+ messages in thread
From: Abdul Basit Ijaz @ 2024-10-09 8:42 UTC (permalink / raw)
To: gdb-patches
Cc: pedro, philippe.waroquiers, aburgess, tankut.baris.aktemur,
christina.schimpe, lsix, eliz, abdul.b.ijaz
From: "Ijaz, Abdul B" <abdul.b.ijaz@intel.com>
For C/C++/Fortran languages GDB prints same name variable multiple times in
case of variable shadowing and it is confusing for user to identify which
variable belongs to the current scope. So GDB now prints location information
for shadowed variables and add 'shadowed' field also in '-stack-list-locals'
and '-stack-list-variables' mi commands for super-block shadowed variable.
Suppose we have test.c file
1:int x = 42;
2: {
3: int x = 99;
4: int y = 52;
4: x = 99; /* break here */
5: }
The "-stack-list-locals" and "-stack-list-variables" mi commands at the
"break here" line gives the following output:
Before the change:
~~~
(gdb)
-stack-list-locals 0
^done,locals=[name="x",name="y",name="x"]
(gdb)
-stack-list-locals 1
^done,locals=[{name="x",value="99"},{name="y",value="52"},{name="x",value="42"}]
(gdb)
-stack-list-locals 2
^done,locals=[{name="x",type="int",value="99"},{name="y",type="int",value="52"},{name="x",type="int",value="42"}]
(gdb)
-stack-list-variables 0
^done,variables=[{name="x"},{name="y"},{name="x"}]
(gdb)
-stack-list-variables 1
^done,variables=[{name="x",value="99"},{name="y",value="52"},{name="x",value="42"}]
(gdb)
-stack-list-variables 2
^done,variables=[{name="x",type="int",value="99"},{name="y",type="int",value="52"},{name="x",type="int",value="42"}]
~~~
With this patch we obtain:
~~~
(gdb)
-stack-list-locals 0
^done,locals=[name="x",name="y",name="x"]
(gdb)
-stack-list-locals 1
^done,locals=[{name="x",value="99",file="test.c",line="4"},{name="y",value="52"},{name="x",value="42",file="test.c",line="2",shadowed="true"}]
(gdb)
-stack-list-locals 2
^done,locals=[{name="x",type="int",value="99",file="test.c",line="4"},{name="y",type="int",value="52"},{name="x",type="int",value="42",file="test.c",line="2",shadowed="true"}]
(gdb)
-stack-list-variables 0
^done,variables=[{name="x",file="test.c",line="4"},{name="y"},{name="x",file="test.c",line="2",shadowed="true"}]
(gdb)
-stack-list-variables 1
^done,variables=[{name="x",value="99",file="test.c",line="4"},{name="y",value="52"},{name="x",value="42",file="test.c",line="2",shadowed="true"}]
(gdb)
-stack-list-variables 2
^done,variables=[{name="x",type="int",value="99",file="test.c",line="4"},{name="y",type="int",value="52"},{name="x",type="int",value="42",file="test.c",line="2",shadowed="true"}]
~~~
---
gdb/doc/gdb.texinfo | 15 +++
gdb/mi/mi-cmd-stack.c | 63 +++++++++-
gdb/testsuite/gdb.mi/mi-var-shadowing.c | 48 ++++++++
gdb/testsuite/gdb.mi/mi-var-shadowing.exp | 141 ++++++++++++++++++++++
4 files changed, 263 insertions(+), 4 deletions(-)
create mode 100644 gdb/testsuite/gdb.mi/mi-var-shadowing.c
create mode 100644 gdb/testsuite/gdb.mi/mi-var-shadowing.exp
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index cd62756f4a1..401f799f4d4 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -35002,6 +35002,21 @@ If the @code{--skip-unavailable} option is specified, local variables
and arguments that are not available are not listed. Partially
available arguments and local variables are still displayed, however.
+@smallexample
+1: int x = 3;
+2: @{
+3: int x = 4;
+4: x = 99; // breakpt
+5: @}
+(gdb) -stack-list-variables 2
+^done,variables=[@{name="x",type="int",value="4",file="name.c",line="3"@},@{name="x",type="int",value="3",file="name.c",line="1",shadowed="true"@}]
+@end smallexample
+
+A variable is shadowed when there's another variable by the same
+name which is declared within an inner scope (decision block,
+method, or inner class). For such cases, its location for the
+outermost scope is followed by @samp{shadowed} attribute.
+
@subsubheading Example
@smallexample
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 5e504283fcf..0b5515cd26e 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -38,6 +38,8 @@
#include "gdbsupport/gdb-safe-ctype.h"
#include "inferior.h"
#include "observable.h"
+#include "include/libiberty.h"
+#include <unordered_set>
enum what_to_list { locals, arguments, all };
@@ -496,7 +498,9 @@ mi_cmd_stack_list_variables (const char *command, const char *const *argv,
static void
list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
enum print_values values, int skip_unavailable,
- const frame_print_options &fp_opts)
+ const frame_print_options &fp_opts,
+ const std::unordered_set<std::string> *shadowed_vars,
+ std::unordered_set<std::string> &printed_vars)
{
struct ui_out *uiout = current_uiout;
@@ -525,6 +529,19 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
tuple_emitter.emplace (uiout, nullptr);
string_file stb;
+ const char *name = arg->sym->print_name ();
+ /* To distinguish innermost variable from the rest in the shadowed_vars
+ this boolen is needed. */
+ bool already_printed = !printed_vars.insert (name).second;
+ bool shadowed = shadowed_vars->find (name) != shadowed_vars->end ();
+
+ /* In case of Rust language it is possible to declare variable with
+ same name multiple times and only latest declaration of variable
+ is accessible. So print only the first instance and there is no
+ need of printing duplicates. */
+ if (current_language->la_language == language_rust
+ && shadowed && already_printed)
+ return;
stb.puts (arg->sym->print_name ());
if (arg->entry_kind == print_entry_values_only)
@@ -566,6 +583,23 @@ 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)
+ {
+ const char *file_name = lbasename (arg->sym->owner.symtab->filename);
+ uiout->field_string ("file", file_name);
+ uiout->field_unsigned ("line", arg->sym->m_line);
+ if (already_printed)
+ uiout->field_string ("shadowed", "true");
+ }
}
/* Print a list of the objects for the frame FI in a certain form,
@@ -579,9 +613,10 @@ list_args_or_locals (const frame_print_options &fp_opts,
enum what_to_list what, enum print_values values,
const frame_info_ptr &fi, int skip_unavailable)
{
- const struct block *block;
+ const struct block *block, *orig_block;
const char *name_of_result;
struct ui_out *uiout = current_uiout;
+ std::unordered_set<std::string> collected_vars, shadowed_vars, printed_vars;
block = get_frame_block (fi, 0);
@@ -602,6 +637,26 @@ list_args_or_locals (const frame_print_options &fp_opts,
ui_out_emit_list list_emitter (uiout, name_of_result);
+ orig_block = block;
+ /* Stored list of shadowed variables later help in identifying them
+ from the rest. */
+ while (block != nullptr)
+ {
+ for (struct symbol *sym : block_iterator_range (block))
+ {
+ if (!sym->is_argument ())
+ {
+ const char *name = sym->print_name ();
+ if (!collected_vars.insert (name).second)
+ shadowed_vars.insert (name);
+ }
+ }
+ if (block->function ())
+ break;
+ block = block->superblock ();
+ }
+
+ block = orig_block;
while (block != 0)
{
for (struct symbol *sym : block_iterator_range (block))
@@ -672,10 +727,10 @@ list_args_or_locals (const frame_print_options &fp_opts,
if (arg.entry_kind != print_entry_values_only)
list_arg_or_local (&arg, what, values, skip_unavailable,
- fp_opts);
+ fp_opts, &shadowed_vars, printed_vars);
if (entryarg.entry_kind != print_entry_values_no)
list_arg_or_local (&entryarg, what, values, skip_unavailable,
- fp_opts);
+ fp_opts, &shadowed_vars, printed_vars);
}
}
diff --git a/gdb/testsuite/gdb.mi/mi-var-shadowing.c b/gdb/testsuite/gdb.mi/mi-var-shadowing.c
new file mode 100644
index 00000000000..eee6693ee2c
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-var-shadowing.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2023-2024 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdlib.h>
+
+void
+shadowing (void)
+{
+ int a = 100; /* entry bp */
+ unsigned int val1 = 1; /* val1-d1 */
+ unsigned int val2 = 2; /* val2-d1 */
+ a = 101; /* bp for locals 1 */
+ {
+ unsigned int val2 = 3; /* val2-d2 */
+ unsigned int val3 = 4; /* val3-d1 */
+ a = 102; /* bp for locals 2 */
+ {
+ unsigned int val1 = 5; /* val1-d2 */
+ a = 103; /* bp for locals 3 */
+ {
+ unsigned int val1 = 6; /* val1-d3 */
+ unsigned int val2 = 7; /* val2-d3 */
+ unsigned int val3 = 8; /* val3-d2 */
+ a = 104; /* bp for locals 4 */
+ }
+ }
+ }
+ a = 105;
+} /* bp for locals 5 */
+
+int
+main (void)
+{
+ shadowing ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.mi/mi-var-shadowing.exp b/gdb/testsuite/gdb.mi/mi-var-shadowing.exp
new file mode 100644
index 00000000000..4302f2d6cac
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-var-shadowing.exp
@@ -0,0 +1,141 @@
+# Copyright 2023-2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if [mi_gdb_start] {
+ continue
+}
+
+standard_testfile
+
+set opts {debug}
+if [build_executable ${testfile}.exp ${testfile} ${srcfile} $opts] {
+ return -1
+}
+
+mi_delete_breakpoints
+mi_gdb_reinitialize_dir $srcdir/$subdir
+mi_gdb_load ${binfile}
+mi_runto main
+
+set bp_line1 [gdb_get_line_number "bp for locals 1"]
+set bp_line2 [gdb_get_line_number "bp for locals 2"]
+set bp_line3 [gdb_get_line_number "bp for locals 3"]
+set bp_line4 [gdb_get_line_number "bp for locals 4"]
+set bp_line5 [gdb_get_line_number "bp for locals 5"]
+
+set val1_d1 [gdb_get_line_number "val1-d1"]
+set val1_d2 [gdb_get_line_number "val1-d2"]
+set val1_d3 [gdb_get_line_number "val1-d3"]
+set val2_d1 [gdb_get_line_number "val2-d1"]
+set val2_d2 [gdb_get_line_number "val2-d2"]
+set val2_d3 [gdb_get_line_number "val2-d3"]
+set val3_d1 [gdb_get_line_number "val3-d1"]
+set val3_d2 [gdb_get_line_number "val3-d2"]
+set a_line [gdb_get_line_number "entry bp"]
+
+set stack_test1_regx "\\^done,(locals|variables)=\\\[\{name=\"a\",type=\"int\",value=\"$decimal\"\},\{name=\"val1\",type=\"unsigned int\",value=\"1\"\},{name=\"val2\",type=\"unsigned int\",value=\"2\"\}\\\]"
+set stack_test2_regx "\\^done,(locals|variables)=\\\[\{name=\"val2\",type=\"unsigned int\",value=\"3\",file=\"$srcfile\",line=\"$val2_d2\"\},\{name=\"val3\",type=\"unsigned int\",value=\"4\"\},\{name=\"a\",type=\"int\",value=\"101\"\},\{name=\"val1\",type=\"unsigned int\",value=\"1\"\},\{name=\"val2\",type=\"unsigned int\",value=\"2\",file=\"$srcfile\",line=\"$val2_d1\",shadowed=\"true\"\}\\\]"
+set stack_test3_regx "\\^done,(locals|variables)=\\\[\{name=\"val1\",type=\"unsigned int\",value=\"5\",file=\"$srcfile\",line=\"$val1_d2\"\},\{name=\"val2\",type=\"unsigned int\",value=\"3\",file=\"$srcfile\",line=\"$val2_d2\"\},\{name=\"val3\",type=\"unsigned int\",value=\"4\"\},\{name=\"a\",type=\"int\",value=\"102\"\},\{name=\"val1\",type=\"unsigned int\",value=\"1\",file=\"$srcfile\",line=\"$val1_d1\",shadowed=\"true\"\},\{name=\"val2\",type=\"unsigned int\",value=\"2\",file=\"$srcfile\",line=\"$val2_d1\",shadowed=\"true\"\}\\\]"
+set stack_test4_regx "\\^done,(locals|variables)=\\\[\{name=\"val1\",type=\"unsigned int\",value=\"6\",file=\"$srcfile\",line=\"$val1_d3\"\},\{name=\"val2\",type=\"unsigned int\",value=\"7\",file=\"$srcfile\",line=\"$val2_d3\"\},\{name=\"val3\",type=\"unsigned int\",value=\"8\",file=\"$srcfile\",line=\"$val3_d2\"\},\{name=\"val1\",type=\"unsigned int\",value=\"5\",file=\"$srcfile\",line=\"$val1_d2\",shadowed=\"true\"\},\{name=\"val2\",type=\"unsigned int\",value=\"3\",file=\"$srcfile\",line=\"$val2_d2\",shadowed=\"true\"\},\{name=\"val3\",type=\"unsigned int\",value=\"4\",file=\"$srcfile\",line=\"$val3_d1\",shadowed=\"true\"\},\{name=\"a\",type=\"int\",value=\"103\"\},\{name=\"val1\",type=\"unsigned int\",value=\"1\",file=\"$srcfile\",line=\"$val1_d1\",shadowed=\"true\"\},\{name=\"val2\",type=\"unsigned int\",value=\"2\",file=\"$srcfile\",line=\"$val2_d1\",shadowed=\"true\"\}\\\]"
+set stack_test5_regx "\\^done,(locals|variables)=\\\[\{name=\"a\",type=\"int\",value=\"105\"\},\{name=\"val1\",type=\"unsigned int\",value=\"1\"\},\{name=\"val2\",type=\"unsigned int\",value=\"2\"\}\\\]"
+
+mi_gdb_test \
+ "-break-insert --source ${srcfile} --line ${bp_line1}" \
+ "\\^done.*source ${srcfile} \\-line ${bp_line1}.*" \
+ "bp at outermost level"
+mi_execute_to "exec-continue" "breakpoint-hit" ".*" ".*" ".*" "${bp_line1}" \
+ { "" "disp=\"keep\"" } "continue to outermost level"
+mi_gdb_test "-stack-list-locals 0" \
+ "\\^done,locals=\\\[name=\"a\",name=\"val1\",name=\"val2\"\\\]" \
+ "-stack-list-locals 0 at outermost level"
+mi_gdb_test "-stack-list-variables 0" \
+ "\\^done,variables=\\\[{name=\"a\"},{name=\"val1\"},{name=\"val2\"}\\\]" \
+ "-stack-list-variables 0 at outermost level"
+mi_gdb_test "-stack-list-locals 2" "${stack_test1_regx}" \
+ "-stack-list-locals 2 at outermost level"
+mi_gdb_test "-stack-list-variables 2" "${stack_test1_regx}" \
+ "-stack-list-variables 2 at outermost level"
+
+mi_gdb_test \
+ "-break-insert --source ${srcfile} --line ${bp_line2}" \
+ "\\^done.*source ${srcfile} \\-line ${bp_line2}.*" \
+ "bp at first level"
+mi_execute_to "exec-continue" "breakpoint-hit" ".*" ".*" ".*" "${bp_line2}" \
+ { "" "disp=\"keep\"" } "continue to first level"
+mi_gdb_test "-stack-list-locals 0" \
+ "\\^done,locals=\\\[name=\"val2\",name=\"val3\",name=\"a\",name=\"val1\",name=\"val2\"\\\]" \
+ "-stack-list-locals 0 at first level"
+mi_gdb_test "-stack-list-variables 0" \
+ "\\^done,variables=\\\[{name=\"val2\",file=\"$srcfile\",line=\"$val2_d2\"},{name=\"val3\"},{name=\"a\"},{name=\"val1\"},{name=\"val2\",file=\"$srcfile\",line=\"$val2_d1\",shadowed=\"true\"\}\\\]" \
+ "-stack-list-variables 0 at first level"
+mi_gdb_test "-stack-list-locals 2" "${stack_test2_regx}" \
+ "-stack-list-locals 2 at first level"
+mi_gdb_test "-stack-list-variables 2" "${stack_test2_regx}" \
+ "-stack-list-variables 2 at first level"
+
+mi_gdb_test \
+ "-break-insert --source ${srcfile} --line ${bp_line3}" \
+ "\\^done.*source ${srcfile} \\-line ${bp_line3}.*" \
+ "bp at second level"
+mi_execute_to "exec-continue" "breakpoint-hit" ".*" ".*" ".*" "${bp_line3}" \
+ { "" "disp=\"keep\"" } "continue to second level"
+mi_gdb_test "-stack-list-locals 0" \
+ "\\^done,locals=\\\[name=\"val1\",name=\"val2\",name=\"val3\",name=\"a\",name=\"val1\",name=\"val2\"\\\]" \
+ "-stack-list-locals 0 at second level"
+mi_gdb_test "-stack-list-variables 0" \
+ "\\^done,variables=\\\[{name=\"val1\",file=\"$srcfile\",line=\"$val1_d2\"},{name=\"val2\",file=\"$srcfile\",line=\"$val2_d2\"},{name=\"val3\"},{name=\"a\"},{name=\"val1\",file=\"$srcfile\",line=\"$val1_d1\",shadowed=\"true\"\},{name=\"val2\",file=\"$srcfile\",line=\"$val2_d1\",shadowed=\"true\"\}\\\]" \
+ "-stack-list-variables 0 at second level"
+mi_gdb_test "-stack-list-locals 2" "${stack_test3_regx}" \
+ "-stack-list-locals 2 at second level"
+mi_gdb_test "-stack-list-variables 2" "${stack_test3_regx}" \
+ "-stack-list-variables 2 at second level"
+
+mi_gdb_test \
+ "-break-insert --source ${srcfile} --line ${bp_line4}" \
+ "\\^done.*source ${srcfile} \\-line ${bp_line4}.*" \
+ "bp at third level"
+mi_execute_to "exec-continue" "breakpoint-hit" ".*" ".*" ".*" "${bp_line4}" \
+ { "" "disp=\"keep\"" } "continue to third level"
+mi_gdb_test "-stack-list-locals 0" \
+ "\\^done,locals=\\\[name=\"val1\",name=\"val2\",name=\"val3\",name=\"val1\",name=\"val2\",name=\"val3\",name=\"a\",name=\"val1\",name=\"val2\"\\\]" \
+ "-stack-list-locals 0 at third level"
+mi_gdb_test "-stack-list-variables 0" \
+ "\\^done,variables=\\\[{name=\"val1\",file=\"$srcfile\",line=\"$val1_d3\"},{name=\"val2\",file=\"$srcfile\",line=\"$val2_d3\"},{name=\"val3\",file=\"$srcfile\",line=\"$val3_d2\"},{name=\"val1\",file=\"$srcfile\",line=\"$val1_d2\",shadowed=\"true\"\},\{name=\"val2\",file=\"$srcfile\",line=\"$val2_d2\",shadowed=\"true\"\},\{name=\"val3\",file=\"$srcfile\",line=\"$val3_d1\",shadowed=\"true\"\},{name=\"a\"},{name=\"val1\",file=\"$srcfile\",line=\"$val1_d1\",shadowed=\"true\"\},{name=\"val2\",file=\"$srcfile\",line=\"$val2_d1\",shadowed=\"true\"\}\\\]" \
+ "-stack-list-variables 0 at third level"
+mi_gdb_test "-stack-list-locals 2" "${stack_test4_regx}" \
+ "-stack-list-locals 2 at third level"
+mi_gdb_test "-stack-list-variables 2" "${stack_test4_regx}" \
+ "-stack-list-variables 2 at third level"
+
+mi_gdb_test \
+ "-break-insert --source ${srcfile} --line ${bp_line5}" \
+ "\\^done.*source ${srcfile} \\-line ${bp_line5}.*" \
+ "bp at outermost level last"
+mi_execute_to "exec-continue" "breakpoint-hit" ".*" ".*" ".*" "${bp_line5}" \
+ { "" "disp=\"keep\"" } "continue to outermost level last"
+mi_gdb_test "-stack-list-locals 0" \
+ "\\^done,locals=\\\[name=\"a\",name=\"val1\",name=\"val2\"\\\]" \
+ "-stack-list-locals 0 at outermost level last"
+mi_gdb_test "-stack-list-variables 0" \
+ "\\^done,variables=\\\[{name=\"a\"},{name=\"val1\"},{name=\"val2\"}\\\]" \
+ "-stack-list-variables at outermost level last"
+mi_gdb_test "-stack-list-locals 2" "${stack_test5_regx}" \
+ "-stack-list-locals 2 at outermost level last"
+mi_gdb_test "-stack-list-variables 2" "${stack_test5_regx}" \
+ "-stack-list-variables 2 at outermost level last"
--
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: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v7 1/2] gdb: add annotation in 'info locals' command for variables shadowing case
2024-10-09 8:42 ` [PATCH v7 1/2] gdb: " Abdul Basit Ijaz
@ 2024-10-09 12:50 ` Eli Zaretskii
0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-10-09 12:50 UTC (permalink / raw)
To: Abdul Basit Ijaz
Cc: gdb-patches, pedro, philippe.waroquiers, aburgess,
tankut.baris.aktemur, christina.schimpe, lsix
> From: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>
> Cc: pedro@palves.net,
> philippe.waroquiers@skynet.be,
> aburgess@redhat.com,
> tankut.baris.aktemur@intel.com,
> christina.schimpe@intel.com,
> lsix@lancelotsix.com,
> eliz@gnu.org,
> abdul.b.ijaz@intel.com
> Date: Wed, 9 Oct 2024 10:42:06 +0200
>
> gdb/doc/gdb.texinfo | 16 ++++
> 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.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 +-
> 14 files changed, 385 insertions(+), 19 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 100755 gdb/testsuite/gdb.rust/var_reuse.exp
> create mode 100755 gdb/testsuite/gdb.rust/var_reuse.rs
Thanks, the gdb.texinfo part is approved.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v7 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands
2024-10-09 8:42 ` [PATCH v7 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands Abdul Basit Ijaz
@ 2024-10-09 12:51 ` Eli Zaretskii
0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-10-09 12:51 UTC (permalink / raw)
To: Abdul Basit Ijaz
Cc: gdb-patches, pedro, philippe.waroquiers, aburgess,
tankut.baris.aktemur, christina.schimpe, lsix
> From: Abdul Basit Ijaz <abdul.b.ijaz@intel.com>
> Cc: pedro@palves.net,
> philippe.waroquiers@skynet.be,
> aburgess@redhat.com,
> tankut.baris.aktemur@intel.com,
> christina.schimpe@intel.com,
> lsix@lancelotsix.com,
> eliz@gnu.org,
> abdul.b.ijaz@intel.com
> Date: Wed, 9 Oct 2024 10:42:07 +0200
>
> gdb/doc/gdb.texinfo | 15 +++
> gdb/mi/mi-cmd-stack.c | 63 +++++++++-
> gdb/testsuite/gdb.mi/mi-var-shadowing.c | 48 ++++++++
> gdb/testsuite/gdb.mi/mi-var-shadowing.exp | 141 ++++++++++++++++++++++
> 4 files changed, 263 insertions(+), 4 deletions(-)
> create mode 100644 gdb/testsuite/gdb.mi/mi-var-shadowing.c
> create mode 100644 gdb/testsuite/gdb.mi/mi-var-shadowing.exp
The gdb.texinfo part is approved, thanks.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PING][PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case
2024-10-09 8:42 [PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case Abdul Basit Ijaz
2024-10-09 8:42 ` [PATCH v7 1/2] gdb: " Abdul Basit Ijaz
2024-10-09 8:42 ` [PATCH v7 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands Abdul Basit Ijaz
@ 2024-10-25 14:47 ` Ijaz, Abdul B
2024-11-22 13:11 ` [PING 2][PATCH " Ijaz, Abdul B
2 siblings, 1 reply; 7+ messages in thread
From: Ijaz, Abdul B @ 2024-10-25 14:47 UTC (permalink / raw)
To: gdb-patches
Cc: pedro, philippe.waroquiers, aburgess, Aktemur, Tankut Baris,
Schimpe, Christina, lsix, eliz, Ijaz, Abdul B
Hi All,
Kindly pinging. So far already got the approval for the documentation part in both patches.
Thanks & Best Regards
Abdul Basit
-----Original Message-----
From: Ijaz, Abdul B <abdul.b.ijaz@intel.com>
Sent: Wednesday, October 9, 2024 10:42 AM
To: gdb-patches@sourceware.org
Cc: pedro@palves.net; philippe.waroquiers@skynet.be; aburgess@redhat.com; Aktemur, Tankut Baris <tankut.baris.aktemur@intel.com>; Schimpe, Christina <christina.schimpe@intel.com>; lsix@lancelotsix.com; eliz@gnu.org; Ijaz, Abdul B <abdul.b.ijaz@intel.com>
Subject: [PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case
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
--
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: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PING 2][PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case
2024-10-25 14:47 ` [PING][PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case Ijaz, Abdul B
@ 2024-11-22 13:11 ` Ijaz, Abdul B
0 siblings, 0 replies; 7+ messages in thread
From: Ijaz, Abdul B @ 2024-11-22 13:11 UTC (permalink / raw)
To: gdb-patches
Cc: pedro, philippe.waroquiers, aburgess, Aktemur, Tankut Baris,
Schimpe, Christina, lsix, eliz, Ijaz, Abdul B
Ping!
Best Regards
Abdul Basit
-----Original Message-----
From: Ijaz, Abdul B
Sent: Friday, October 25, 2024 4:47 PM
To: gdb-patches@sourceware.org
Cc: pedro@palves.net; philippe.waroquiers@skynet.be; aburgess@redhat.com; Aktemur, Tankut Baris <Tankut.Baris.Aktemur@intel.com>; Schimpe, Christina <christina.schimpe@intel.com>; lsix@lancelotsix.com; eliz@gnu.org; Ijaz, Abdul B <abdul.b.ijaz@intel.com>
Subject: [PING][PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case
Hi All,
Kindly pinging. So far already got the approval for the documentation part in both patches.
Thanks & Best Regards
Abdul Basit
-----Original Message-----
From: Ijaz, Abdul B <abdul.b.ijaz@intel.com>
Sent: Wednesday, October 9, 2024 10:42 AM
To: gdb-patches@sourceware.org
Cc: pedro@palves.net; philippe.waroquiers@skynet.be; aburgess@redhat.com; Aktemur, Tankut Baris <tankut.baris.aktemur@intel.com>; Schimpe, Christina <christina.schimpe@intel.com>; lsix@lancelotsix.com; eliz@gnu.org; Ijaz, Abdul B <abdul.b.ijaz@intel.com>
Subject: [PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case
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
--
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: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-22 13:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-09 8:42 [PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case Abdul Basit Ijaz
2024-10-09 8:42 ` [PATCH v7 1/2] gdb: " Abdul Basit Ijaz
2024-10-09 12:50 ` Eli Zaretskii
2024-10-09 8:42 ` [PATCH v7 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands Abdul Basit Ijaz
2024-10-09 12:51 ` Eli Zaretskii
2024-10-25 14:47 ` [PING][PATCH v7 0/2] add annotation in 'info locals' command for variables shadowing case Ijaz, Abdul B
2024-11-22 13:11 ` [PING 2][PATCH " Ijaz, Abdul B
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).