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 451D5385736D for ; Tue, 7 Jun 2022 20:00:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 451D5385736D Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-Z_4kC6rnOCa8aqO6TValzQ-1; Tue, 07 Jun 2022 16:00:38 -0400 X-MC-Unique: Z_4kC6rnOCa8aqO6TValzQ-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 83C7029A9D2A for ; Tue, 7 Jun 2022 20:00:37 +0000 (UTC) Received: from blarsen.com (ovpn-116-38.gru2.redhat.com [10.97.116.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D23FB404E4B3; Tue, 7 Jun 2022 20:00:36 +0000 (UTC) From: Bruno Larsen To: gdb-patches@sourceware.org Subject: [PATCH] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation Date: Tue, 7 Jun 2022 16:54:53 -0300 Message-Id: <20220607195452.40555-1-blarsen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.3 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, 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: Tue, 07 Jun 2022 20:00:43 -0000 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. --- 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" + +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" + +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