From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89551 invoked by alias); 14 Feb 2020 11:31:27 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 88916 invoked by uid 89); 14 Feb 2020 11:31:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx2.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Wed, 01 Jan 2020 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Specify pu_size initialization constant in more detail Message-ID: <20200214113121.GA2990@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2020-q1/txt/msg00070.txt 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 * 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