From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2557 invoked by alias); 1 Dec 2014 20:30:49 -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 2543 invoked by uid 89); 1 Dec 2014 20:30:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 01 Dec 2014 20:30:47 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB1KUhuH002409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 1 Dec 2014 15:30:44 -0500 Received: from localhost (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sB1KUgMJ011724 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Mon, 1 Dec 2014 15:30:43 -0500 From: Sergio Durigan Junior To: Cc: "'gdb-patches\@sourceware.org'" Subject: Re: [PATCH] Fix gdb.cp/typeid.exp failures for ppc64 References: <547C9087.1090506@codesourcery.com> X-URL: http://blog.sergiodj.net Date: Mon, 01 Dec 2014 20:30:00 -0000 In-Reply-To: <547C9087.1090506@codesourcery.com> (Luis Machado's message of "Mon, 1 Dec 2014 14:00:07 -0200") Message-ID: <878uiryux9.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-12/txt/msg00024.txt.bz2 On Monday, December 01 2014, Luis Machado wrote: > 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. Hey Luis! Thanks for the patch. Just a somewhat minor comment. > 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" { > + } > + } Any particular reason for not using gdb_test_multiple here (and everywhere else)? This "send_gdb...gdb_expect" dialect is not used anymore in the testsuite, AFAIR. > > + 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 > > 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. Thanks, -- Sergio GPG key ID: 0x65FC5E36 Please send encrypted e-mail if possible http://sergiodj.net/