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

On Thu, Feb 18, 2021 at 02:40:36PM +0100, Mark Wielaard wrote:
> On Sat, 2021-02-13 at 23:46 +0100, Mark Wielaard wrote:
> > Since DWARF version 4 blocks just contain bytes, trying to interpret
> > them as exprlocs will most likely fail.
> > 
> >      * dwz.c (add_locexpr_dummy_dies): Only handle block as exprloc
> >      for cu_version < 4.
> >      (checksum_die): Likewise.
> >      (write_die): Likewise.
> > 
> > https://sourceware.org/bugzilla/show_bug.cgi?id=26987
> 
> Ping. Any comments?

Doing some GCC archeology if it is safe, I think it principially ok, but I'd
like slightly different patch, see below.
While -gdwarf-4 support has been added in
https://gcc.gnu.org/r0-96109-g15b3fbeb7e97f2ca3731881bf3a0f899ec56ebbf
during GCC 4.5 development, it was still emitting DWARF 3 .debug_info
headers and not using DW_FORM_exprloc.
DW_FORM_exprloc came with:
https://gcc.gnu.org/r0-99103-g290d8971e6e3b784a88b5c4b6b91b8d77552cb3a
and DWARF version .debug_info header changed from 3 to 4 for -gdwarf-4
a day after that:
https://gcc.gnu.org/r0-99139-g2f43d500a6769e563fb8f645e7530c2f144d7023

> > +++ b/dwz.c
> > @@ -2913,43 +2913,44 @@ add_locexpr_dummy_dies (DSO *dso, dw_cu_ref
> > cu, dw_die_ref die,
> >    if (form == DW_FORM_block1)
> >      {
> >        /* Old DWARF uses blocks instead of exprlocs.  */

Instead of reindenting everything, can't you simply change
-  if (form == DW_FORM_block1)
+  if (form == DW_FORM_block1 && cu->cu_version < 4)

> >        if (form == DW_FORM_block1)

And likewise here:
-      if (form == DW_FORM_block1)
+      if (form == DW_FORM_block1 && cu->cu_version < 4)

> > @@ -12392,7 +12394,7 @@ write_die (unsigned char *ptr, dw_cu_ref cu,
> > dw_die_ref die,
> >  	  ptr += inptr - orig_ptr;
> >  
> >  	  /* Old DWARF uses blocks instead of exprlocs.  */
> > -	  if (form == DW_FORM_block1)
> > +	  if (form == DW_FORM_block1 && cu->cu_version < 4)

Like you've done it here?

> >  	    switch (reft->attr[i].attr)
> >  	      {
> >  	      case DW_AT_frame_base:

	Jakub


  reply	other threads:[~2021-02-18 14:09 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 [this message]
2021-02-18 16:18     ` Mark Wielaard
2021-02-18 16:59       ` Jakub Jelinek
2021-02-18 17:32         ` Jakub Jelinek
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=20210218140947.GG4020736@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).