public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26905] New: Inconsistent DW_AT_count evaluation
@ 2020-11-16 15:01 gbenson at redhat dot com
  2020-11-16 15:03 ` [Bug gdb/26905] " gbenson at redhat dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: gbenson at redhat dot com @ 2020-11-16 15:01 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26905

            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_count
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=5) at /gdbtest/src/gdb/testsuite/gdb.mi/vla.c:28
 28       return n;                 /* vla-filled */
 (gdb) p vla
 $1 = {0, 1, 2, 3, 4}
 (gdb) p __vla_expr0
 $2 = 5

An example where GDB does dereference the value:

 $ gdb
/path/to/gdb/testsuite/outputs/gdb.base/vla-optimized-out/vla-optimized-out-o1 
 (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=5) at
/gdbtest/src/gdb/testsuite/gdb.base/vla-optimized-out.c:34
 34     }
 (gdb) p a
 Cannot access memory at address 0x6
 (gdb) 
 (gdb) p __vla_expr0
 $1 = 6

In both these examples, __vla_expr0 is the name Clang assigned the synthetic
variable containing the value of DW_AT_count.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-11-30 12:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 15:01 [Bug gdb/26905] New: Inconsistent DW_AT_count evaluation gbenson at redhat dot com
2020-11-16 15:03 ` [Bug gdb/26905] " gbenson at redhat dot com
2020-11-16 15:05 ` gbenson at redhat dot com
2020-11-16 15:05 ` gbenson at redhat dot com
2020-11-16 15:06 ` gbenson at redhat dot com
2020-11-16 15:23 ` gbenson at redhat dot com
2020-11-16 15:25 ` gbenson at redhat dot com
2020-11-16 15:26 ` gbenson at redhat dot com
2020-11-17  9:51 ` gbenson at redhat dot com
2020-11-20 13:50 ` [Bug symtab/26905] " vries at gcc dot gnu.org
2020-11-20 16:32 ` vries at gcc dot gnu.org
2020-11-22  9:55 ` cvs-commit at gcc dot gnu.org
2020-11-23 17:59 ` mark at klomp dot org
2020-11-30 12:50 ` cvs-commit at gcc dot gnu.org
2020-11-30 12:53 ` vries at gcc dot gnu.org

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).