From patchwork Fri Oct 2 08:58:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 8910 Received: (qmail 20451 invoked by alias); 2 Oct 2015 08:58:17 -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 20356 invoked by uid 89); 2 Oct 2015 08:58:17 -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; Fri, 02 Oct 2015 08:58:11 +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 1ZhwAJ-0006Tl-Fa from Andrew_Stubbs@mentor.com for gdb-patches@sourceware.org; Fri, 02 Oct 2015 01:58:07 -0700 Received: from [172.30.88.214] (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; Fri, 2 Oct 2015 09:58:06 +0100 To: From: Andrew Stubbs Subject: [PATCH] Fix inherit.exp tests Message-ID: <560E4718.80707@codesourcery.com> Date: Fri, 2 Oct 2015 09:58:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Some of the tests in inherit.exp make invalid assumptions about vtable pointers in printed values. I find that these tests pass on most targets, but fail on a few targets, including mips-sde. The reason is that the "_vptr" entries in C++ types do not point to the head of the vtable, but point to the address following the last entry in the table, which mean that when GDB prints the symbol associated with the address, it actually prints the name of the value that follows the table in memory. Historically, it appears to have been fairly predictable what symbol would follow the vtable, and remains so on most targets, but this is no longer true in general (or perhaps never was). In mips-sde, in particular, the "VTT for *" symbols are placed in a completely different section, so cannot follow the vtable. The alignment and padding appears to have varied slightly, and the order of vtable and typeinfo sections appears to have varied also (or maybe the test was never right?) The attached patch adds new expect patterns that don't require any specific symbol at all, since they're basically meaningless. OK to commit? Andrew 2015-10-02 Andrew Stubbs gdb/testsuite/ * gdb.cp/inherit.exp (print g_vB, print g_vC, print g_vD, print g_vE): Add new pass patterns. Index: gdb/testsuite/gdb.cp/inherit.exp =================================================================== --- gdb/testsuite/gdb.cp/inherit.exp (revision 455195) +++ gdb/testsuite/gdb.cp/inherit.exp (working copy) @@ -524,6 +524,11 @@ # 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 +557,11 @@ # 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 +633,11 @@ # 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 +665,11 @@ # 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)" + } } }