From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dXGGLKg2WmoXwg4AWB0awg (envelope-from ) for ; Fri, 17 Jul 2026 10:05:28 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=e0A8pxh7; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A23C31E033; Fri, 17 Jul 2026 10:05:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 860F41E033 for ; Fri, 17 Jul 2026 10:05:27 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1606A4BA2E3D for ; Fri, 17 Jul 2026 14:05:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1606A4BA2E3D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=e0A8pxh7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id D8B874BA2E31 for ; Fri, 17 Jul 2026 14:04:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D8B874BA2E31 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D8B874BA2E31 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784297100; cv=none; b=AKtALFgImx3csqxwWJRcAIqm9coHXYprs7mO+Ai/hpwzNOSVD5NF2l79gNV20xHzC1+4sTHYzPqR9LUQaeKzFgx651hHn/LSXiHtBmO3PQw+6b1EMW1W3zl1bdboJNfq9RFPKfchbXI4NM4ds1en/ER3/QI8uLzTKvCXlGgvooU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784297100; c=relaxed/simple; bh=3BFb1Hq05qG6vyyuayrpkZv/tdFJ4pkhjKponVSKsXc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UleEX/XGAg/IJztXlliQycyZ5y079GJW5+XDz+lB6neEdN0WQJi4wXZNk983yu3z4Gg5t9Mogqjy02vUuasYLbtRGzkRCuuxW4j/A+tSeesZ+TZdszpHhfOzIuz/fn+zTCSCHnkeSAFdWqeSL70sDk0YyHrVAS85SexXOEbcijc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=e0A8pxh7 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8B874BA2E31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784297099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TzEl6HPvJGLiRKthL2lDVjZfv8FL78skM68+Rqz6+v4=; b=e0A8pxh7a2UG/LGKaQPvtcZD8usBjAbjOrzWWEciEc+ak8UHMud/CCwo9yuN1nCk9AqFJz q9mAGxTC43oA/b3qkZ4YZhnl2V/10Ge85SE9SDiPl2BRWikA5anuyhv72y/aJgVBWtnAfk YJ3dJOYcBT8LEfKb1g6hkUKMVXwrXjY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-711-f6ZbfyClN2G9Y5SsZfemDQ-1; Fri, 17 Jul 2026 10:04:57 -0400 X-MC-Unique: f6ZbfyClN2G9Y5SsZfemDQ-1 X-Mimecast-MFC-AGG-ID: f6ZbfyClN2G9Y5SsZfemDQ_1784297097 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4954b1c6310so5107585e9.0 for ; Fri, 17 Jul 2026 07:04:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784297097; x=1784901897; h=content-transfer-encoding:content-type:mime-version:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=gg7AwK6DPETqSBs2GvkYza/VL+SoGWmUrU7T1YXs7q8=; b=CgI+E8Yg0Hw5UYb+6lXVjQ4ACuoof3kptJj4+yopp1vsZJn1bLs8qSxgBI1TfsVYF5 X+vKPKWuysHMK7nMb3/zrL2FkMgyLihKM9LziGoEDp1KlO7Q7fIf6t1VNoVo49T0p/0G hdA9PrPUl1bai+icJLw2BsYMaND4DSREv9Uft8Hbyn6CFfKI/RQ/ws/c85B5ZuQVev3P PvY/Y70zqVKKL9M9yYaKzDHs9ogp+IdsbIfdLymiEp2SrfMJ+8uHscqBfl0vUv/ZpNcI gdNTz1k4njFQ4vVODkMdllE7emAChKwyLVBVIXrph90TpkFsW9R1sxscex9B1danMgdn NtZg== X-Forwarded-Encrypted: i=1; AHgh+Rrt/2Ye+11x/Ml6d1fW3shmkql+UJtBmKZDmaMiGjfT7RkIFLnUGrfu+u4i3VzkWam9z8Yccazd4hzxoA==@sourceware.org X-Gm-Message-State: AOJu0YwHAnWkNBEmVUc17CFZftLeBO1fkgpZA0TG+yn1eNBaiL4wtUBR TbsdHJPi0PSl1Cq/z8cs6UTEJtjw7JLF+yt9eCfYOpI//eCNPGf4LkjnG/cE+ZbJ0zoZwuo8NFc lXKxWhWkZYJuq+RlaNc1jMb1ysKhzAHvFSQ+lJ3nadZZXYjXtzn0448srOd7cPQ8= X-Gm-Gg: AfdE7clM7rRNFHWxy13DUYg0FaiughiojUbeohD0fM9Cq2l0IhdXOo6E4NXIZX2b2sl 73wjwY7X7CQEezpfygU7Nv4485EIZJXLjTGuGxQXpxFWO5Ezs2q7omnJSbeg92QtqEzb8E4EWAf rfNUuyOsjIZefytC3emqgSdNcNad0K0iIiiJ1hULveKr5llYNo0nPBP41FXlnep2JTCI9l96lzx 12+nwB8wjYMIsCqQvKaD/NSOzLoXoAqbUDse9pQKVzQvxz4NEWB+Dg0BZyazqlNSm7xyLKFYCME PGNA/DS1Co9j7i4PP3OJtom8aq/YyTkXL5BPCSvHe9VlG5q8grctlFo6JUZyEWJfFqxf5Wqo X-Received: by 2002:a05:600c:6c48:b0:492:4e09:9fc1 with SMTP id 5b1f17b1804b1-4954a3ed5bfmr22903715e9.15.1784297096306; Fri, 17 Jul 2026 07:04:56 -0700 (PDT) X-Received: by 2002:a05:600c:6c48:b0:492:4e09:9fc1 with SMTP id 5b1f17b1804b1-4954a3ed5bfmr22903005e9.15.1784297095550; Fri, 17 Jul 2026 07:04:55 -0700 (PDT) Received: from localhost ([31.111.209.233]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f63ed2313sm3795051f8f.23.2026.07.17.07.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2026 07:04:54 -0700 (PDT) From: Andrew Burgess To: Abdul Basit Ijaz , gdb-patches@sourceware.org Cc: pedro@palves.net, philippe.waroquiers@skynet.be, christina.schimpe@intel.com, lsix@lancelotsix.com, eliz@gnu.org, abdul.b.ijaz@intel.com, guinevere@redhat.com Subject: Re: [PATCH v14 2/2] gdb: add shadowed field in '-stack-list-locals/variables' mi commands In-Reply-To: <20260714124036.79545-3-abdul.b.ijaz@intel.com> References: <20260714124036.79545-1-abdul.b.ijaz@intel.com> <20260714124036.79545-3-abdul.b.ijaz@intel.com> Date: Fri, 17 Jul 2026 15:04:53 +0100 Message-ID: <87ldb9d856.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: y-K8B_i9gJbIkSHWvZQWzFthRm1li80Sy29BIIdiVVk_1784297097 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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 Hi! Thanks for the update. I have some feedback below. There's one, relating the use of lbasename which might need further discussion, I've laid out my position inline below. There's also a few other minor points, but nothing serious. Abdul Basit Ijaz writes: > 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 inform= ation > for shadowed variables and add 'shadowed' field also in '-stack-list-loca= ls' > and '-stack-list-variables' mi commands for super-block shadowed variable= . > > Suppose we have test.c file > > 1:int x =3D 3; > 2: { > 3: int x =3D 4; > 4: int y =3D 5; > 5: x =3D 99; /* break here */ > 6: } > > 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"4"},{name=3D"y",value=3D"5"},{name= =3D"x",value=3D"3"}] > (gdb) > -stack-list-locals 2 > ^done,locals=3D[{name=3D"x",type=3D"int",value=3D"4"},{name=3D"y",type=3D= "int",value=3D"5"},{name=3D"x",type=3D"int",value=3D"3"}] > (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"4"},{name=3D"y",value=3D"5"},{nam= e=3D"x",value=3D"3"}] > (gdb) > -stack-list-variables 2 > ^done,variables=3D[{name=3D"x",type=3D"int",value=3D"4"},{name=3D"y",type= =3D"int",value=3D"5"},{name=3D"x",type=3D"int",value=3D"3"}] > ~~~ > > 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"4",filename=3D"test.c",fullname=3D"/= home/src/test.c",line=3D"5"},{name=3D"y",value=3D"5"},{name=3D"x",value=3D"= 3",filename=3D"test.c",fullname=3D"/home/src/test.c",line=3D"2",shadowed=3D= "true"}] Line numbers are wrong, they should be "3" and "1". I think many of the line numbers in the below might be off too. > (gdb) > -stack-list-locals 2 > ^done,locals=3D[{name=3D"x",type=3D"int",value=3D"4",filename=3D"test.c",= fullname=3D"/home/src/test.c",line=3D"5"},{name=3D"y",type=3D"int",value=3D= "5"},{name=3D"x",type=3D"int",value=3D"3",filename=3D"test.c",fullname=3D"/= home/src/test.c",line=3D"2",shadowed=3D"true"}] > (gdb) > -stack-list-variables 0 > ^done,variables=3D[{name=3D"x",filename=3D"test.c",fullname=3D"/home/src/= test.c",line=3D"5"},{name=3D"y"},{name=3D"x",filename=3D"test.c",fullname= =3D"/home/src/test.c",line=3D"2",shadowed=3D"true"}] > (gdb) > -stack-list-variables 1 > ^done,variables=3D[{name=3D"x",value=3D"4",filename=3D"test.c",fullname= =3D"/home/src/test.c",line=3D"4"},{name=3D"y",value=3D"5"},{name=3D"x",valu= e=3D"3",filename=3D"test.c",fullname=3D"/home/src/test.c",line=3D"2",shadow= ed=3D"true"}] > (gdb) > -stack-list-variables 2 > ^done,variables=3D[{name=3D"x",type=3D"int",value=3D"4",filename=3D"test.= c",fullname=3D"/home/src/test.c",line=3D"4"},{name=3D"y",type=3D"int",value= =3D"5"},{name=3D"x",type=3D"int",value=3D"3",filename=3D"test.c",fullname= =3D"/home/src/test.c",line=3D"2",shadowed=3D"true"}] > ~~~ > Reviewed-By: Guinevere Larsen > --- > gdb/NEWS | 4 + > gdb/doc/gdb.texinfo | 22 ++++ > gdb/mi/mi-cmd-stack.c | 144 ++++++++++++++++------ > gdb/testsuite/gdb.mi/mi-var-shadowing.c | 50 ++++++++ > gdb/testsuite/gdb.mi/mi-var-shadowing.exp | 141 +++++++++++++++++++++ > 5 files changed, 324 insertions(+), 37 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 2c8adf05b43..a3d0ad4ca11 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -594,6 +594,10 @@ multi-wp-addr in qSupported > multiple times, and the same mapping was being reused. In all > other cases, this field will have the value 'false'. > =20 > +** GDB now shows the "shadowed", "filename", "fullname" and "line" > + fields in the output of '-stack-list-locals/variables' mi > + commands for variables that are shadowed, or which are shadowing. > + > * 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 ee33bfdba13..883859e69c4 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -35585,6 +35585,28 @@ If the @code{--skip-unavailable} option is speci= fied, local variables > and arguments that are not available are not listed. Partially > available arguments and local variables are still displayed, however. > =20 > +@smallexample > +@group > +1: int x =3D 3; > +2: @{ > +3: int x =3D 4; > +4: int y =3D 5; > +5: x =3D 99; // breakpoint-line > +6: @} > +@end group > +@group > +(gdb) -stack-list-variables 2 > +^done,variables=3D[@{name=3D"x",type=3D"int",value=3D"4", > +filename=3D"name.c",fullname=3D"/home/src/name.c",line=3D"3"@}, > +@{name=3D"y",type=3D"int",value=3D"5"@},@{name=3D"x",type=3D"int", > +value=3D"3",filename=3D"name.c",fullname=3D"/home/src/name.c", > +line=3D"1",shadowed=3D"true"@}] > +@end group > +@end smallexample > + > +The location information and @samp{shadowed} attribute is only added > +for shadowed variables (@pxref{shadowed variables}). How about updating this paragraph to: The location information and @samp{shadowed} attribute are only added when variable shadowing is detected (@pxref{shadowed variables}). the original text says that information is only added for shadowed variables, but this isn't the full story, the shadowing copy also gets information. My updated text avoids this (I think). > + > @subsubheading Example > =20 > @smallexample > diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c > index 280a08d121e..d2e814750d5 100644 > --- a/gdb/mi/mi-cmd-stack.c > +++ b/gdb/mi/mi-cmd-stack.c > @@ -560,6 +577,69 @@ list_arg_or_local (const struct frame_arg *arg, enum= what_to_list what, > =09} > uiout->field_stream ("value", stb); > } > + > + /* Only for C/C++/Fortran/Ada languages, in case of variables shadowin= g > + print shadowed field after the superblock variable and only locatio= n > + 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)) > + { > + if (arg->sym->symtab () !=3D nullptr) > +=09{ > +=09 symtab *symtab =3D arg->sym->symtab (); > + > +=09 /* Use lbasename instead of symtab_to_filename_for_display as the > +=09 latter defaults to relative path while basename is preferred > +=09 here. */ > +=09 uiout->field_string ("filename", lbasename (symtab->filename ())); I strongly feel this is the wrong choice in this case. I saw your comment about lbasename on the previous patch iteration, so I didn't push about the issue on patch #1, the CLI output (though I do think symtab_to_filename_for_display would be better). While for the CLI we do need to balance between full information and screen space use, and avoid making the output too busy, in the MI we don't have that concern. The MI output is only intended for things like IDEs to parse, not humans, so I think consistency with other similar fields is far more important. If an IDE want to only show the basename then it can always do that, but the IDE cannot (reliably) recreate the relative path if that's what it wants to display. So for that reason, for me, I'd really like you to consider using symtab_to_filename_for_display for the MI case. > +=09 uiout->field_string ("fullname", symtab_to_fullname (symtab)); > +=09 uiout->field_unsigned ("line", arg->sym->line ()); > +=09} > + > + if (already_printed) > +=09uiout->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) > +{ > + bool 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) > +=09print_me =3D true; > + else if (what =3D=3D locals) > +=09print_me =3D !sym->is_argument (); > + else > +=09print_me =3D sym->is_argument (); > + break; > + } > + > + return print_me; I think the return line needs less indentation. > } > =20 > /* Print a list of the objects for the frame FI in a certain form, > diff --git a/gdb/testsuite/gdb.mi/mi-var-shadowing.exp b/gdb/testsuite/gd= b.mi/mi-var-shadowing.exp > new file mode 100644 > index 00000000000..27326864083 > --- /dev/null > +++ b/gdb/testsuite/gdb.mi/mi-var-shadowing.exp > @@ -0,0 +1,141 @@ > +# Copyright 2023-2026 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 > +} > + > +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\",ty= pe=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\"= ,type=3D\"unsigned int\",value=3D\"3\",filename=3D\"$srcfile\",fullname=3D\= "$srcdir/$subdir/$srcfile\",line=3D\"$val2_d2\"\},\{name=3D\"val3\",type=3D= \"unsigned int\",value=3D\"4\"\},\{name=3D\"a\",type=3D\"int\",value=3D\"10= 1\"\},\{name=3D\"val1\",type=3D\"unsigned int\",value=3D\"1\"\},\{name=3D\"= val2\",type=3D\"unsigned int\",value=3D\"2\",filename=3D\"$srcfile\",fullna= me=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val2_d1\",shadowed=3D\"true\"\}= \\\]" > +set stack_test3_regx "\\^done,(locals|variables)=3D\\\[\{name=3D\"val1\"= ,type=3D\"unsigned int\",value=3D\"5\",filename=3D\"$srcfile\",fullname=3D\= "$srcdir/$subdir/$srcfile\",line=3D\"$val1_d2\"\},\{name=3D\"val2\",type=3D= \"unsigned int\",value=3D\"3\",filename=3D\"$srcfile\",fullname=3D\"$srcdir= /$subdir/$srcfile\",line=3D\"$val2_d2\"\},\{name=3D\"val3\",type=3D\"unsign= ed int\",value=3D\"4\"\},\{name=3D\"a\",type=3D\"int\",value=3D\"102\"\},\{= name=3D\"val1\",type=3D\"unsigned int\",value=3D\"1\",filename=3D\"$srcfile= \",fullname=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val1_d1\",shadowed=3D\= "true\"\},\{name=3D\"val2\",type=3D\"unsigned int\",value=3D\"2\",filename= =3D\"$srcfile\",fullname=3D\"$srcdir/$subdir/$srcfile\",line=3D\"$val2_d1\"= ,shadowed=3D\"true\"\}\\\]" > +set stack_test4_regx "\\^done,(locals|variables)=3D\\\[\{name=3D\"val1\"= ,type=3D\"unsigned int\",value=3D\"6\",filename=3D\"$srcfile\",fullname=3D\= "$srcdir/$subdir/$srcfile\",line=3D\"$val1_d3\"\},\{name=3D\"val2\",type=3D= \"unsigned int\",value=3D\"7\",filename=3D\"$srcfile\",fullname=3D\"$srcdir= /$subdir/$srcfile\",line=3D\"$val2_d3\"\},\{name=3D\"val3\",type=3D\"unsign= ed int\",value=3D\"8\",filename=3D\"$srcfile\",fullname=3D\"$srcdir/$subdir= /$srcfile\",line=3D\"$val3_d2\"\},\{name=3D\"val1\",type=3D\"unsigned int\"= ,value=3D\"5\",filename=3D\"$srcfile\",fullname=3D\"$srcdir/$subdir/$srcfil= e\",line=3D\"$val1_d2\",shadowed=3D\"true\"\},\{name=3D\"val2\",type=3D\"un= signed int\",value=3D\"3\",filename=3D\"$srcfile\",fullname=3D\"$srcdir/$su= bdir/$srcfile\",line=3D\"$val2_d2\",shadowed=3D\"true\"\},\{name=3D\"val3\"= ,type=3D\"unsigned int\",value=3D\"4\",filename=3D\"$srcfile\",fullname=3D\= "$srcdir/$subdir/$srcfile\",line=3D\"$val3_d1\",shadowed=3D\"true\"\},\{nam= e=3D\"a\",type=3D\"int\",value=3D\"103\"\},\{name=3D\"val1\",type=3D\"unsig= ned int\",value=3D\"1\",filename=3D\"$srcfile\",fullname=3D\"$srcdir/$subdi= r/$srcfile\",line=3D\"$val1_d1\",shadowed=3D\"true\"\},\{name=3D\"val2\",ty= pe=3D\"unsigned int\",value=3D\"2\",filename=3D\"$srcfile\",fullname=3D\"$s= rcdir/$subdir/$srcfile\",line=3D\"$val2_d1\",shadowed=3D\"true\"\}\\\]" > +set stack_test5_regx "\\^done,(locals|variables)=3D\\\[\{name=3D\"a\",ty= pe=3D\"int\",value=3D\"105\"\},\{name=3D\"val1\",type=3D\"unsigned int\",va= lue=3D\"1\"\},\{name=3D\"val2\",type=3D\"unsigned int\",value=3D\"2\"\}\\\]= " There's a bunch of tests that fail for me here due to the use of: fullname=3D\"$srcdir/$subdir/$srcfile\" I guess you must configure GDB with an absolute path to the configure script, while I use a relative path. As a result the expected pattern for me becomes: fullname=3D"/tmp/binutils-gdb/build/gdb/testsuite/../../../src/gdb/testsu= ite/gdb.mi/mi-var-shadowing.c" which doesn't matter the absolute path that is actually emitted. Looking around this seems to be a solved problem though, other tests use: fullname=3D\"${fullname_syntax}$srcfile\" and if I change all of the original fullname patterns to the updated version, then the tests all pass for me. If you update to use symtab_to_filename_for_display as I request then you will also need to update the 'filename' patterns, but these can just become: filename=3D\"[^\r\n\]+$srcfile\" which will be fine. If you're happy to make these changes, including the lbasename change, then I think this would be fine: Approved-By: Andrew Burgess Otherwise, happy to discuss the lbasename stuff more as needed. Thanks, Andrew