From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29637 invoked by alias); 4 Oct 2012 00:30:34 -0000 Received: (qmail 29629 invoked by uid 22791); 4 Oct 2012 00:30:34 -0000 X-SWARE-Spam-Status: No, hits=-7.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Oct 2012 00:30:26 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q940UPkr022307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Oct 2012 20:30:25 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q940UNtb023332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 3 Oct 2012 20:30:25 -0400 Message-ID: <506CD89F.4040101@redhat.com> Date: Thu, 04 Oct 2012 00:30:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: "gdb-patches@sourceware.org ml" Subject: [RFA] Add support for class typedefs/add missing derivation.exp tests Content-Type: multipart/mixed; boundary="------------040202010205030908050706" X-IsSubscribed: yes 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 X-SW-Source: 2012-10/txt/msg00051.txt.bz2 This is a multi-part message in MIME format. --------------040202010205030908050706 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 563 Hi, While working on some (more) symbol table bugs, I noticed that derivation.exp doesn't test the ptype of the variable g_instance. I presume this is because cp_test_ptype_class doesn't support typedefs. Since it is pretty easy to do, and I will need it for a follow-on patch, I'm submitting this omission now, adding the missing tests and support. Ok? Keith testsuite/ChangeLog 2012-10-03 Keith Seitz * lib/cp-support.exp (cp_test_ptype_class): Add support for class typedefs. * gdb.cp/derivation.exp: Add tests for g_instance. --------------040202010205030908050706 Content-Type: text/x-patch; name="cp_test_ptype_class-typedef.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cp_test_ptype_class-typedef.patch" Content-length: 3325 diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp index 8829f97..467a25e 100644 --- a/gdb/testsuite/lib/cp-support.exp +++ b/gdb/testsuite/lib/cp-support.exp @@ -81,6 +81,11 @@ proc cp_check_errata { expected_string actual_string errata_table } { # the class has a member function with the given access type # and the given declaration. # +# { typedef "access" "declaration" } +# +# the class has a typedef with the given access type and the +# given declaration. +# # If you test the same class declaration more than once, you can specify # IN_CLASS_TABLE as "ibid". "ibid" means: look for a previous class # table that had the same IN_KEY and IN_TAG, and re-use that table. @@ -199,6 +204,7 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { set list_vbases { } set list_fields { } set list_methods { } + set list_typedefs { } foreach class_line $in_class_table { switch [lindex $class_line 0] { @@ -206,6 +212,7 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { "vbase" { lappend list_vbases [lindex $class_line 1] } "field" { lappend list_fields [lrange $class_line 1 2] } "method" { lappend list_methods [lrange $class_line 1 2] } + "typedef" { lappend list_typedefs [lrange $class_line 1 2] } default { fail "$in_testname // bad line in class table: $class_line"; return; } } } @@ -381,6 +388,22 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { } } + # Typedef + + if {[llength $list_typedefs] > 0} { + set typedef_access [lindex [lindex $list_typedefs 0] 0] + set typedef_decl [lindex [lindex $list_typedefs 0] 1] + if {[string equal $actual_line $typedef_decl]} { + if {![string equal $access $typedef_access]} { + cp_check_errata $typedef_access $access $in_errata_table + fail "$in_testname // wrong access specifier for typedef: $access" + return + } + set list_typedefs [lreplace $list_typedefs 0 0] + continue + } + } + # Synthetic operators. These are optional and can be mixed in # with the methods in any order, but duplicates are wrong. # @@ -452,6 +475,11 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { return } + if {[llength $list_typedefs] > 0} { + fail "$in_testname // missing typedefs" + return + } + # Check the tail. set actual_tail [string trim $actual_tail] diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp index a4210d9..f4b4888 100644 --- a/gdb/testsuite/gdb.cp/derivation.exp +++ b/gdb/testsuite/gdb.cp/derivation.exp @@ -134,6 +134,22 @@ cp_test_ptype_class \ { method public "int foo();" } } +# class G +cp_test_ptype_class \ + "ptype g_instance" "" "class" "G" \ + { + { base "private A" } + { base "public B" } + { base "protected C" } + { field public "int g;" } + { field public "int gg;" } + { field public "int a;" } + { field public "int b;" } + { field public "int c;" } + { method public "int gfoo();" } + { method public "int foo();" } + } + # Print individual fields. gdb_test "print d_instance.a" "\\$\[0-9\]+ = 1" "print value of d_instance.a" --------------040202010205030908050706--