Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Looking up enum constant symbols from C++ base classes
@ 2010-11-01  9:35 Liu, Lei
  2010-11-01 19:08 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Liu, Lei @ 2010-11-01  9:35 UTC (permalink / raw)
  To: gdb

Hi,

I have a problem when debugging a C++ program.  Here is my test case.

#include <cstdio>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-02  2:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-01  9:35 Looking up enum constant symbols from C++ base classes Liu, Lei
2010-11-01 19:08 ` Tom Tromey
2010-11-02  2:16   ` Liu, Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox