This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Looking up enum constant symbols from C++ base classes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]