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.133.124]) by sourceware.org (Postfix) with ESMTPS id 35831385700D for ; Wed, 26 Oct 2022 12:35:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 35831385700D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666787739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=u18IpaW0yu4bQblCP13P4LwE8OHkjmS0wKWnH09tmg4=; b=cuOxNlVQbde+4xyRMZoT0b2izPPoqhuDsqeLg6fBbaHhCk+5mBtS7NBYu0oJk5V9RKWJ7R vWbVmPPgyH/v9ryiBKD+Y1oWJeAX5ltOa/Jy0kVS/sUOXrTWi8U/QJLwF7PfGpVzJ/IqJZ d/KjUuCmuQaUoCre2QPrpNI9mSdYpAM= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-648-b9yTShW0MoqAKVlt-SbN2A-1; Wed, 26 Oct 2022 08:35:38 -0400 X-MC-Unique: b9yTShW0MoqAKVlt-SbN2A-1 Received: by mail-wr1-f70.google.com with SMTP id s11-20020adfbc0b000000b0023659af24a8so5224839wrg.14 for ; Wed, 26 Oct 2022 05:35:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u18IpaW0yu4bQblCP13P4LwE8OHkjmS0wKWnH09tmg4=; b=miOAYGkCa2SCEynIonQIiR3cBe/RlMkWelUoJKeA3uz+oQBBjtSXXlhAAd9uvWW9XS UfzEjwBiFvm7ZGSo7Hb6AGBS4357I/O0pdig5ZOheyQty4e5FM1P4Vd0Kf7m8XSOQBNA agwvbOz97xJDFE0Y8DRYcUeKK22pCUgldlUf4FtWV0gMGYd01LjdeErd1aoMP+W5n/XI EMTIv1bfwMQO+LfwvKQtoNBBkV6/px2zrxS453aXIRGFJHWF/OgXsrNmN/lvFBfjP8k1 I0u0heq+G6bHDhQVY7BEw0V/uh1l8XvXIdiPRpz0mQM5EnavA3GEAFiLi/unsCXlLfHu SABg== X-Gm-Message-State: ACrzQf3K9sdgJ8EULdOb3mWxjX6spDz92t9ZGEgLWlP+iYG4qt0PNY1V oyE0fWV0wTzSD6qWAzHHm5RV0QVFA1HYeWXe5bPt4kDUSE09/9DlK6VQ9RcaiRH322cFRLlcsbO z/ESchAzPYrAa5BaGZRekwg== X-Received: by 2002:a05:600c:4448:b0:3c6:fb65:2497 with SMTP id v8-20020a05600c444800b003c6fb652497mr2319182wmn.124.1666787737365; Wed, 26 Oct 2022 05:35:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QCQMtAA4zvPK/krEIxni7EOGB2qO18g2OuppZOS4F4PdCoYbbIyz/JwaJ/HOLikaBBsugWw== X-Received: by 2002:a05:600c:4448:b0:3c6:fb65:2497 with SMTP id v8-20020a05600c444800b003c6fb652497mr2319172wmn.124.1666787737180; Wed, 26 Oct 2022 05:35:37 -0700 (PDT) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id o16-20020a5d58d0000000b0023662d97130sm5098793wrf.20.2022.10.26.05.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 05:35:36 -0700 (PDT) From: Andrew Burgess To: Bruno Larsen , gdb-patches@sourceware.org Subject: Re: [PATCH 03/11] gdb/testsuite: account for clang's recursive destructor calls on gdb.cp/mb-ctor.exp In-Reply-To: <20221004170747.154307-4-blarsen@redhat.com> References: <20221004170747.154307-1-blarsen@redhat.com> <20221004170747.154307-4-blarsen@redhat.com> Date: Wed, 26 Oct 2022 13:35:35 +0100 Message-ID: <87bkpy7ofc.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.8 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_H2,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 List-Id: Bruno Larsen via Gdb-patches writes: > When compiling virtual classes's destructors, two versions are compiled, > one with a single parameter (this) and the other with 2 parameters (this > and vtt). > > GCC's compilation makes it so either the version with 1 > parameter or the one with 2 parameters is called, depending on whether > the destructor is being called by the class itself or by an inherited > class. On the test gdb.cp/mb-ctor.exp, this means that the breakpoint > set at the destructor will be hit 4 times. > > Clang, on the other hand, makes the single-parameter version call the 2 > parameter version, probably in an attempt to reduce the size of the > resulting executable. This means that the gdb.cp/mb-ctor.exp will hit 6 > breakpoints before finishing, and is the reason why this test was > failing. To make this test stop failing, a compiler check is added and > another "continue" instruction is issued to account for this difference. > --- > gdb/testsuite/gdb.cp/mb-ctor.exp | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp > index 5a3c0a4a90f..6aadecdd27d 100644 > --- a/gdb/testsuite/gdb.cp/mb-ctor.exp > +++ b/gdb/testsuite/gdb.cp/mb-ctor.exp > @@ -25,6 +25,12 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} { > return -1 > } > > +if {[test_compiler_info {clang-*-*}]} { Include c++ language for test_compiler_info call (see previous patch for details). > + set using_clang true > +} else { > + set using_clang false > +} > + > if ![runto_main] then { > perror "couldn't run to breakpoint" > return > @@ -71,6 +77,12 @@ gdb_continue_to_breakpoint "set breakpoint here, second dynamic time"\ > > gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v1" > > +# Clang makes Derived::~Derived(this) call Derived::~Derives(this, vtt) > +# whereas gcc puts all the logic necessary on both functions. > +if {$using_clang} { > + gdb_test "continue" ".*Breakpoint.*~Derived.*" "clang's recursive dynamic destructor call" There lines are a little long, and should be wrapped. Also, I'm not sure I agree with the use of 'recursive' here. Maybe 'nested' would be better? When I think recursive, I think of functions that directly, or indirectly, call themselves. Though the two destructors do have the same name, I don't think they are the same function. > +} > + > gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v2" > > gdb_test "continue" \ > @@ -81,6 +93,10 @@ gdb_test "continue" \ > ".*Breakpoint.*~Derived.*" \ > "run to breakpoint 3 v2" > > +if {$using_clang} { > + gdb_test "continue" ".*Breakpoint.*~Derived.*" "clang's recursive destructor call" > +} Same again. Thanks, Andrew > + > gdb_test "continue" \ > ".*exited normally.*" \ > "run to exit" > -- > 2.37.3