From patchwork Thu Oct 15 16:05:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 9165 Received: (qmail 15604 invoked by alias); 15 Oct 2015 16:06:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 15587 invoked by uid 89); 15 Oct 2015 16:06:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Oct 2015 16:06:05 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Zml2X-0005RY-Le from Andrew_Stubbs@mentor.com ; Thu, 15 Oct 2015 09:06:02 -0700 Received: from [172.30.88.41] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.3.224.2; Thu, 15 Oct 2015 17:06:00 +0100 Subject: Re: [PATCH] Fix inherit.exp tests To: Yao Qi References: <560E4718.80707@codesourcery.com> <86pp0i4u4d.fsf@gmail.com> CC: From: Andrew Stubbs Message-ID: <561FCEE2.1060402@codesourcery.com> Date: Thu, 15 Oct 2015 17:05:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <86pp0i4u4d.fsf@gmail.com> On 13/10/15 17:21, Yao Qi wrote: > Yes, gcc option -fdump-class-hierarchy is quite useful in this case, Oooo, that's nice! I'll have to remember that one. :-) > This line is too long, multiple instances of this problem. Otherwise, > that patch is OK. We can also garbage collect some patterns, but this > change can be done in follow-up patch. I've fixed the comment lines. The patterns remain long, but that's common across the whole testsuite. > Do you plan to fix fails in virtbase.exp too? I've been getting to it; done now. How's this patch? Andrew 2015-10-15 Andrew Stubbs gdb/testsuite/ * gdb.cp/inherit.exp (print g_vB, print g_vC, print g_vD, print g_vE): Add new pass patterns. * gdb.cp/virtbase.exp (print *this, print *(D *) e): Allow GDB to print various symbol names for vptr fields. diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp index 2369a1e..d269a3b 100644 --- a/gdb/testsuite/gdb.cp/inherit.exp +++ b/gdb/testsuite/gdb.cp/inherit.exp @@ -524,6 +524,12 @@ proc test_print_svi_classes { } { # gcc HEAD 2004-07-31 -gstabs+ pass $name } + -re "$vhn = \{ = \{va = 3, vx = 4\}, $re_vbptr_3 = ${hex}( <\[^>]*>)?, vb = 5, vx = 6\}$nl$gdb_prompt $" { + # gcc HEAD 2015?+ + # the vptr is set to the address *after* the vtable, + # so the # symbol shown is unpredictable + pass "$name (symbols ignored)" + } } # Print all members of g_vC. @@ -552,6 +558,12 @@ proc test_print_svi_classes { } { # gcc HEAD 2004-07-31 -gstabs+ pass $name } + -re "$vhn = \{ = \{va = 7, vx = 8\}, $re_vbptr_3 = ${hex}( <\[^>]*>)?, vc = 9, vx = 10\}$nl$gdb_prompt $" { + # gcc HEAD 2015?+ + # the vptr is set to the address *after* the vtable, + # so the symbol shown is unpredictable + pass "$name (symbols ignored)" + } } } @@ -623,6 +635,12 @@ proc test_print_mvi_classes { } { # gcc 3.3.2 -gstabs+ pass "$name" } + -re "$vhn = \{ = \{ = \{va = 19, vx = 20\}, $re_vbptr_3_vB = ${hex}( <\[^>]*>)?, vb = 21, vx = 22\}, = \{$re_vbptr_3_vC = ${hex}( <\[^>]*>)?, vc = 23, vx = 24\}, $re_vbptr_3_vD = ${hex}( <\[^>]*>)?, vd = 25, vx = 26\}$nl$gdb_prompt $" { + # gcc HEAD 2015?+ + # the vptr is set to the address *after* the vtable, + # so the symbol shown is unpredictable + pass "$name (symbols ignored)" + } } # Print all members of g_vE. @@ -650,6 +668,12 @@ proc test_print_mvi_classes { } { # gcc HEAD 2004-07-31 -gstabs+ pass $name } + -re "$vhn = \{ = \{ = \{ = \{va = 0, vx = 0\}, $re_vbptr_3_vB = ${hex}( <\[^>]*>)?, vb = 0, vx = 0\}, = \{$re_vbptr_3_vC = ${hex}( <\[^>]*>)?, vc = 0, vx = 0\}, $re_vbptr_3_vD = ${hex}( <\[^>]*>)?, vd = 0, vx = 0\}, $re_vbptr_3_vE = ${hex}( <\[^>]*>)?, ve = 27, vx = 28\}$nl$gdb_prompt $" { + # gcc HEAD 2015?+ + # the vptr is set to the address *after* the vtable, + # so the symbol shown is unpredictable + pass "$name (symbols ignored)" + } } } diff --git a/gdb/testsuite/gdb.cp/virtbase.exp b/gdb/testsuite/gdb.cp/virtbase.exp index 2033d56..0d1bfa2 100644 --- a/gdb/testsuite/gdb.cp/virtbase.exp +++ b/gdb/testsuite/gdb.cp/virtbase.exp @@ -33,7 +33,7 @@ gdb_continue_to_breakpoint "first breakpoint" # In PR 11226, we failed to print x correctly in the "print *this" # case. -gdb_test "print *this" " = { = {x = 2}, _vptr.Middle = $hex, y = 3}" +gdb_test "print *this" " = { = {x = 2}, _vptr.Middle = ${hex}( <\[^>]*>)?, y = 3}" gdb_test "print x" " = 2" "print x in get_y" gdb_breakpoint [gdb_get_line_number "breakpoint 2"] @@ -46,7 +46,7 @@ gdb_breakpoint [gdb_get_line_number "breakpoint 3"] gdb_continue_to_breakpoint "third breakpoint" # In PR 9629, we failed to print v correctly here. -gdb_test "print *(D *) e" " = { = {v = 11}, _vptr.D = $hex}" +gdb_test "print *(D *) e" " = { = {v = 11}, _vptr.D = ${hex}( <\[^>]*>)?}" # A regression test reported to Red Hat bugzilla, see: # https://bugzilla.redhat.com/show_bug.cgi?id=560741 @@ -70,5 +70,5 @@ gdb_test "print $" \ " = \\(Virtual \\*\\) $hex " \ "print same pointer from history value" gdb_test "print *$$" \ - " = \\(Virtual\\) { = { = {_vptr.VirtualBase = ${hex}( )?, x = 0}, _vptr.VirtualMiddleA = ${hex}( )?, y = \\{0 \\}}, = {_vptr.VirtualMiddleB = ${hex}( )?, y = 0}, _vptr.Virtual = ${hex}( )?, z = 0}" \ + " = \\(Virtual\\) { = { = {_vptr.VirtualBase = ${hex}( <\[^>]*>)?, x = 0}, _vptr.VirtualMiddleA = ${hex}( <\[^>]*>)?, y = \\{0 \\}}, = {_vptr.VirtualMiddleB = ${hex}( <\[^>]*>)?, y = 0}, _vptr.Virtual = ${hex}( <\[^>]*>)?, z = 0}" \ "print whole pointed-to object, starting from the virtual base pointer"