From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48975 invoked by alias); 9 Dec 2019 11:47:21 -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 48853 invoked by uid 89); 9 Dec 2019 11:47:20 -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.2 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=ordered, namespaces X-Spam-Status: No, score=-25.2 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: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Add --devel-verify-dups Message-ID: <20191209114714.GA20155@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: 2019-q4/txt/msg00123.txt.bz2 Hi, Add developer option --devel-verify-dups to verify duplicate chains. Committed to trunk. Thanks, - Tom Add --devel-verify-dups 2019-12-07 Tom de Vries * dwz.c (verify_dups_p): New variable. (verify_dups): New function. (partition_find_dups, partition_dups_1): Call verify_dups. --- dwz.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dwz.c b/dwz.c index 313c317..1ef65e1 100644 --- a/dwz.c +++ b/dwz.c @@ -160,12 +160,14 @@ static int ignore_size; static int ignore_locus; static int dump_dies_p; static int dump_dups; +static int verify_dups_p; #else #define tracing 0 #define ignore_size 0 #define ignore_locus 0 #define dump_dies_p 0 #define dump_dups 0 +#define verify_dups_p 0 #endif static int unoptimized_multifile; static int save_temps = 0; @@ -4083,6 +4085,28 @@ calc_sizes (dw_die_ref die) return ret; } +/* Verify the duplicate chains starting at DIE. If ORDERED, also check that + the duplicate chain is in the correct order. */ +static void +verify_dups (dw_die_ref die, bool ordered) +{ + dw_die_ref d, prev; + + assert (die->die_dup == NULL); + + for (prev = die, d = prev->die_nextdup; + d; + prev = d, d = prev->die_nextdup) + { + if (ordered) + assert (die_cu (prev)->cu_chunk <= die_cu (d)->cu_chunk); + assert (d->die_offset != -1U); + assert (d->die_dup == die); + assert (d->die_remove != d->die_op_type_referenced); + assert (d->die_tag == die->die_tag); + } +} + /* Walk toplevel DIEs in tree rooted by PARENT, and see if they match previously processed DIEs. */ static int @@ -5983,6 +6007,8 @@ partition_find_dups (struct obstack *vec, dw_die_ref parent) } child->die_nextdup = prev; obstack_ptr_grow (vec, child); + if (unlikely (verify_dups_p)) + verify_dups (child, true); if (dump_dups) { fprintf (stderr, "duplicate chain:\n"); @@ -6208,6 +6234,8 @@ partition_dups_1 (dw_die_ref *arr, size_t vec_size, child = copy_die_tree (die, arr[k]); for (ref = arr[k]->die_nextdup; ref; ref = ref->die_nextdup) ref->die_dup = child; + if (unlikely (verify_dups_p)) + verify_dups (child, true); if (namespaces) { for (ref = arr[k]->die_parent;