From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7862) id 5E9D4383F967; Thu, 30 Jun 2022 17:14:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E9D4383F967 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Bruno Larsen To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation X-Act-Checkin: binutils-gdb X-Git-Author: Bruno Larsen X-Git-Refname: refs/heads/master X-Git-Oldrev: aa40d66bb18c7aa068179f42de52327a0711834e X-Git-Newrev: 0b1505c82dc5bb593608bb72c1db0496088f2d25 Message-Id: <20220630171413.5E9D4383F967@sourceware.org> Date: Thu, 30 Jun 2022 17:14:13 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2022 17:14:13 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0b1505c82dc5= bb593608bb72c1db0496088f2d25 commit 0b1505c82dc5bb593608bb72c1db0496088f2d25 Author: Bruno Larsen Date: Tue Jun 7 16:07:07 2022 -0300 gdb/testsuite: Expand gdb.cp/mb-ctor.exp to test dynamic allocation =20 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. Diff: --- gdb/testsuite/gdb.cp/mb-ctor.cc | 6 ++++++ gdb/testsuite/gdb.cp/mb-ctor.exp | 18 ++++++++++++++++++ 2 files changed, 24 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); =20 + Derived *dyn_d =3D new Derived (24); + DeeplyDerived *dyn_dd =3D 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-cto= r.exp index f5f5d9143d1..5a3c0a4a90f 100644 --- a/gdb/testsuite/gdb.cp/mb-ctor.exp +++ b/gdb/testsuite/gdb.cp/mb-ctor.exp @@ -55,6 +55,24 @@ gdb_test "continue" \ =20 gdb_continue_to_breakpoint "set breakpoint here, second time" ".* breakpoi= nt here" =20 +gdb_test "continue" \ + ".*Breakpoint.*Derived.*i=3D24.*" \ + "run to breakpoint 1 dynamic v1" + +gdb_continue_to_breakpoint "set breakpoint here, first dynamic time"\ + ".* breakpoint here" + +gdb_test "continue" \ + ".*Breakpoint.*Derived.*i=3D42.*" \ + "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"