Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Denis Lukianov <denis@voxelsoft.com>
To: gdb-patches@sourceware.org, Simon Marchi <simon.marchi@polymtl.ca>
Cc: andrew.burgess@embecosm.com
Subject: Re: [PATCH] dwarf2: Fix dwarf stack fetch array view size mismatch
Date: Sat, 20 Aug 2022 02:55:37 +0100	[thread overview]
Message-ID: <a9b7f220b820a81381fbaa221d98e9eefb4eda8b.camel@voxelsoft.com> (raw)
In-Reply-To: <d8d8b42443a594135f5ee7fb009420ebfa60bdd6.camel@voxelsoft.com>

On Sat, 2022-08-20 at 02:38 +0100, Denis Lukianov wrote:
> 
> I know nothing about gdb internals, just reading code in the file:
> 
> copy (value_contents_all (val).slice (subobj_offset, len),
>                   value_contents_raw (retval));
> 
> We know val is allocated to be the length of subobj_type.
> We know retval is allocated to be the length of subobj_type.
> We know len is the length of subobj_type.
> We know slice only gives a view same size or smaller.
> 
> So, the source array_view length must be len - subobj_offset.
> 
> Therefore source array_view size will be of the length of subobj_type
> and match the destination only in the event that subobj_offset
> happens
> to be zero. The line above does not guarantee it:
> 
> subobj_offset += n - max;
> 
> So it looks broken for big endian systems. And maybe any subtype that
> is not the first element of a type on the others.
> 

My bad, val is allocated to be length of type.

So I'm wrong about all this and the code is fine :)


  reply	other threads:[~2022-08-20  1:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 11:24 Denis Lukianov
2022-08-18 16:27 ` Simon Marchi via Gdb-patches
2022-08-19 21:33   ` Denis Lukianov
2022-08-20  0:55     ` Simon Marchi via Gdb-patches
2022-08-20  1:38       ` Denis Lukianov
2022-08-20  1:55         ` Denis Lukianov [this message]
2022-08-21 14:17           ` Simon Marchi via Gdb-patches

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=a9b7f220b820a81381fbaa221d98e9eefb4eda8b.camel@voxelsoft.com \
    --to=denis@voxelsoft.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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