This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Looking up enum constant symbols from C++ base classes
- From: "Liu, Lei" <lei dot liu2 at windriver dot com>
- To: gdb at sourceware dot org
- Date: Mon, 01 Nov 2010 17:35:51 +0800
- Subject: 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