From: "Liu, Lei" <lei.liu2@windriver.com>
To: gdb@sourceware.org
Subject: Looking up enum constant symbols from C++ base classes
Date: Mon, 01 Nov 2010 09:35:00 -0000 [thread overview]
Message-ID: <4CCE89F7.10908@windriver.com> (raw)
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
next reply other threads:[~2010-11-01 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-01 9:35 Liu, Lei [this message]
2010-11-01 19:08 ` Tom Tromey
2010-11-02 2:16 ` Liu, Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CCE89F7.10908@windriver.com \
--to=lei.liu2@windriver.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox