This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Symbolic constants inside classes
- From: Tom Tromey <tromey at redhat dot com>
- To: Jonas Maebe <jonas dot maebe at elis dot ugent dot be>
- Cc: gdb at sourceware dot org
- Date: Mon, 20 Dec 2010 14:23:36 -0700
- Subject: Re: Symbolic constants inside classes
- References: <1DD38938-E7BD-491F-905C-FCA963E5E941@elis.ugent.be>
>>>>> "Jonas" == Jonas Maebe <jonas.maebe@elis.ugent.be> writes:
Jonas> Consider this C++ program:
[...]
Jonas> g++ -gdwarf-2 generates a definition for both MAGIC_NUM constants
Jonas> both in the respective class scopes, and also in the global
Jonas> namespace:
What version of g++?
Jonas> In gdb (7.0),
Jonas> 1) p MAGIC_NUM prints 42
Jonas> 2) "p Xyz::MAGIC_NUM" and "p Xyz2::MAGIC_NUM" print "static field MAGIC_NUM has been optimized out"
Jonas> 3) "p C.MAGIC_NUM" and "p C2.MAGIC_NUM" print "field MAGIC_NUM is nonexistent or has been optimised out"
I tried this example with svn trunk gcc and CVS head gdb, and it worked.
I didn't try to find out whether the fix was in gcc or gdb.
Tom