From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23524 invoked by alias); 1 Dec 2014 16:00:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23515 invoked by uid 89); 1 Dec 2014 16:00:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE 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; Mon, 01 Dec 2014 16:00:18 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1XvTOZ-0006uV-D5 from Luis_Gustavo@mentor.com for gdb-patches@sourceware.org; Mon, 01 Dec 2014 08:00:15 -0800 Received: from [172.30.4.127] (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.181.6; Mon, 1 Dec 2014 08:00:14 -0800 Message-ID: <547C9087.1090506@codesourcery.com> Date: Mon, 01 Dec 2014 16:00:00 -0000 From: Luis Machado Reply-To: User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: "'gdb-patches@sourceware.org'" Subject: [PATCH] Fix gdb.cp/typeid.exp failures for ppc64 Content-Type: multipart/mixed; boundary="------------000003090605010500030801" X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00017.txt.bz2 --------------000003090605010500030801 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 430 This test assumes the typeid symbols are always available before actually starting the inferior, which is not true for architectures that place such symbols under relocatable sections. The following patch fixes this by conditionalizing the execution of such tests on the accessibility of the typeid symbols before the inferior is running. Regression-tested on ppc32/64. Ok? ps: A -w version of the patch is also attached. --------------000003090605010500030801 Content-Type: text/x-patch; name="typeid.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="typeid.diff" Content-length: 2094 2014-12-01 Luis Machado gdb/testsuite * gdb.cp/typeid.exp (do_typeid_tests): Do not test type id printing unless the symbols are available. diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp index 9963a8a..7469b2b 100644 --- a/gdb/testsuite/gdb.cp/typeid.exp +++ b/gdb/testsuite/gdb.cp/typeid.exp @@ -25,20 +25,35 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { proc do_typeid_tests {started} { global hex + global gdb_prompt + set symbol_found 1 - # We might see the standard type or gdb's internal type. - set type_re "(std::type_info|struct gdb_gnu_v3_type_info)" + # Try to access one of the symbols to make sure it is available. Some + # architectures put the symbols on relocatable sections, which means + # they will not be accessible before the inferior is running. + send_gdb "print 'typeinfo for int'\n" + gdb_expect { + -re "No symbol \"typeinfo for int\" in current context.*$gdb_prompt" { + set symbol_found 0 + } + -re ".*$gdb_prompt" { + } + } + if {$symbol_found == 1} { + # We might see the standard type or gdb's internal type. + set type_re "(std::type_info|struct gdb_gnu_v3_type_info)" - foreach simple_var {i cp ccp ca b} { - gdb_test "print &typeid($simple_var)" \ - " = \\($type_re \\*\\) $hex.*" + foreach simple_var {i cp ccp ca b} { + gdb_test "print &typeid($simple_var)" \ + " = \\($type_re \\*\\) $hex.*" - # Note that we test pointer equality rather than object - # equality here. That is because std::type_info's operator== - # is not present in the libstdc++ .so. - gdb_test "print &typeid($simple_var) == &typeid(typeof($simple_var))" \ - " = true" + # Note that we test pointer equality rather than object + # equality here. That is because std::type_info's operator== + # is not present in the libstdc++ .so. + gdb_test "print &typeid($simple_var) == &typeid(typeof($simple_var))" \ + " = true" + } } # typeid for these is Derived. Don't try these tests until the --------------000003090605010500030801 Content-Type: text/x-patch; name="typeid_w.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="typeid_w.diff" Content-length: 1324 diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp index 9963a8a..7469b2b 100644 --- a/gdb/testsuite/gdb.cp/typeid.exp +++ b/gdb/testsuite/gdb.cp/typeid.exp @@ -25,11 +25,25 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { proc do_typeid_tests {started} { global hex + global gdb_prompt + set symbol_found 1 + # Try to access one of the symbols to make sure it is available. Some + # architectures put the symbols on relocatable sections, which means + # they will not be accessible before the inferior is running. + send_gdb "print 'typeinfo for int'\n" + gdb_expect { + -re "No symbol \"typeinfo for int\" in current context.*$gdb_prompt" { + set symbol_found 0 + } + -re ".*$gdb_prompt" { + } + } + + if {$symbol_found == 1} { # We might see the standard type or gdb's internal type. set type_re "(std::type_info|struct gdb_gnu_v3_type_info)" - foreach simple_var {i cp ccp ca b} { gdb_test "print &typeid($simple_var)" \ " = \\($type_re \\*\\) $hex.*" @@ -40,6 +54,7 @@ proc do_typeid_tests {started} { gdb_test "print &typeid($simple_var) == &typeid(typeof($simple_var))" \ " = true" } + } # typeid for these is Derived. Don't try these tests until the # inferior has started. --------------000003090605010500030801--