From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 03EE1386F0C4 for ; Thu, 30 Jun 2022 12:53:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 03EE1386F0C4 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-531-UN06E8tPPbac57wu0BBrIw-1; Thu, 30 Jun 2022 08:53:00 -0400 X-MC-Unique: UN06E8tPPbac57wu0BBrIw-1 Received: by mail-qk1-f200.google.com with SMTP id bk12-20020a05620a1a0c00b006b194656099so3163299qkb.5 for ; Thu, 30 Jun 2022 05:53:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:organization:date:message-id :user-agent:mime-version; bh=y0JvPbA9KkH8D2oG/A+E1fnRr0izMLZxyJ4B/Y+rgM8=; b=wxu9Srf+qPd6Emke3+aY35bXcqB9jedhjVGeb3fjHFnyUBd47uT19QGV5xhCulmD7m 68wveV8AuaQ91V6jjGGScd4a7V/+3ibMKONL1VzT3ZqZP65su4pEHA4VtnCEaJMHHZ4n m0W/s2afGfdPJSraP4gJc3ojjb4N+uWofMtiVScG4HHInQmslhusf7Qedvr17MPBJS04 0Cly2meEpZdzpfPKVIpBa9cAz3Fiaeht0OzZEVs/BZEuqrnoH0mouPWRbuJYKq2my3NO 9mAtkk5aEntfRsKe8bP8FLCTALiUpjlNYOaAnDZF6P+/XY1CSo+kkTuz52JeBTh47UBz 7FdA== X-Gm-Message-State: AJIora9JEzMz7DF9c4M1D3SWYFmHAIpTwc9CGbU5K0TdSvukwrVvyeaZ nYzFZGHtxFE/uHqCzpkNPh1NXPHX7j6IUdZtHvG+JJW98aMPb32O9BVzWg+BBEmlmv9glN04OHH ZMV6cMIpNxwIVqKQsqg20ppnEOUe7HMCf7RsvSu+SKN7gYiVXiz0WSvaXpPHx1flSOr/d X-Received: by 2002:ac8:7d8e:0:b0:31b:f615:2649 with SMTP id c14-20020ac87d8e000000b0031bf6152649mr7181717qtd.210.1656593579996; Thu, 30 Jun 2022 05:52:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1usatV5Ip6nBvFmrapWcZIVtjwxSz6bQxxixqaZS852Chvu3SOP5VPVuIdZfephv2g7PgB+NQ== X-Received: by 2002:ac8:7d8e:0:b0:31b:f615:2649 with SMTP id c14-20020ac87d8e000000b0031bf6152649mr7181689qtd.210.1656593579534; Thu, 30 Jun 2022 05:52:59 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id s9-20020ac85289000000b00304efba3d84sm12711644qtn.25.2022.06.30.05.52.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 05:52:59 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id CFEB25800FC; Thu, 30 Jun 2022 14:52:57 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applied] ir: Add some debugging facilities for the comparison machinery Organization: Red Hat / France X-Operating-System: Fedora 37 X-URL: http://www.redhat.com Date: Thu, 30 Jun 2022 14:52:57 +0200 Message-ID: <87bkuae2ja.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 12:53:03 -0000 Hello, When looking at something else, I felt the need to write the debugging facilities below to dump the content of the set of types being compared, to better understand why some comparison take more or less time. * src/abg-ir-priv.h: Include iostream to access std::cerr. (environment::priv::{dump_classes_being_compared, dump_fn_types_being_compared}): Define new member functions. * src/abg-ir.cc (dump_classes_being_compared) (dump_fn_types_being_compared): Define new functions. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-ir-priv.h | 43 +++++++++++++++++++++++++++++++++++++++++++ src/abg-ir.cc | 24 ++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/src/abg-ir-priv.h b/src/abg-ir-priv.h index 0a5ab00d..3d7f9cb0 100644 --- a/src/abg-ir-priv.h +++ b/src/abg-ir-priv.h @@ -14,6 +14,7 @@ #define __ABG_IR_PRIV_H__ #include +#include #include "abg-ir.h" #include "abg-corpus.h" @@ -546,6 +547,48 @@ struct environment::priv clear_type_comparison_results_cache() {type_comparison_results_cache_.clear();} + /// Dumps a textual representation (to the standard error output) of + /// the content of the set of classes being currently compared using + /// the @ref equal overloads. + /// + /// This function is for debugging purposes. + void + dump_classes_being_compared() + { + std::cerr << "classes being compared: " << classes_being_compared_.size() + << "\n" + << "=====================================\n"; + for (auto& p : classes_being_compared_) + { + class_or_union* c = reinterpret_cast(p.first); + std::cerr << "'" << c->get_pretty_representation() + << " / (" << std::hex << p.first << "," << p.second << ")" + << "'\n"; + } + std::cerr << "=====================================\n"; + } + + /// Dumps a textual representation (to the standard error output) of + /// the content of the set of classes being currently compared using + /// the @ref equal overloads. + /// + /// This function is for debugging purposes. + void + dump_fn_types_being_compared() + { + std::cerr << "fn_types being compared: " << fn_types_being_compared_.size() + << "\n" + << "=====================================\n"; + for (auto& p : fn_types_being_compared_) + { + function_type* c = reinterpret_cast(p.first); + std::cerr << "'" << c->get_pretty_representation() + << " / (" << std::hex << p.first << "," << p.second << ")" + << "'\n"; + } + std::cerr << "=====================================\n"; + } + /// Push a pair of operands on the stack of operands of the current /// type comparison, during type canonicalization. /// diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 7a5db60f..9bbe99f2 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -21429,6 +21429,30 @@ class_or_union::operator==(const class_or_union& other) const return class_or_union::operator==(o); } +/// Dumps a textual representation (to the standard error output) of +/// the content of the set of classes being currently compared using +/// the @ref equal overloads. +/// +/// This function is for debugging purposes. +/// +/// @param c an artifact that belongs to the environment in which the +/// classes of interest are being compared. +void +dump_classes_being_compared(const type_or_decl_base& c) +{c.get_environment()->priv_->dump_classes_being_compared();} + +/// Dumps a textual representation (to the standard error output) of +/// the content of the set of function types being currently compared +/// using the @ref equal overloads. +/// +/// This function is for debugging purposes. +/// +/// @param c an artifact that belongs to the environment in which the +/// function types of interest are being compared. +void +dump_fn_types_being_compared(const type_or_decl_base& t) +{t.get_environment()->priv_->dump_fn_types_being_compared();} + /// Compares two instances of @ref class_or_union. /// /// If the two intances are different, set a bitfield to give some -- 2.36.1 -- Dodji