From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4CC043851C1E; Thu, 5 Aug 2021 10:11:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CC043851C1E From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug ada/28180] FAIL: gdb.ada/interface.exp: print s (timeout) Date: Thu, 05 Aug 2021 10:11:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: ada X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: tromey at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 10:11:13 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28180 --- Comment #3 from Tom de Vries --- (In reply to Tom de Vries from comment #0) > With current master I noticed this timeout: > ... > (gdb) PASS: gdb.ada/interface.exp: print r > print s^M > Multiple matches for s^M > [0] cancel^M > [1] s at > /home/vries/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/ > interface/foo.adb:20^M > [2] s at > /home/vries/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/ > interface/foo.adb:?^M > > FAIL: gdb.ada/interface.exp: print s (timeout) > ... Doing a bit of investigation, we see: ... Breakpoint 1, foo () at /home/vries/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/inter= face/foo.adb:22 22 Do_Nothing (R); -- STOP (gdb) info locals r =3D (x =3D> 1, y =3D> 2, w =3D> 3, h =3D> 4) =3D 8 =3D 8 s =3D (x =3D> 1, y =3D> 2, w =3D> 3, h =3D> 4) s =3D 0x7fffffffd890 ... So both "s" are local variables. That makes it easy to find in the dwarf. We have: ... <2><1204>: Abbrev Number: 31 (DW_TAG_variable) <1205> DW_AT_name : (indirect string, offset: 0x13e6): s.14 <1209> DW_AT_type : <0x1213> <120d> DW_AT_artificial : 1 <120d> DW_AT_location : 5 byte block: 91 e0 7d 23 18 (DW_OP_fbre= g: -288; DW_OP_plus_uconst: 24) ... and: ... <3><1249>: Abbrev Number: 33 (DW_TAG_variable)=20 <124a> DW_AT_name : s <124c> DW_AT_decl_file : 1 <124d> DW_AT_decl_line : 20 <124e> DW_AT_type : <0x146d> <1252> DW_AT_location : 6 byte block: 91 e0 7d 23 18 6=20=20=20=20= =20=20=20=20 (DW_OP_fbreg: -288; DW_OP_plus_uconst: 24; DW_OP_deref) ... I suppose the first is the unexpected one. It has DW_AT_artificial, but is still put into the symbol table because it has a DW_AT_name. This patch: ... diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index acabee3315f..44327ecbd9a 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -21585,6 +21585,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_ cu *cu, if (name) { int suppress_add =3D 0; + attr =3D dwarf2_attr (die, DW_AT_artificial, cu); + if (attr !=3D nullptr) + suppress_add =3D 1; if (space) sym =3D space; ... gets us: ... $ gdb -q -batch outputs/gdb.ada/interface/foo -ex "b foo.adb:22" -ex r -ex= "p s" Breakpoint 1 at 0x404455: file foo.adb, line 22. Breakpoint 1, foo () at foo.adb:22 22 Do_Nothing (R); -- STOP warning: Unknown upper bound, using 1. $1 =3D (x =3D> 1, y =3D> 2, w =3D> 3, h =3D> 4) ... but with the warning because foo__G6b___U (which is another artificial variable) cannot be evaluated. Hmm, so ada uses named artifical variables that need to be in the symbol ta= ble in order to evaluate them, but they should be ignored in terms of gdb comma= nds that investigate source constructs like "p s". That seems to be the root cause. --=20 You are receiving this mail because: You are on the CC list for the bug.=