public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug ada/28115] New: Support packed array encoded as DW_TAG_subrange_type
Date: Wed, 21 Jul 2021 10:13:29 +0000	[thread overview]
Message-ID: <bug-28115-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 28115
           Summary: Support packed array encoded as DW_TAG_subrange_type
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ada
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

With gcc-11, we have:
...
(gdb) print pa_ptr(3)^M
cannot subscript or call something of type `foo__packed_array_ptr'^M
(gdb) FAIL: gdb.ada/arrayptr.exp: scenario=minimal: print pa_ptr(3)
...

This happens in ada_funcall_operation::evaluate here:
...
  if (type->code () == TYPE_CODE_PTR)
    {
      switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ())
...
because the case TYPE_CODE_RANGE is not handled.

The dwarf looks like:
...
 <2><1667>: Abbrev Number: 5 (DW_TAG_variable)
    <1668>   DW_AT_name        : pa_ptr
    <166f>   DW_AT_type        : <0x1638>
 <2><1638>: Abbrev Number: 4 (DW_TAG_typedef)
    <1639>   DW_AT_name        : foo__packed_array_ptr
    <1640>   DW_AT_type        : <0x1644>
 <2><1644>: Abbrev Number: 6 (DW_TAG_pointer_type)
    <1645>   DW_AT_byte_size   : 8
    <1646>   DW_AT_type        : <0x164a>
 <2><164a>: Abbrev Number: 7 (DW_TAG_subrange_type)
    <164b>   DW_AT_lower_bound : 0
    <164c>   DW_AT_upper_bound : 18 byte block: 9e 10 ff ff ff ff ff ff ff ff
3f 0 0 0 0 0 0 0  (DW_OP_implicit_value 16 byte block: ff ff ff ff ff ff ff ff
3f 0 0 0 0 0 0 0 )
    <165f>   DW_AT_name        : foo__packed_array
    <1663>   DW_AT_type        : <0x1720>
    <1667>   DW_AT_artificial  : 1
 <1><1720>: Abbrev Number: 15 (DW_TAG_base_type)
    <1721>   DW_AT_byte_size   : 16
    <1722>   DW_AT_encoding    : 7      (unsigned)
    <1723>   DW_AT_name        : (indirect string, offset: 0x204a):
long_long_long_unsigned
    <1727>   DW_AT_artificial  : 1
...

A simple guess:
...
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index b098991612d..736007f737b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10605,6 +10605,8 @@ ada_funcall_operation::evaluate (struct type
*expect_type,
            callee = ada_value_ind (callee);
          type = ada_check_typedef (TYPE_TARGET_TYPE (type));
          break;
+       case TYPE_CODE_RANGE:
+         break;
        default:
          error (_("cannot subscript or call something of type `%s'"),
                 ada_type_name (value_type (callee)));
...
turns this into:
...
(gdb) print pa_ptr(3)^M
That operation is not available on integers of more than 8 bytes.^M
(gdb)
...
which turns things into a duplicate of PR20991 - "__int128 type support".

Which is also how other related tests in the test-case fail.  But I don't
understand ada well enough to known whether the patch is actually correct.

So at least for now, filing a separate PR.

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

             reply	other threads:[~2021-07-21 10:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 10:13 vries at gcc dot gnu.org [this message]
2021-07-21 12:19 ` [Bug ada/28115] " cvs-commit at gcc dot gnu.org
2021-07-21 12:22 ` cvs-commit at gcc dot gnu.org
2021-09-07  9:42 ` vries at gcc dot gnu.org
2022-02-28 20:33 ` tromey at sourceware dot org
2022-02-28 20:44 ` tromey at sourceware dot org
2022-03-07 14:57 ` cvs-commit at gcc dot gnu.org
2022-03-07 14:58 ` tromey at sourceware dot org

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-28115-4717@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).