public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug m3/27049] gdb crashes when printing variable of 2 dimensional dynamic array
Date: Sat, 12 Dec 2020 05:49:40 +0000	[thread overview]
Message-ID: <bug-27049-4717-oqulZz1ZOI@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27049-4717@http.sourceware.org/bugzilla/>

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-12-12

--- Comment #5 from Simon Marchi <simark at simark dot ca> ---
Ok, I am able to reproduce using your program.

So, here's the problematic variable and its type:

0x000000ac:   DW_TAG_variable
                DW_AT_name [DW_FORM_strp]       ("ref2dim")
                DW_AT_type [DW_FORM_ref4]       (0x000000c8 "RefDynArr2")
                DW_AT_decl_file [DW_FORM_data1]
("/home/peter/cm3/testsimple/gdbbug/src/Main.m3")
                DW_AT_decl_line [DW_FORM_data1] (1)
                DW_AT_location [DW_FORM_exprloc]        (DW_OP_addr 0x76010,
DW_OP_plus_uconst 0x290)
                DW_AT_linkage_name [DW_FORM_strp]       ("ref2dim")

0x000000c8:   DW_TAG_pointer_type
                DW_AT_type [DW_FORM_ref4]       (0x000000d1 "INTEGER[][]")
                DW_AT_name [DW_FORM_strp]       ("RefDynArr2")

0x000000d1:   DW_TAG_array_type
                DW_AT_data_location [DW_FORM_exprloc]  
(DW_OP_push_object_address, DW_OP_deref)
                DW_AT_type [DW_FORM_ref4]       (0x000000ea "INTEGER[]")

0x000000d9:     DW_TAG_subrange_type
                  DW_AT_type [DW_FORM_ref4]     (0x00000060 "INTEGER")
                  DW_AT_name [DW_FORM_strp]     ("DynArr2_rng")
                  DW_AT_lower_bound [DW_FORM_exprloc]   (DW_OP_lit0)
                  DW_AT_count [DW_FORM_exprloc] (DW_OP_push_object_address,
DW_OP_plus_uconst 0x8, DW_OP_deref)

0x000000e9:     NULL

GDB doesn't like that the data location dynamic property of the array type is
not a constant.  That code, including the assert, was added here:

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=9920b4348edb;hp=d5486c43728b4fa17c111a301c30a1e072eaec6a

What I don't understand is that according to DWARF (5), dynamic properties,
including DW_AT_data_location, are location expressions.  So I'm not sure why
this code expects the data location dynamic prop to be a constant.  So I'm not
sure what the original intention was...

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

  parent reply	other threads:[~2020-12-12  5:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11  0:56 [Bug m3/27049] New: " peter.mckinna at gmail dot com
2020-12-11  4:45 ` [Bug m3/27049] " simark at simark dot ca
2020-12-11 14:16 ` tromey at sourceware dot org
2020-12-11 22:34 ` peter.mckinna at gmail dot com
2020-12-11 23:15 ` peter.mckinna at gmail dot com
2020-12-12  5:49 ` simark at simark dot ca [this message]
2020-12-15 18:19 ` tromey at sourceware dot org
2020-12-15 18:23 ` tromey at sourceware dot org
2020-12-15 18:24 ` tromey at sourceware dot org
2020-12-15 21:16 ` peter.mckinna at gmail dot com
2020-12-16 11:24 ` andrew.burgess at embecosm dot com
2020-12-17 17:30 ` andrew.burgess at embecosm dot com
2020-12-18  1:19 ` peter.mckinna at gmail dot com
2020-12-18  6:34 ` peter.mckinna at gmail dot com
2020-12-18 11:12 ` andrew.burgess at embecosm dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27049-4717-oqulZz1ZOI@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).