public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: jakub@redhat.com
Cc: dwz@sourceware.org
Subject: [PRING][PATCH][low-mem] Fix DW_OP_GNU_parameter_ref handling in read_exprloc
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <883e82a2-89d8-79c4-4c18-f1f8701b7383@suse.de> (raw)
In-Reply-To: <20190214093832.GA22005@delia>

On 14-02-19 10:38, Tom de Vries wrote:
> Hi,
> 
> Function read_exprloc contains a loop that marks all parents of a
> DW_OP_GNU_parameter_ref reference with CK_BAD.  The loop however has no
> private loop variable, so the ref variable, initially pointing to the
> referenced DIE, ends up after the loop pointing to the root parent of the
> reference instead.  Consequently, the code after the loop, intended to be
> executed for the referenced DIE, is instead executed for the root parent of
> the referenced DIE.
> 
> Fix this by moving the loop alap.
> 
> OK for trunk?
> 

Ping.

[ This fixes an assert triggered on a cc1 executable generated by gcc
bootstrap-lto:
...
$ dwz cc1
dwz: dwz.c:8562: adjust_exprloc: Assertion `refd != NULL &&
!refd->die_remove' failed.
... ]

Thanks,
- Tom

> [low-mem] Fix DW_OP_GNU_parameter_ref handling in read_exprloc
> 
> 2019-02-14  Tom de Vries  <tdevries@suse.de>
> 
> 	PR dwz/24195
> 	* dwz.c (read_exprloc): Move loop marking parents with CK_BAD alap.
> 
> ---
>  dwz.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/dwz.c b/dwz.c
> index d348418..6e6b6fb 100644
> --- a/dwz.c
> +++ b/dwz.c
> @@ -1492,6 +1492,15 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len,
>  	    }
>  	  if (op == DW_OP_call2)
>  	    ref->die_op_call2_referenced = 1;
> +	  if (unlikely (low_mem))
> +	    {
> +	      ref->die_referenced = 1;
> +	      /* As .debug_loc adjustment is done after
> +		 write_info finishes, we need to keep the referenced
> +		 DIEs around uncollapsed.  */
> +	      if (need_adjust)
> +		ref->die_intercu_referenced = 1;
> +	    }
>  	  if (ref->die_ck_state == CK_KNOWN)
>  	    {
>  	      ref->die_ck_state = CK_BAD;
> @@ -1504,15 +1513,6 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len,
>  	    }
>  	  else
>  	    ref->die_ck_state = CK_BAD;
> -	  if (unlikely (low_mem))
> -	    {
> -	      ref->die_referenced = 1;
> -	      /* As .debug_loc adjustment is done after
> -		 write_info finishes, we need to keep the referenced
> -		 DIEs around uncollapsed.  */
> -	      if (need_adjust)
> -		ref->die_intercu_referenced = 1;
> -	    }
>  	  die->die_ck_state = CK_BAD;
>  	  if (need_adjust)
>  	    *need_adjust = true;
> 

      parent reply	other threads:[~2019-03-07 13:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01  0:00 [PATCH][low-mem] " Tom de Vries
2019-01-01  0:00 ` Tom de Vries
2019-01-01  0:00 ` Tom de Vries [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=883e82a2-89d8-79c4-4c18-f1f8701b7383@suse.de \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.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).