public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Mark Wielaard <mark@klomp.org>, dwz@sourceware.org
Subject: Re: [PATCH] Don't handle blocks as exprlocs for DWARF version 4 or higher.
Date: Thu, 18 Feb 2021 18:32:55 +0100	[thread overview]
Message-ID: <20210218173255.GK4020736@tucnak> (raw)
In-Reply-To: <20210218165940.GJ4020736@tucnak>

On Thu, Feb 18, 2021 at 05:59:40PM +0100, Jakub Jelinek via Dwz wrote:
> Anyway, looking around some more,
>               if (unlikely (low_mem_phase1)
>                   && add_locexpr_dummy_dies (dso, cu, die, ptr, form,
>                                              t->attr[i].attr, len))
>                   goto fail;
> looks incorrect to me, form in that case will be DW_FORM_block{2,4,}
> and won't be canonicalized to DW_FORM_block1.  And furthermore
> len will be always 0.  It is preceded only by
>               size_t len = 0;
> and a loop handling DW_FORM_indirect.  So, ptr will always be
> the pointer to the block count too.

Another possibility would be (if we don't want to slow down non-low mem
case) to just repeat that
> 	      switch (form)
> 		{
> 		case DW_FORM_block1:
> 		  len = *ptr++;
> 		  break;
> 		case DW_FORM_block2:
> 		  len = read_16 (ptr);
> 		  form = DW_FORM_block1;
> 		  break;
> 		case DW_FORM_block4:
> 		  len = read_32 (ptr);
> 		  form = DW_FORM_block1;
> 		  break;
> 		case DW_FORM_block:
> 		  len = read_uleb128 (ptr);
> 		  form = DW_FORM_block1;
> 		  break;
> 		case DW_FORM_exprloc:
> 		  len = read_uleb128 (ptr);
> 		  break;
> 		default:
> 		  break;
> 		}
at the start of add_locexpr_dummy_dies (and not pass len to that function
and have it instead as a local var.  Perhaps even by doing:
  size_t len = 0;
  if (cu->cu_version < 4)
    {
      switch (form)
	{
	... // the above switch without DW_FORM_exprloc in there
	}
      if (form == DW_FORM_block1)
	...
    }

  if (form == DW_FORM_exprloc)
    {
      len = read_uleb128 (ptr);
      return read_exprloc_low_mem_phase1 (dso, die, ptr, len);
    }

...

	Jakub


  reply	other threads:[~2021-02-18 17:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-13 22:46 Mark Wielaard
2021-02-18 13:40 ` Mark Wielaard
2021-02-18 14:09   ` Jakub Jelinek
2021-02-18 16:18     ` Mark Wielaard
2021-02-18 16:59       ` Jakub Jelinek
2021-02-18 17:32         ` Jakub Jelinek [this message]
2021-02-18 20:01         ` Mark Wielaard
2021-02-18 20:06           ` Jakub Jelinek
2021-02-18 21:17             ` Mark Wielaard

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=20210218173255.GK4020736@tucnak \
    --to=jakub@redhat.com \
    --cc=dwz@sourceware.org \
    --cc=mark@klomp.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).