From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shaun Jackman To: gdb@sources.redhat.com Subject: printing enumerated values Date: Fri, 06 Oct 2000 10:52:00 -0000 Message-id: <00100611524000.07740@ed> X-SW-Source: 2000-10/msg00021.html I have an enum that looks something like... enum { A = 512, B = 513 }; It's not really an enumerated list, more like constant integers. I don't want to use defines though because I can't work with them in GDB. And, 'const int's have performance issues in -O0 (where I'll be staying until we leave the touchy development phase). In GDB I get this... (gdb) p A $1 = 0 (gdb) p B $2 = 1 (gdb) This should be 512, and 513 respectively (clearly). Cheers, Shaun >From dberlin@redhat.com Fri Oct 06 11:02:00 2000 From: Daniel Berlin To: shaunj@gray-interfaces.com Cc: gdb@sources.redhat.com Subject: Re: printing enumerated values Date: Fri, 06 Oct 2000 11:02:00 -0000 Message-id: References: <00100611524000.07740@ed> X-SW-Source: 2000-10/msg00022.html Content-length: 738 Shaun Jackman writes: > I have an enum that looks something like... > > enum { > A = 512, > B = 513 > }; > > It's not really an enumerated list, more like constant integers. I don't want > to use defines though because I can't work with them in GDB. And, 'const int's > have performance issues in -O0 (where I'll be staying until we leave the > touchy development phase). > > In GDB I get this... > (gdb) p A > $1 = 0 > (gdb) p B > $2 = 1 > (gdb) > > This should be 512, and 513 respectively (clearly). > Clearly, this is a GCC problem. At least with all the versions of GCC on my computer, unless the enum has a real name (ie isn't anonymous), it doesn't generate the debug info properly for it.