public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix handling of DW_AT_data_bit_offset
Date: Fri, 24 Sep 2021 09:20:04 -0600	[thread overview]
Message-ID: <87lf3m2e6z.fsf@tromey.com> (raw)
In-Reply-To: <87ilzaj0hp.fsf@tromey.com> (Tom Tromey's message of "Wed, 08 Sep 2021 14:06:26 -0600")

>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:

Tom> A new test case is included.  This test fails with GCC 11, but passes
Tom> with an earlier version of GCC.

>> I'm checking this in now.

Tom> I spoke too soon - the new test fails now with the Fedora 34 system gcc.
Tom> I'll debug it a bit and see what sort of change is needed.

I finally looked.  The working DWARF has an array in a structure that
looks like:

 <3><11f9>: Abbrev Number: 10 (DW_TAG_array_type)
    <11fa>   DW_AT_name        : (indirect string, offset: 0x1a4d): pr__response__T2b
    <11fe>   DW_AT_type        : <0x1248>
    <1202>   DW_AT_sibling     : <0x1210>
 <4><1206>: Abbrev Number: 11 (DW_TAG_subrange_type)
    <1207>   DW_AT_type        : <0x1241>
    <120b>   DW_AT_upper_bound : <0x11a7>

... where the upper bound points at the first member of the enclosing
struct.

However, the failing DWARF does:

 <3><1058>: Abbrev Number: 11 (DW_TAG_array_type)
    <1059>   DW_AT_name        : (indirect string, offset: 0x1a87): pr__response__T2b
    <105d>   DW_AT_type        : <0x10a7>
    <1061>   DW_AT_sibling     : <0x106f>
 <4><1065>: Abbrev Number: 12 (DW_TAG_subrange_type)
    <1066>   DW_AT_type        : <0x10a0>
    <106a>   DW_AT_upper_bound : 3 byte block: 97 94 4 	(DW_OP_push_object_address; DW_OP_deref_size: 4)


Here, and I think correctly, gdb uses the address of the array in the
struct as the object address -- but gcc apparently expects the object
address to be the address of the enclosing structure.

This fix is in gcc 12, so I'm going to update the test case to xfail for
earlier versions of gcc, and then check it in.

Tom

      reply	other threads:[~2021-09-24 15:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 19:17 Tom Tromey
2021-09-08 19:07 ` Tom Tromey
2021-09-08 20:06   ` Tom Tromey
2021-09-24 15:20     ` Tom Tromey [this message]

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=87lf3m2e6z.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@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).