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 2/4] Handle DW_FORM_data16.
Date: Thu, 24 Sep 2020 21:43:33 +0200	[thread overview]
Message-ID: <20200924194333.GP2176@tucnak> (raw)
In-Reply-To: <20200924162557.15870-3-mark@klomp.org>

On Thu, Sep 24, 2020 at 06:25:55PM +0200, Mark Wielaard wrote:
> This is a simple form to handle, it just encodes 16 bytes of DIE data.
> 
> 	* dwz.c (read_abbrev): Accept DW_FORM_data16.
> 	(skip_attr_no_dw_form_indirect): Handle DW_FORM_data16.
> 	(checksum_die): Likewise.
> 	(checksum_ref_die): Likewise.
> 	(die_eq_1): Likewise.
> 	(mark_refs): Likewise.
> 	(read_debug_info): Likewise.
> 	(build_abbrevs_for_die): Likewise.
> 	(DW_FORM_ref_sig8): Likewise.
> ---
>  dwz.c | 28 +++++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/dwz.c b/dwz.c
> index 8291333..9719ee6 100644
> --- a/dwz.c
> +++ b/dwz.c
> @@ -1260,7 +1260,8 @@ read_abbrev (DSO *dso, unsigned char *ptr)
>  	  nattr++;
>  	  form = read_uleb128 (p);
>  	  if (form == 2
> -	      || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8))
> +	      || (form > DW_FORM_flag_present && (form != DW_FORM_ref_sig8
> +						  || form != DW_FORM_data16)))

This should have been changed to:
	      || (form > DW_FORM_ref_sig8 && form != DW_FORM_data16))
The point is that the code now handles everything up to DW_FORM_ref_sig8
inclusive except 2, and then DW_FORM_data16 with gaps in between.
>  	    {
>  	      error (0, 0, "%s: Unknown DWARF %s",
>  		     dso->filename, get_DW_FORM_str (form));
> @@ -1709,6 +1710,9 @@ skip_attr_no_dw_form_indirect (unsigned int cu_version, uint32_t form,
>      case DW_FORM_ref_sig8:
>        ptr += 8;
>        break;
> +    case DW_FORM_data16:
> +      ptr += 16;
> +      break;
>      case DW_FORM_sdata:
>      case DW_FORM_ref_udata:
>      case DW_FORM_udata:
> @@ -2975,6 +2979,9 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die)
>  	  die->die_no_multifile = 1;
>  	  ptr += 8;
>  	  break;
> +	case DW_FORM_data16:
> +	  ptr += 16;
> +	  break;

Also, wonder if DW_FORM_ref_sig8 has a separate case from DW_FORM_data8, if
it wouldn't be more readable to stick DW_FORM_data16 case below the
DW_FORM_data8 one.  When both are the same case, that isn't possible of
course.

Otherwise LGTM.

	Jakub


  reply	other threads:[~2020-09-24 19:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 16:25 Read and write DWARF5 units and forms Mark Wielaard
2020-09-24 16:25 ` [PATCH 1/4] Calculate size and write correct DWARF5 header Mark Wielaard
2020-09-24 19:39   ` Jakub Jelinek
2020-09-25 16:35     ` Mark Wielaard
2020-09-25 16:39       ` Jakub Jelinek
2020-09-24 16:25 ` [PATCH 2/4] Handle DW_FORM_data16 Mark Wielaard
2020-09-24 19:43   ` Jakub Jelinek [this message]
2020-09-24 21:53     ` Jakub Jelinek
2020-09-25 16:42     ` Mark Wielaard
2020-09-24 16:25 ` [PATCH 3/4] Handle DW_FORM_line_strp by not moving DIE Mark Wielaard
2020-09-24 19:45   ` Jakub Jelinek
2020-09-24 16:25 ` [PATCH 4/4] Handle DW_FORM_implicit_const [experiment] Mark Wielaard
2020-09-24 19:57   ` Jakub Jelinek

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=20200924194333.GP2176@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).