public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Specify pu_size initialization constant in more detail
@ 2020-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-14 11:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-01  0:00 [committed] Specify pu_size initialization constant in more detail Tom de Vries

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).