From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 969B43958C32; Mon, 16 Nov 2020 15:01:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 969B43958C32 From: "gbenson at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/26905] New: Inconsistent DW_AT_count evaluation Date: Mon, 16 Nov 2020 15:01:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: gbenson at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Mon, 16 Nov 2020 15:01:45 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D26905 Bug ID: 26905 Summary: Inconsistent DW_AT_count evaluation Product: gdb Version: unknown Status: NEW Severity: normal Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: gbenson at redhat dot com Target Milestone: --- Clang describes the upper bounds of variable length arrays using a DW_AT_co= unt attribute which references the DIE of a synthetic variable whose value is a DW_AT_location. In some cases GDB correctly handles these, but other times= GDB attempts to dereference the result of evaluating the location expression and fails. An example where GDB does not dereference the value: $ gdb /path/to/gdb/testsuite/outputs/gdb.mi/mi-vla-c99/mi-vla-c99 (gdb) b vla.c:28 (gdb) r ... Breakpoint 1, func (n=3D5) at /gdbtest/src/gdb/testsuite/gdb.mi/vla.c:28 28 return n; /* vla-filled */ (gdb) p vla $1 =3D {0, 1, 2, 3, 4} (gdb) p __vla_expr0 $2 =3D 5 An example where GDB does dereference the value: $ gdb /path/to/gdb/testsuite/outputs/gdb.base/vla-optimized-out/vla-optimized-out= -o1=20 (gdb) b f1 Breakpoint 1 at 0x401110: file /gdbtest/src/gdb/testsuite/gdb.base/vla-optimized-out.c, line 34. (gdb) r ... Breakpoint 1, f1 (i=3D5) at /gdbtest/src/gdb/testsuite/gdb.base/vla-optimized-out.c:34 34 } (gdb) p a Cannot access memory at address 0x6 (gdb)=20 (gdb) p __vla_expr0 $1 =3D 6 In both these examples, __vla_expr0 is the name Clang assigned the synthetic variable containing the value of DW_AT_count. --=20 You are receiving this mail because: You are on the CC list for the bug.=