From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29619 invoked by alias); 24 Jan 2011 20:54:03 -0000 Received: (qmail 29558 invoked by uid 22791); 24 Jan 2011 20:54:02 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Mon, 24 Jan 2011 20:53:56 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0OKrsPV012688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Jan 2011 15:53:54 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0OKrstY016043 for ; Mon, 24 Jan 2011 15:53:54 -0500 Received: from [10.15.16.129] (dhcp-10-15-16-129.yyz.redhat.com [10.15.16.129]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0OKrrP0013957 for ; Mon, 24 Jan 2011 15:53:53 -0500 Message-ID: <4D3DE6E1.2080905@redhat.com> Date: Mon, 24 Jan 2011 20:59:00 -0000 From: sami wagiaalla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch] namespace tests Content-Type: multipart/mixed; boundary="------------070502030503090405000009" 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: 2011-01/txt/msg00469.txt.bz2 This is a multi-part message in MIME format. --------------070502030503090405000009 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 128 Jan identified two local namespace tests which I have not committed upstream with the namespace patches. Patch attached. Sami --------------070502030503090405000009 Content-Type: text/x-patch; name="namespace-tests.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="namespace-tests.patch" Content-length: 5351 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f6f5121..5647930 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-01-24 Sami Wagiaalla + + * gdb.cp/nsnested.cc: New. + * gdb.cp/nsnested.exp: New. + * gdb.cp/nsnoimports.exp: New. + * gdb.cp/nsnoimports.cc: New. + 2011-01-14 Joel Brobecker * gdb.base/wchar.c, gdb.base/wchar.exp: New testcases. diff --git a/gdb/testsuite/gdb.cp/nsnested.cc b/gdb/testsuite/gdb.cp/nsnested.cc new file mode 100644 index 0000000..9723f87 --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsnested.cc @@ -0,0 +1,36 @@ +namespace A +{ + namespace B + { + int ab = 11; + } +} + +namespace C +{ + namespace D + { + using namespace A::B; + + int + second() + { + ab; + return 0; + } + } + + int + first() + { + //ab; + return D::second(); + } +} + +int +main() +{ + //ab; + return C::first(); +} diff --git a/gdb/testsuite/gdb.cp/nsnested.exp b/gdb/testsuite/gdb.cp/nsnested.exp new file mode 100644 index 0000000..6648f38 --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsnested.exp @@ -0,0 +1,42 @@ +# Copyright 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set testfile nsnested +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } { + return -1 +} + +############################################ +if ![runto_main] then { + perror "couldn't run to breakpoint main" + continue +} + +gdb_test "print ab" "No symbol .* in current context." + +############################################ +gdb_breakpoint C::first +gdb_continue_to_breakpoint "C::first" + +gdb_test "print ab" "No symbol .* in current context." +gdb_test "print C::D::ab" "= 11" + +############################################ +gdb_breakpoint C::D::second +gdb_continue_to_breakpoint "C::D::second" + +gdb_test "print ab" "= 11" diff --git a/gdb/testsuite/gdb.cp/nsnoimports.cc b/gdb/testsuite/gdb.cp/nsnoimports.cc new file mode 100644 index 0000000..d1c68ab --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsnoimports.cc @@ -0,0 +1,37 @@ + +namespace A +{ + int _a = 11; + + namespace B{ + + int ab = 22; + + namespace C{ + + int abc = 33; + + int second(){ + return 0; + } + + } + + int first(){ + _a; + ab; + C::abc; + return C::second(); + } + } +} + + +int +main() +{ + A::_a; + A::B::ab; + A::B::C::abc; + return A::B::first(); +} diff --git a/gdb/testsuite/gdb.cp/nsnoimports.exp b/gdb/testsuite/gdb.cp/nsnoimports.exp new file mode 100644 index 0000000..7b3dc2f --- /dev/null +++ b/gdb/testsuite/gdb.cp/nsnoimports.exp @@ -0,0 +1,61 @@ +# Copyright 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set testfile nsnoimports +set srcfile ${testfile}.cc +if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } { + return -1 +} + +############################################ +if ![runto_main] then { + perror "couldn't run to breakpoint main" + continue +} + +gdb_test "print A::_a" "= 11" +gdb_test "print A::B::ab" "= 22" +gdb_test "print A::B::C::abc" "= 33" + +gdb_test "print _a" "No symbol .* in current context." +gdb_test "print ab" "No symbol .* in current context." +gdb_test "print abc" "No symbol .* in current context." + +############################################ +gdb_breakpoint A::B::first +gdb_continue_to_breakpoint "A::B::first" + +gdb_test "print A::_a" "= 11" +gdb_test "print A::B::ab" "= 22" +gdb_test "print A::B::C::abc" "= 33" + +gdb_test "print _a" "= 11" +gdb_test "print ab" "= 22" +gdb_test "print C::abc" "= 33" + +gdb_test "print abc" "No symbol .* in current context." + +############################################ +gdb_breakpoint A::B::C::second +gdb_continue_to_breakpoint "A::B::C::second" + +gdb_test "print A::_a" "= 11" +gdb_test "print A::B::ab" "= 22" +gdb_test "print A::B::C::abc" "= 33" + +gdb_test "print _a" "= 11" +gdb_test "print ab" "= 22" +gdb_test "print abc" "= 33" + --------------070502030503090405000009--