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 12C22383F966 for ; Thu, 30 Jun 2022 17:14:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 12C22383F966 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-645-4I1I6uFzN-Ku1iZ8gDb3yQ-1; Thu, 30 Jun 2022 13:14:32 -0400 X-MC-Unique: 4I1I6uFzN-Ku1iZ8gDb3yQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D796C85A582 for ; Thu, 30 Jun 2022 17:14:30 +0000 (UTC) Received: from [10.97.116.55] (ovpn-116-55.gru2.redhat.com [10.97.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A70740D2962; Thu, 30 Jun 2022 17:14:30 +0000 (UTC) Message-ID: <4289e2f9-e8a6-21ef-7596-90ecf939dac7@redhat.com> Date: Thu, 30 Jun 2022 14:14:28 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation To: Andrew Burgess , gdb-patches@sourceware.org References: <20220607195452.40555-1-blarsen@redhat.com> <877d4ycjmf.fsf@redhat.com> From: Bruno Larsen In-Reply-To: <877d4ycjmf.fsf@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 17:14:36 -0000 thanks, pushed! Cheers! Bruno Larsen On 6/30/22 11:26, Andrew Burgess wrote: > Bruno Larsen via Gdb-patches writes: > >> When testing GDB's ability to stop in constructors, gdb.cp/mb-ctor.exp >> only tested objects allocated on the stack. This commit adds a couple of >> dynamic allocations and tests if GDB can stop in it as well. >> --- >> >> This was inspired by an outstanding patch in Fedora's GDB tree. I'm not >> sure if it is different enough to warrant testing, but I don't think it >> would hurt either. > > I agree that it can't hurt to include this additional testing. The > patch looks good, with a minor nit fixed... > >> >> --- >> gdb/testsuite/gdb.cp/mb-ctor.cc | 6 ++++++ >> gdb/testsuite/gdb.cp/mb-ctor.exp | 16 ++++++++++++++++ >> 2 files changed, 22 insertions(+) >> >> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.cc b/gdb/testsuite/gdb.cp/mb-ctor.cc >> index c54b4fece48..faa59f16459 100644 >> --- a/gdb/testsuite/gdb.cp/mb-ctor.cc >> +++ b/gdb/testsuite/gdb.cp/mb-ctor.cc >> @@ -64,5 +64,11 @@ int main() >> DeeplyDerived's ctor. */ >> DeeplyDerived dd(15); >> >> + Derived *dyn_d = new Derived (24); >> + DeeplyDerived *dyn_dd = new DeeplyDerived (42); >> + >> + delete dyn_d; >> + delete dyn_dd; >> + >> return 0; >> } >> diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp >> index cf22be9caa8..4b445635205 100644 >> --- a/gdb/testsuite/gdb.cp/mb-ctor.exp >> +++ b/gdb/testsuite/gdb.cp/mb-ctor.exp >> @@ -59,6 +59,22 @@ gdb_test "continue" \ >> >> gdb_continue_to_breakpoint "set breakpoint here, second time" ".* breakpoint here" >> >> +gdb_test "continue" \ >> + ".*Breakpoint.*Derived.*i=24.*" \ >> + "run to breakpoint 1 dynamic v1" >> + >> +gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" ".* breakpoint here" > > This line is too long, and can be split like: > > gdb_continue_to_breakpoint "set breakpoint here, first dynamic time" \ > ".* breakpoint here" > >> + >> +gdb_test "continue" \ >> + ".*Breakpoint.*Derived.*i=42.*" \ >> + "run to breakpoint 1 dynamic v2" >> + >> +gdb_continue_to_breakpoint "set breakpoint here, second dynamic time" ".* breakpoint here" > > And again here. > > With those fixed, please feel free to apply this patch. > > Thanks, > Andrew > >> + >> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v1" >> + >> +gdb_test "continue" ".*Breakpoint.*~Derived.*" "Run to dynamic destructor v2" >> + >> gdb_test "continue" \ >> ".*Breakpoint.*~Derived.*" \ >> "run to breakpoint 3 v1" >> -- >> 2.31.1 >