From patchwork Thu Sep 7 13:38:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 75433 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA2F8385841D for ; Thu, 7 Sep 2023 13:38:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA2F8385841D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694093908; bh=H3SqgErs8XXxyslC9uCmdkg4iHa8uzRJAbAP4NodK0w=; h=To:Cc:Subject:References:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=IksE4H5Sw1hkn0M312an1f25JgQqL5YhBMj7xioAX9EgNBVnrtDgc2AFt2IVdM+Pd yzYGXogscS/fjXXS8i72tMIq35zLKrsKqHyph7bMMwq2gQMjMz5ouyjcf42EQ+xRUn +UiZh8XqKpHMWkuRDhixEDHsR3fHyEkwyQACIZ0s= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org 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 0A3B73858D1E for ; Thu, 7 Sep 2023 13:38:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A3B73858D1E Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-rHezVlSSPp299DYObq4_oA-1; Thu, 07 Sep 2023 09:38:20 -0400 X-MC-Unique: rHezVlSSPp299DYObq4_oA-1 Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-3a78c2cdd77so1020581b6e.1 for ; Thu, 07 Sep 2023 06:38:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093899; x=1694698699; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H3SqgErs8XXxyslC9uCmdkg4iHa8uzRJAbAP4NodK0w=; b=WEVdPQ+Ap8CJPoDkbn5hSRvOn/ZsHL7Q6LKbtJp1F4qkLBOWYKcbc/HyUuJ1ZvQgNA YppaTMRJNBC5agkhoj4EyI5HatvgzAkcP+ywd4trb+/H3xj9+FuRPn/2ABD+UonBuAQa ovuBibLgDTzqVPAowHuGSE+KBUvwmAa9NhmaCQVmUoqzdojNj9AABUVaSqIeU28ZuoY6 N1+btqIYnaaCre9heJqj54O75FtBBprz0M9BsD5/adOOczhG3cPzqaH20Qxmud2F0nF5 XOZfWSkn/BAiOvJ66H0BSyOL2jkNZYO3dOOHhM7YPm0Ls+GKu+7dtjQuNlOjVOw4E2ed rWXQ== X-Gm-Message-State: AOJu0YwuJPkzXsu8Hx5FP6YlZeKCEpINClrrfcWkSej6rDGXNa4YdLdg Kzoc4izbKleLFl2Dk7/WftWJ8vQfaBk8e+q5Fx3BACov+vk3C+IolNMglRBrH0sQl35K7d53h4/ zXMfeFfByWULoJHmfZkVY X-Received: by 2002:aca:1c0c:0:b0:3a3:f92c:3f38 with SMTP id c12-20020aca1c0c000000b003a3f92c3f38mr20293602oic.6.1694093899451; Thu, 07 Sep 2023 06:38:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECbjTh7qXHuIyPb3vB+Q8nd/Y34gRcqyhu4G/uJz4/Khj89Y1jN8+w76nqSsF130L87DuNPQ== X-Received: by 2002:aca:1c0c:0:b0:3a3:f92c:3f38 with SMTP id c12-20020aca1c0c000000b003a3f92c3f38mr20293590oic.6.1694093899118; Thu, 07 Sep 2023 06:38:19 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id p8-20020a05620a132800b00767177a5bebsm5741652qkj.56.2023.09.07.06.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:18 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id B3AC3B4FD2; Thu, 7 Sep 2023 15:38:16 +0200 (CEST) To: Dodji Seketeli Cc: libabigail@sourceware.org Subject: [PATCH 03/16] dwarf-reader,ir: Make logging a property of the middle end Organization: Red Hat / France References: <87il8mglc1.fsf@redhat.com> X-Operating-System: CentOS Stream release 9 X-URL: http://www.redhat.com Date: Thu, 07 Sep 2023 15:38:16 +0200 In-Reply-To: <87il8mglc1.fsf@redhat.com> (Dodji Seketeli's message of "Thu, 07 Sep 2023 15:32:46 +0200") Message-ID: <874jk6gl2v.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_WEB, SPF_HELO_NONE, SPF_NONE, TXREP 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.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Hello, Add a "do-log" property to the abigail::ir::environment::priv. That way, we can log finer grain time stamps during type canonicalization. This is useful for debugging. * src/abg-dwarf-reader.cc (reader::read_debug_info_into_corpus): Set the do_log property on the environment from the do_log property of the reader. * src/abg-ir-priv.h (environment::priv::do_log_): New data member. (environment::priv::priv): Initialize it. (environment::priv::do_log): Define new accessor method. (canonicalize_types): Add logging. * src/abg-ir.cc (canonicalize): Add logging to time the canonicalization of each type. Signed-off-by: Dodji Seketeli Applied to master. --- src/abg-dwarf-reader.cc | 2 ++ src/abg-ir-priv.h | 21 ++++++++++++++++++--- src/abg-ir.cc | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index c20cf16b..180c1ade 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -2154,6 +2154,8 @@ public: env().set_self_comparison_debug_input(corpus()); #endif + env().priv_->do_log(do_log()); + // Walk all the DIEs of the debug info to build a DIE -> parent map // useful for get_die_parent() to work. { diff --git a/src/abg-ir-priv.h b/src/abg-ir-priv.h index fe5a36cf..d0a0c48f 100644 --- a/src/abg-ir-priv.h +++ b/src/abg-ir-priv.h @@ -494,6 +494,7 @@ struct environment::priv bool decl_only_class_equals_definition_; bool use_enum_binary_only_equality_; bool allow_type_comparison_results_caching_; + bool do_log_; optional analyze_exported_interfaces_only_; #ifdef WITH_DEBUG_SELF_COMPARISON bool self_comparison_debug_on_; @@ -520,7 +521,8 @@ struct environment::priv do_on_the_fly_canonicalization_(true), decl_only_class_equals_definition_(false), use_enum_binary_only_equality_(true), - allow_type_comparison_results_caching_(false) + allow_type_comparison_results_caching_(false), + do_log_(false) #ifdef WITH_DEBUG_SELF_COMPARISON , self_comparison_debug_on_(false) @@ -553,6 +555,14 @@ struct environment::priv allow_type_comparison_results_caching() const {return allow_type_comparison_results_caching_;} + void + do_log(bool f) + {do_log_ = f;} + + bool + do_log() const + {return do_log_;} + /// Cache the result of comparing two sub-types. /// /// @param first the first sub-type that has been compared. Its @@ -1321,8 +1331,13 @@ canonicalize_types(const input_iterator& begin, return; // First, let's compute the canonical type of this type. - for (auto t = begin; t != end; ++t) - canonicalize(deref(t)); + for (auto t = begin, i = 0; t != end; ++t, ++i) + { + if (deref(t)->get_environment().priv_->do_log()) + std::cerr << "#" << std::dec << i << " "; + + canonicalize(deref(t)); + } #ifdef WITH_DEBUG_CT_PROPAGATION // Then now, make sure that all types -- which propagated canonical diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 999fabcb..b33d6d68 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -15039,7 +15039,23 @@ canonicalize(type_base_sptr t) if (t->get_canonical_type()) return t->get_canonical_type(); + if (t->get_environment().priv_->do_log()) + std::cerr << "Canonicalization of type '" + << t->get_pretty_representation(true, true) + << "/@#" << std::hex << t.get() << ": "; + + tools_utils::timer tmr; + + if (t->get_environment().priv_->do_log()) + tmr.start(); type_base_sptr canonical = type_base::get_canonical_type_for(t); + + if (t->get_environment().priv_->do_log()) + tmr.stop(); + + if (t->get_environment().priv_->do_log()) + std::cerr << tmr << "\n"; + maybe_adjust_canonical_type(canonical, t); t->priv_->canonical_type = canonical;