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]

Re: Symbolic constants inside classes


>>>>> "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


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