public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: dwz@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH 2/4] Handle DW_FORM_data16.
Date: Thu, 24 Sep 2020 18:25:55 +0200	[thread overview]
Message-ID: <20200924162557.15870-3-mark@klomp.org> (raw)
In-Reply-To: <20200924162557.15870-1-mark@klomp.org>

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)))
 	    {
 	      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;
 	case DW_FORM_sdata:
 	case DW_FORM_udata:
 	  skip_leb128 (ptr);
@@ -3394,6 +3401,9 @@ checksum_ref_die (dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die,
 	    case DW_FORM_ref_sig8:
 	      ptr += 8;
 	      break;
+	    case DW_FORM_data16:
+	      ptr += 16;
+	      break;
 	    case DW_FORM_sdata:
 	    case DW_FORM_udata:
 	      skip_leb128 (ptr);
@@ -4214,6 +4224,10 @@ die_eq_1 (dw_cu_ref cu1, dw_cu_ref cu2,
 	  ptr1 += 8;
 	  ptr2 += 8;
 	  break;
+	case DW_FORM_data16:
+	  ptr1 += 16;
+	  ptr2 += 16;
+	  break;
 	case DW_FORM_sdata:
 	case DW_FORM_udata:
 	  skip_leb128 (ptr1);
@@ -5295,6 +5309,9 @@ mark_refs (dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die, int mode)
 	    case DW_FORM_ref_sig8:
 	      ptr += 8;
 	      break;
+	    case DW_FORM_data16:
+	      ptr += 16;
+	      break;
 	    case DW_FORM_sdata:
 	    case DW_FORM_udata:
 	      skip_leb128 (ptr);
@@ -6270,6 +6287,9 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count)
 		case DW_FORM_ref_sig8:
 		  ptr += 8;
 		  break;
+		case DW_FORM_data16:
+		  ptr += 16;
+		  break;
 		case DW_FORM_sdata:
 		case DW_FORM_udata:
 		  if (lang_p
@@ -9941,6 +9961,9 @@ build_abbrevs_for_die (htab_t h, dw_cu_ref cu, dw_die_ref die,
 		case DW_FORM_ref_sig8:
 		  ptr += 8;
 		  break;
+		case DW_FORM_data16:
+		  ptr += 16;
+		  break;
 		case DW_FORM_sdata:
 		case DW_FORM_udata:
 		  skip_leb128 (ptr);
@@ -11481,6 +11504,9 @@ write_die (unsigned char *ptr, dw_cu_ref cu, dw_die_ref die,
 	    case DW_FORM_ref_sig8:
 	      inptr += 8;
 	      break;
+	    case DW_FORM_data16:
+	      inptr += 16;
+	      break;
 	    case DW_FORM_sdata:
 	    case DW_FORM_udata:
 	      skip_leb128 (inptr);
-- 
2.18.4


  parent reply	other threads:[~2020-09-24 16:26 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 ` Mark Wielaard [this message]
2020-09-24 19:43   ` [PATCH 2/4] Handle DW_FORM_data16 Jakub Jelinek
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=20200924162557.15870-3-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=dwz@sourceware.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).