From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2VQOJBWQKWmjDj4AWB0awg (envelope-from ) for ; Fri, 28 Nov 2025 07:05:41 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Qv59rE5d; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8E4E31E0B6; Fri, 28 Nov 2025 07:05:41 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 191061E08D for ; Fri, 28 Nov 2025 07:05:40 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B328B3858415 for ; Fri, 28 Nov 2025 12:05:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B328B3858415 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Qv59rE5d Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by sourceware.org (Postfix) with ESMTPS id 55CFB3858C24 for ; Fri, 28 Nov 2025 12:04:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55CFB3858C24 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 55CFB3858C24 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764331443; cv=none; b=pmXXqUlCRlmhdxSRt+HqbOcb0cf8794eMIqtOcEyKW8m4/ui744A3kDMSMjzDXgVHkD3dPFBh6DLcrt0XEGWsA7PXSsjg8e5iIhGqUsqTiIcGsLKvOldDM7de4v1Jp16sYUitUz/RYjOEu8pJ0xnXPy1XKfR8l8NM+b3T7BX5aQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764331443; c=relaxed/simple; bh=lY0NXbyVKH+BLKIkXr2lF9Hf5sea3oqvCsLD70Ca1p4=; h=DKIM-Signature:MIME-Version:From:To:Subject:Date:Message-ID: MIME-Version; b=v79x7BFarqpj+8Ayv1z4mnZUtLdvJJUnmKvN3NwNE7CVn6UR4Vl0vbAuvZHtfGfI4uSj5vNpWEMO7DCOEJSYJzrzMvGb5xff1o+c33XC31+n7IMTc9DvmL2aZFGr63mXH0czK5O9765/KnSVXBobp7GGYXFhqlHExfCXRqV2jMM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55CFB3858C24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1764331443; x=1795867443; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=lY0NXbyVKH+BLKIkXr2lF9Hf5sea3oqvCsLD70Ca1p4=; b=Qv59rE5dPAdoRsnHWbGv86rSn6vRLuGe7Iw+TVsBv7bDH7yrL95RLAJi NCg3nsMli+gXioDMiG413/LyqDmZV5EJ87YuUqc0gncflotyHwjnRqGOv L+foP/E3WS7WI6crUwr4WBmmdaraZgRPiZ5l1jW1eeWXeDEvyU8fahOxJ aWTtEPt5clke183W7jA5ytsWDDiLtr1hSLi8cNK/otCesYLUPgFx4vHXq ZKTR8mM4vQsgKlvfg65s4+ye3l54FY+nNBMWNg8UEx8vq9156ooX44yXn TKNuxJpmexrCjfbCYpkb5l3aq2w8R2x7V/uBpYlwcAzM7jwJHnnQTmabk A==; X-CSE-ConnectionGUID: Y2FqyWmkQFaby9JQcHljeQ== X-CSE-MsgGUID: JTduamL+Ti2tuvpwbBGjlg== X-IronPort-AV: E=McAfee;i="6800,10657,11626"; a="53930721" X-IronPort-AV: E=Sophos;i="6.20,232,1758610800"; d="scan'208";a="53930721" Content-Type: multipart/mixed; boundary="===============0884536232531138391==" MIME-Version: 1.0 Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2025 04:04:02 -0800 X-CSE-ConnectionGUID: JEyZo3XOQcmwv8cFtTMFng== X-CSE-MsgGUID: 1KzwMW89QW2WKm+KwoT38g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,232,1758610800"; d="scan'208";a="193885833" Received: from abijaz-mobl2.ger.corp.intel.com (HELO localhost) ([10.245.82.59]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2025 04:03:59 -0800 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, eliz@gnu.org, abdul.b.ijaz@intel.com, tom@tromey.com Subject: [PATCH v11 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands Date: Fri, 28 Nov 2025 13:03:17 +0100 Message-ID: <20251128120317.12208-3-abdul.b.ijaz@intel.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251128120317.12208-1-abdul.b.ijaz@intel.com> References: <20251128120317.12208-1-abdul.b.ijaz@intel.com> MIME-Version: 1.0 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org --===============0884536232531138391== Content-Transfer-Encoding: quoted-printable From: "Ijaz, Abdul B" 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 informat= ion 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 =3D 42; 2: { 3: int x =3D 99; 4: int y =3D 52; 4: x =3D 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=3D[name=3D"x",name=3D"y",name=3D"x"] (gdb) -stack-list-locals 1 ^done,locals=3D[{name=3D"x",value=3D"99"},{name=3D"y",value=3D"52"},{name= =3D"x",value=3D"42"}] (gdb) -stack-list-locals 2 ^done,locals=3D[{name=3D"x",type=3D"int",value=3D"99"},{name=3D"y",type=3D"= int",value=3D"52"},{name=3D"x",type=3D"int",value=3D"42"}] (gdb) -stack-list-variables 0 ^done,variables=3D[{name=3D"x"},{name=3D"y"},{name=3D"x"}] (gdb) -stack-list-variables 1 ^done,variables=3D[{name=3D"x",value=3D"99"},{name=3D"y",value=3D"52"},{nam= e=3D"x",value=3D"42"}] (gdb) -stack-list-variables 2 ^done,variables=3D[{name=3D"x",type=3D"int",value=3D"99"},{name=3D"y",type= =3D"int",value=3D"52"},{name=3D"x",type=3D"int",value=3D"42"}] ~~~ With this patch we obtain: ~~~ (gdb) -stack-list-locals 0 ^done,locals=3D[name=3D"x",name=3D"y",name=3D"x"] (gdb) -stack-list-locals 1 ^done,locals=3D[{name=3D"x",value=3D"99",file=3D"/home/src/test.c",line=3D"= 4"},{name=3D"y",value=3D"52"},{name=3D"x",value=3D"42",file=3D"/home/src/te= st.c",line=3D"2",shadowed=3D"true"}] (gdb) -stack-list-locals 2 ^done,locals=3D[{name=3D"x",type=3D"int",value=3D"99",file=3D"/home/src/tes= t.c",line=3D"4"},{name=3D"y",type=3D"int",value=3D"52"},{name=3D"x",type=3D= "int",value=3D"42",file=3D"/home/src/test.c",line=3D"2",shadowed=3D"true"}] (gdb) -stack-list-variables 0 ^done,variables=3D[{name=3D"x",file=3D"/home/src/test.c",line=3D"4"},{name= =3D"y"},{name=3D"x",file=3D"/home/src/test.c",line=3D"2",shadowed=3D"true"}] (gdb) -stack-list-variables 1 ^done,variables=3D[{name=3D"x",value=3D"99",file=3D"/home/src/test.c",line= =3D"4"},{name=3D"y",value=3D"52"},{name=3D"x",value=3D"42",file=3D"/home/sr= c/test.c",line=3D"2",shadowed=3D"true"}] (gdb) -stack-list-variables 2 ^done,variables=3D[{name=3D"x",type=3D"int",value=3D"99",file=3D"/home/src/= test.c",line=3D"4"},{name=3D"y",type=3D"int",value=3D"52"},{name=3D"x",type= =3D"int",value=3D"42",file=3D"/home/src/test.c",line=3D"2",shadowed=3D"true= "}] ~~~ --- gdb/NEWS | 4 + gdb/doc/gdb.texinfo | 18 +++ gdb/mi/mi-cmd-stack.c | 129 ++++++++++++++------ gdb/testsuite/gdb.mi/mi-var-shadowing.c | 48 ++++++++ gdb/testsuite/gdb.mi/mi-var-shadowing.exp | 141 ++++++++++++++++++++++ 5 files changed, 305 insertions(+), 35 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/NEWS b/gdb/NEWS index 616899147c3..034b530a7bf 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -371,6 +371,10 @@ vFile:stat multiple times, and the same mapping was being reused. In all other cases, this field will have the value 'false'. =20 +** GDB now shows "shadowed", "file" and "line" fields in the output + of '-stack-list-locals/variables' mi commands for variables + shadowing case. + * Support for stabs debugging format and the a.out/dbx object format is deprecated, and will be removed in GDB 18. =20 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9ea4a2705bf..f761e85ee28 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -35417,6 +35417,24 @@ If the @code{--skip-unavailable} option is specifi= ed, local variables and arguments that are not available are not listed. Partially available arguments and local variables are still displayed, however. =20 +@smallexample +1: int x =3D 3; +2: @{ +3: int x =3D 4; +4: int y =3D 5; +4: x =3D 99; // breakpoint-line +5: @} +(gdb) -stack-list-variables 2 +^done,variables=3D[@{name=3D"x",type=3D"int",value=3D"4",file=3D"/home/src= /name.c",line=3D"3"@},@{name=3D"y",type=3D"int",value=3D"5",file=3D"/home/s= rc/name.c",line=3D"4"@},@{name=3D"x",type=3D"int",value=3D"3",file=3D"/home= /src/name.c",line=3D"1",shadowed=3D"true"@}] +@end smallexample + +A variable is shadowed when there's another variable with 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. The +location can help to locate the instances of shadowed variables. So, +location information is only added for shadowed variables. + @subsubheading Example =20 @smallexample diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 6c4a0e262f2..4996307c2e7 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -32,6 +32,7 @@ #include "mi-parse.h" #include #include "inferior.h" +#include "gdbsupport/unordered_map.h" =20 enum what_to_list { locals, arguments, all }; =20 @@ -490,7 +491,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 gdb::unordered_set *shadowed_vars, + gdb::unordered_set &printed_vars) { struct ui_out *uiout =3D current_uiout; =20 @@ -519,6 +522,19 @@ list_arg_or_local (const struct frame_arg *arg, enum w= hat_to_list what, tuple_emitter.emplace (uiout, nullptr); =20 string_file stb; + const char *name =3D arg->sym->print_name (); + /* To distinguish innermost variable from the rest in the shadowed_vars + this boolen is needed. */ + bool already_printed =3D !printed_vars.insert (name).second; + bool shadowed =3D shadowed_vars->find (name) !=3D 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 (get_lang_vars_shadowing_option (current_language->la_language) + =3D=3D lang_vars_shadowing::HIDE && shadowed && already_printed) + return; =20 stb.puts (arg->sym->print_name ()); if (arg->entry_kind =3D=3D print_entry_values_only) @@ -560,6 +576,59 @@ list_arg_or_local (const struct frame_arg *arg, enum w= hat_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 (get_lang_vars_shadowing_option (current_language->la_language) + =3D=3D lang_vars_shadowing::PRINT && shadowed + && !(values =3D=3D PRINT_NO_VALUES && what =3D=3D locals)) + { + uiout->field_string ("file", arg->sym->symtab ()->filename ()); + uiout->field_unsigned ("line", arg->sym->m_line); + if (already_printed) + uiout->field_string ("shadowed", "true"); + } +} + +/* Returns true if address_class can be printed, otherwise returns false. = */ + +static bool +can_print_aclass (struct symbol *sym, enum what_to_list what) +{ + int print_me =3D false; + + switch (sym->loc_class ()) + { + default: + case LOC_UNDEF: /* catches errors */ + case LOC_CONST: /* constant */ + case LOC_TYPEDEF: /* local typedef */ + case LOC_LABEL: /* local label */ + case LOC_BLOCK: /* local function */ + case LOC_CONST_BYTES: /* loc. byte seq. */ + case LOC_UNRESOLVED: /* unresolved static */ + case LOC_OPTIMIZED_OUT: /* optimized out */ + print_me =3D false; + break; + + case LOC_ARG: /* argument */ + case LOC_REF_ARG: /* reference arg */ + case LOC_REGPARM_ADDR: /* indirect register arg */ + case LOC_LOCAL: /* stack local */ + case LOC_STATIC: /* static */ + case LOC_REGISTER: /* register */ + case LOC_COMPUTED: /* computed location */ + if (what =3D=3D all) + print_me =3D true; + else if (what =3D=3D locals) + print_me =3D !sym->is_argument (); + else + print_me =3D sym->is_argument (); + break; + } + + return print_me; } =20 /* Print a list of the objects for the frame FI in a certain form, @@ -573,9 +642,10 @@ list_args_or_locals (const frame_print_options &fp_opt= s, 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 =3D current_uiout; + gdb::unordered_set collected_vars, shadowed_vars, printed_v= ars; =20 block =3D get_frame_block (fi, 0); =20 @@ -596,42 +666,31 @@ list_args_or_locals (const frame_print_options &fp_op= ts, =20 ui_out_emit_list list_emitter (uiout, name_of_result); =20 - while (block !=3D 0) + orig_block =3D block; + /* Stored list of shadowed variables later help in identifying them + from the rest. */ + while (block !=3D nullptr) { for (struct symbol *sym : block_iterator_range (block)) { - int print_me =3D 0; - - switch (sym->loc_class ()) + if (can_print_aclass (sym, what)) { - default: - case LOC_UNDEF: /* catches errors */ - case LOC_CONST: /* constant */ - case LOC_TYPEDEF: /* local typedef */ - case LOC_LABEL: /* local label */ - case LOC_BLOCK: /* local function */ - case LOC_CONST_BYTES: /* loc. byte seq. */ - case LOC_UNRESOLVED: /* unresolved static */ - case LOC_OPTIMIZED_OUT: /* optimized out */ - print_me =3D 0; - break; - - case LOC_ARG: /* argument */ - case LOC_REF_ARG: /* reference arg */ - case LOC_REGPARM_ADDR: /* indirect register arg */ - case LOC_LOCAL: /* stack local */ - case LOC_STATIC: /* static */ - case LOC_REGISTER: /* register */ - case LOC_COMPUTED: /* computed location */ - if (what =3D=3D all) - print_me =3D 1; - else if (what =3D=3D locals) - print_me =3D !sym->is_argument (); - else - print_me =3D sym->is_argument (); - break; + const char *name =3D sym->print_name (); + if (!collected_vars.insert (name).second) + shadowed_vars.insert (name); } - if (print_me) + } + if (block->function ()) + break; + block =3D block->superblock (); + } + + block =3D orig_block; + while (block !=3D 0) + { + for (struct symbol *sym : block_iterator_range (block)) + { + if (can_print_aclass (sym, what)) { struct symbol *sym2; struct frame_arg arg, entryarg; @@ -666,10 +725,10 @@ list_args_or_locals (const frame_print_options &fp_op= ts, =20 if (arg.entry_kind !=3D 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 !=3D print_entry_values_no) list_arg_or_local (&entryarg, what, values, skip_unavailable, - fp_opts); + fp_opts, &shadowed_vars, printed_vars); } } =20 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..d01717099e1 --- /dev/null +++ b/gdb/testsuite/gdb.mi/mi-var-shadowing.c @@ -0,0 +1,48 @@ +/* Copyright (C) 2023-2025 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 . = */ + +#include + +void +shadowing (void) +{ + int a =3D 100; /* entry bp */ + unsigned int val1 =3D 1; /* val1-d1 */ + unsigned int val2 =3D 2; /* val2-d1 */ + a =3D 101; /* bp for locals 1 */ + { + unsigned int val2 =3D 3; /* val2-d2 */ + unsigned int val3 =3D 4; /* val3-d1 */ + a =3D 102; /* bp for locals 2 */ + { + unsigned int val1 =3D 5; /* val1-d2 */ + a =3D 103; /* bp for locals 3 */ + { + unsigned int val1 =3D 6; /* val1-d3 */ + unsigned int val2 =3D 7; /* val2-d3 */ + unsigned int val3 =3D 8; /* val3-d2 */ + a =3D 104; /* bp for locals 4 */ + } + } + } + a =3D 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..7114dde56f0 --- /dev/null +++ b/gdb/testsuite/gdb.mi/mi-var-shadowing.exp @@ -0,0 +1,141 @@ +# Copyright 2023-2025 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 . + +load_lib mi-support.exp +set MIFLAGS "-i=3Dmi" + +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)=3D\\\[\{name=3D\"a\",type= =3D\"int\",value=3D\"$decimal\"\},\{name=3D\"val1\",type=3D\"unsigned int\"= ,value=3D\"1\"\},{name=3D\"val2\",type=3D\"unsigned int\",value=3D\"2\"\}\\= \]" +set stack_test2_regx "\\^done,(locals|variables)=3D\\\[\{name=3D\"val2\",t= ype=3D\"unsigned int\",value=3D\"3\",file=3D\"$srcdir/$subdir/$srcfile\",li= ne=3D\"$val2_d2\"\},\{name=3D\"val3\",type=3D\"unsigned int\",value=3D\"4\"= \},\{name=3D\"a\",type=3D\"int\",value=3D\"101\"\},\{name=3D\"val1\",type= =3D\"unsigned int\",value=3D\"1\"\},\{name=3D\"val2\",type=3D\"unsigned int= \",value=3D\"2\",file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val2_d1\",sh= adowed=3D\"true\"\}\\\]" +set stack_test3_regx "\\^done,(locals|variables)=3D\\\[\{name=3D\"val1\",t= ype=3D\"unsigned int\",value=3D\"5\",file=3D\"$srcdir/$subdir/$srcfile\",li= ne=3D\"$val1_d2\"\},\{name=3D\"val2\",type=3D\"unsigned int\",value=3D\"3\"= ,file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val2_d2\"\},\{name=3D\"val3\= ",type=3D\"unsigned int\",value=3D\"4\"\},\{name=3D\"a\",type=3D\"int\",val= ue=3D\"102\"\},\{name=3D\"val1\",type=3D\"unsigned int\",value=3D\"1\",file= =3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val1_d1\",shadowed=3D\"true\"\},\= {name=3D\"val2\",type=3D\"unsigned int\",value=3D\"2\",file=3D\"$srcdir/$su= bdir/$srcfile\",line=3D\"$val2_d1\",shadowed=3D\"true\"\}\\\]" +set stack_test4_regx "\\^done,(locals|variables)=3D\\\[\{name=3D\"val1\",t= ype=3D\"unsigned int\",value=3D\"6\",file=3D\"$srcdir/$subdir/$srcfile\",li= ne=3D\"$val1_d3\"\},\{name=3D\"val2\",type=3D\"unsigned int\",value=3D\"7\"= ,file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val2_d3\"\},\{name=3D\"val3\= ",type=3D\"unsigned int\",value=3D\"8\",file=3D\"$srcdir/$subdir/$srcfile\"= ,line=3D\"$val3_d2\"\},\{name=3D\"val1\",type=3D\"unsigned int\",value=3D\"= 5\",file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val1_d2\",shadowed=3D\"tr= ue\"\},\{name=3D\"val2\",type=3D\"unsigned int\",value=3D\"3\",file=3D\"$sr= cdir/$subdir/$srcfile\",line=3D\"$val2_d2\",shadowed=3D\"true\"\},\{name=3D= \"val3\",type=3D\"unsigned int\",value=3D\"4\",file=3D\"$srcdir/$subdir/$sr= cfile\",line=3D\"$val3_d1\",shadowed=3D\"true\"\},\{name=3D\"a\",type=3D\"i= nt\",value=3D\"103\"\},\{name=3D\"val1\",type=3D\"unsigned int\",value=3D\"= 1\",file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val1_d1\",shadowed=3D\"tr= ue\"\},\{name=3D\"val2\",type=3D\"unsigned int\",value=3D\"2\",file=3D\"$sr= cdir/$subdir/$srcfile\",line=3D\"$val2_d1\",shadowed=3D\"true\"\}\\\]" +set stack_test5_regx "\\^done,(locals|variables)=3D\\\[\{name=3D\"a\",type= =3D\"int\",value=3D\"105\"\},\{name=3D\"val1\",type=3D\"unsigned int\",valu= e=3D\"1\"\},\{name=3D\"val2\",type=3D\"unsigned int\",value=3D\"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=3D\"keep\"" } "continue to outermost level" +mi_gdb_test "-stack-list-locals 0" \ + "\\^done,locals=3D\\\[name=3D\"a\",name=3D\"val1\",name=3D\"val2\"\\\]= " \ + "-stack-list-locals 0 at outermost level" +mi_gdb_test "-stack-list-variables 0" \ + "\\^done,variables=3D\\\[{name=3D\"a\"},{name=3D\"val1\"},{name=3D\"va= l2\"}\\\]" \ + "-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=3D\"keep\"" } "continue to first level" +mi_gdb_test "-stack-list-locals 0" \ + "\\^done,locals=3D\\\[name=3D\"val2\",name=3D\"val3\",name=3D\"a\",nam= e=3D\"val1\",name=3D\"val2\"\\\]" \ + "-stack-list-locals 0 at first level" +mi_gdb_test "-stack-list-variables 0" \ + "\\^done,variables=3D\\\[{name=3D\"val2\",file=3D\"$srcdir/$subdir/$sr= cfile\",line=3D\"$val2_d2\"},{name=3D\"val3\"},{name=3D\"a\"},{name=3D\"val= 1\"},{name=3D\"val2\",file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val2_d1= \",shadowed=3D\"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=3D\"keep\"" } "continue to second level" +mi_gdb_test "-stack-list-locals 0" \ + "\\^done,locals=3D\\\[name=3D\"val1\",name=3D\"val2\",name=3D\"val3\"= ,name=3D\"a\",name=3D\"val1\",name=3D\"val2\"\\\]" \ + "-stack-list-locals 0 at second level" +mi_gdb_test "-stack-list-variables 0" \ + "\\^done,variables=3D\\\[{name=3D\"val1\",file=3D\"$srcdir/$subdir/$s= rcfile\",line=3D\"$val1_d2\"},{name=3D\"val2\",file=3D\"$srcdir/$subdir/$sr= cfile\",line=3D\"$val2_d2\"},{name=3D\"val3\"},{name=3D\"a\"},{name=3D\"val= 1\",file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val1_d1\",shadowed=3D\"tr= ue\"\},{name=3D\"val2\",file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val2_= d1\",shadowed=3D\"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=3D\"keep\"" } "continue to third level" +mi_gdb_test "-stack-list-locals 0" \ + "\\^done,locals=3D\\\[name=3D\"val1\",name=3D\"val2\",name=3D\"val3\",= name=3D\"val1\",name=3D\"val2\",name=3D\"val3\",name=3D\"a\",name=3D\"val1\= ",name=3D\"val2\"\\\]" \ + "-stack-list-locals 0 at third level" +mi_gdb_test "-stack-list-variables 0" \ + "\\^done,variables=3D\\\[{name=3D\"val1\",file=3D\"$srcdir/$subdir/$sr= cfile\",line=3D\"$val1_d3\"},{name=3D\"val2\",file=3D\"$srcdir/$subdir/$src= file\",line=3D\"$val2_d3\"},{name=3D\"val3\",file=3D\"$srcdir/$subdir/$srcf= ile\",line=3D\"$val3_d2\"},{name=3D\"val1\",file=3D\"$srcdir/$subdir/$srcfi= le\",line=3D\"$val1_d2\",shadowed=3D\"true\"\},\{name=3D\"val2\",file=3D\"$= srcdir/$subdir/$srcfile\",line=3D\"$val2_d2\",shadowed=3D\"true\"\},\{name= =3D\"val3\",file=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val3_d1\",shadowe= d=3D\"true\"\},{name=3D\"a\"},{name=3D\"val1\",file=3D\"$srcdir/$subdir/$sr= cfile\",line=3D\"$val1_d1\",shadowed=3D\"true\"\},{name=3D\"val2\",file=3D\= "$srcdir/$subdir/$srcfile\",line=3D\"$val2_d1\",shadowed=3D\"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=3D\"keep\"" } "continue to outermost level last" +mi_gdb_test "-stack-list-locals 0" \ + "\\^done,locals=3D\\\[name=3D\"a\",name=3D\"val1\",name=3D\"val2\"\\\]= " \ + "-stack-list-locals 0 at outermost level last" +mi_gdb_test "-stack-list-variables 0" \ + "\\^done,variables=3D\\\[{name=3D\"a\"},{name=3D\"val1\"},{name=3D\"va= l2\"}\\\]" \ + "-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" --=20 2.51.1 --===============0884536232531138391== Content-Type: multipart/alternative; boundary="===============4103902136228304642==" MIME-Version: 1.0 Content-Disposition: inline --===============4103902136228304642== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Intel Deutschland GmbH Registered Address: Dornacher Stra=C3=9Fe 1, 85622 Feldkirchen, Germany Tel: +49 89 991 430, www.intel.de Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell Chairperson of the Supervisory Board: Nicole Lau Registered Seat: Munich Commercial Register: Amtsgericht M=C3=BCnchen HRB 186928 --===============4103902136228304642== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable
Intel Deutschland GmbH
Registered Address: Dornacher Stra=C3= =9Fe 1, 85622 Feldkirchen, Germany
Tel: +49 89 991 430, www.intel.deManaging Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell<= div>Chairperson of the Supervisory Board: Nicole Lau
Registered Seat: M= unich
Commercial Register: Amtsgericht M=C3=BCnchen HRB 186928 --===============4103902136228304642==-- --===============0884536232531138391==--