public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>,
	Stephan Rohr via Gdb-patches <gdb-patches@sourceware.org>
Cc: Stephan Rohr <stephan.rohr@intel.com>
Subject: Re: [PATCH v3 1/1] gdb/dwarf2: Fix 'rw_pieced_value' for values casted to different type.
Date: Fri, 6 Jan 2023 14:22:16 -0500	[thread overview]
Message-ID: <1007a4fe-75d7-76e0-2922-5e1f1dba4952@simark.ca> (raw)
In-Reply-To: <875ydkep2i.fsf@tromey.com>

On 1/5/23 14:52, Tom Tromey wrote:
>>>>>> Stephan Rohr via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
>> From: "Rohr, Stephan" <stephan.rohr@intel.com>
>> The 'rw_pieced_value' function is executed when fetching a (lazy)
>> variable described by 'DW_OP_piece' or 'DW_OP_bit_piece'.  The
>> function checks the 'type' and 'enclosing_type' fields of the value
>> for identity.
> 
> Thanks for the patch.
> 
>> If a lazy value is fetched, GDB allocates space based on the enclosing
>> type's length and typically reads the 'full' object.  This is not
>> implemented for pieced values and causes an internal error if 'type'
>> and 'enclosing_type' of a value are not identical.
> 
>> However, GDB can read the value based on its type.  Thus, this patch
>> fixes the previously mentioned cases by removing the check for identity.
> 
> I thought there was some other discussion & idea about the cause of this
> patch... something like, setting a value's type should reset the
> enclosing type?  Or vice versa?  I am wondering if you tried this
> approach instead.

For reference, here was my last attempt at understanding what happens:

  https://inbox.sourceware.org/gdb-patches/dd04b3b4-ea6a-07ba-d734-0e542ca136b3@simark.ca/

I don't have a strong opinion on the matter, I don't know if one
solution is more corrent than the other.  The thing is, I can't explain
the logic behind the existing assert.  It's missing a comment explaining
why it would be a bad thing to "create a lazy value with an enclosing
type".  If we can't add such a justification, I think it's ok to remove
it...

Simon

  reply	other threads:[~2023-01-06 19:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 13:12 [PATCH v3 0/1] " Stephan Rohr
2022-12-21 13:12 ` [PATCH v3 1/1] " Stephan Rohr
2023-01-05 19:52   ` Tom Tromey
2023-01-06 19:22     ` Simon Marchi [this message]
2023-01-06 20:36       ` Tom Tromey
2023-01-09  8:12     ` Rohr, Stephan
2023-01-09 19:28       ` Tom Tromey
2023-01-10  9:29         ` Rohr, Stephan
2023-01-10 21:31           ` Tom Tromey

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=1007a4fe-75d7-76e0-2922-5e1f1dba4952@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=stephan.rohr@intel.com \
    --cc=tom@tromey.com \
    /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).