public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Specify pu_size initialization constant in more detail
Date: Wed, 01 Jan 2020 00:00:00 -0000	[thread overview]
Message-ID: <20200214113121.GA2990@delia> (raw)

Hi,

The variable pu_size in partition_dups_1 is initialized to constant 21.

Specify that constant in more detail.

Committed to trunk.

Thanks,
- Tom

Specify pu_size initialization constant in more detail

2020-02-14  Tom de Vries  <tdevries@suse.de>

	* dwz.c (partition_dups_1): Make initialization of pu_size to 21 more
	detailed.

---
 dwz.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/dwz.c b/dwz.c
index 0c13682..b469264 100644
--- a/dwz.c
+++ b/dwz.c
@@ -6899,7 +6899,34 @@ partition_dups_1 (dw_die_ref *arr, size_t vec_size,
       /* Estimated size of CU header and DW_TAG_partial_unit
 	 with DW_AT_stmt_list and DW_AT_comp_dir attributes
 	 21 (also child end byte).  */
-      size_t pu_size = 21;
+      size_t pu_size
+	= (/* CU Header: unit length (initial length).
+	      32-bit DWARF: 4 bytes, 64-bit DWARF: 12 bytes.  */
+	   4
+	   /* CU Header: version (uhalf).
+	      2 bytes.  */
+	   + 2
+	   /* CU Header: debug_abbrev_offset (section offset).
+	      32-bit DWARF: 4 bytes, 64-bit DWARF: 8 bytes.  */
+	   + 4
+	   /* CU Header: address_size (ubyte).
+	      1 byte.  */
+	   + 1
+	   /* CU Root DIE: abbreviation code (unsigned LEB128).
+	      1 or more bytes.  Optimistically assume 1.  */
+	   + 1
+	   /* CU Root DIE: DW_AT_stmt_list (lineptr).
+	      32-bit DWARF: 4 bytes, 64-bit DWARF: 8 bytes.  */
+	   + 4
+	   /* CU Root DIE: DW_AT_comp_dir (string).
+	      DW_FORM_strp: 32-bit DWARF: 4 bytes, 64-bit DWARF: 8 bytes.
+	      DW_FORM_string: 1 or more bytes.
+	      Assume 4 bytes.  */
+	   + 4
+	   /* CU root DIE children terminator: abbreviation code 0
+					       (unsigned LEB128).
+	      1 byte.  */
+	   + 1);
       /* DW_TAG_imported_unit with DW_AT_import attribute
 	 (5 or 9 bytes (the latter for DWARF2 and ptr_size 8)).  */
       size_t import_size

                 reply	other threads:[~2020-02-14 11:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200214113121.GA2990@delia \
    --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).