From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13157 invoked by alias); 1 Nov 2010 09:35:16 -0000 Received: (qmail 13029 invoked by uid 22791); 1 Nov 2010 09:35:16 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.windriver.com (HELO mail.windriver.com) (147.11.1.11) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Nov 2010 09:35:06 +0000 Received: from ALA-MAIL03.corp.ad.wrs.com (ala-mail03 [147.11.57.144]) by mail.windriver.com (8.14.3/8.14.3) with ESMTP id oA19Z4V4002143 for ; Mon, 1 Nov 2010 02:35:04 -0700 (PDT) Received: from ala-mail06.corp.ad.wrs.com ([147.11.57.147]) by ALA-MAIL03.corp.ad.wrs.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 1 Nov 2010 02:35:04 -0700 Received: from [128.224.158.168] ([128.224.158.168]) by ala-mail06.corp.ad.wrs.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 1 Nov 2010 02:35:04 -0700 Message-ID: <4CCE89F7.10908@windriver.com> Date: Mon, 01 Nov 2010 09:35:00 -0000 From: "Liu, Lei" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.14) Gecko/20101005 Thunderbird/3.0.9 MIME-Version: 1.0 To: gdb@sourceware.org Subject: Looking up enum constant symbols from C++ base classes Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00002.txt.bz2 Hi, I have a problem when debugging a C++ program. Here is my test case. #include class A { public: enum E {X,Y,Z}; }; class B : A { public: void test(E e); }; void B::test(E e) { if (e == X) { //b 14 if e==X printf("%d\n",e); } } int main() { B b; b.test(A::X); return 0; } Compiled by gcc-4.1.2 with -O0 -g. I tried to plant a conditional breakpoint in line 14 as shown in comment but got a error shows 'No symbol "X" in current context'. The symbol 'X' is accessible in that scope. It seems that gdb has a problem to look up enum constant symbols derived from base classes. I added some code in cp_lookup_symbol_nonlocal to make gdb look up symbols from all base classes. It works fine. Is this a right fix? Thanks. Lei