This is the mail archive of the gdb-patches@sources.redhat.com 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: [patch/testsuite] gdb.c++/classes.exp: add another ptype pattern


Ah, yeah, the problem with my questions is that they are at the end
of a pipeline with several stages.

Let's back up and look at what gcc outputs.  I made a small source file:

  class ClassWithEnum
  {
    public:
      enum PrivEnum { red, green, blue, yellow = 42 };
      PrivEnum priv_enum;
      int x;
  };

Then I hit it with gcc 3.2.3, and gcc 3.3 and diff'ed the .s files.

  -       .stabs  "PrivEnum:t(1,1)=ered:0,green:1,blue:2,yellow:42,;",128,0,4,0
  +       .stabs  "ClassWithEnum::PrivEnum:t(1,1)=ered:0,green:1,blue:2,yellow:42,;",128,0,4,0
	  .stabs  "ClassWithEnum:Tt(1,2)=s8priv_enum:(1,1),0,32;x:(0,1),32,32;operator=::(1,3)=#(1,2),(1,4)=&(1,2),(1,5)=*(1,2),(1,6)=&(1,7)=k(1,2),(1,8)=(1,8);:_ZN13ClassWithEnumaSERKS_;2A.;__base_ctor::(1,9)=#(1,2),(1,8),(1,5),(1,6),(1,8);:_ZN13ClassWithEnumC2ERKS_;2A.;__comp_ctor::(1,9):_ZN13ClassWithEnumC1ERKS_;2A.;__base_ctor::(1,10)=#(1,2),(1,8),(1,5),(1,8);:_ZN13ClassWithEnumC2Ev;2A.;__comp_ctor::(1,10):_ZN13ClassWithEnumC1Ev;2A.;;",128,0,2,0

The big stab for ClassWithEnum is the same, but the stab for the nested
enum changed from 'PrivEnum' to 'ClassWithEnum::PrivEnum'.  The
hypothetical case has came to life.  Argh!

Is it good for us that gcc 3.3 and later versions output
'ClassWithEnum::PrivEnum'?  Or should I file a bug report against gcc
and ask them to put it back to just plain 'PrivEnum'?

dc> I think that Daniel has a vision where this eventually becomes a
dc> PASS.  But that's a longer-term goal: if it become a PASS, it will do
dc> so for a two-stage reason, where GDB knows that the type in question
dc> is _really_ ClassWithEnum::PrivEnum but where the printer is clever
dc> enough to know that, while we're printing out ClassWithEnum, we can
dc> omit ClassWithEnum:: prefixes.

Ah, I see.

So it's hard to write the test case at this point.  But it's done the
job of alerting us to a difference in gcc output.

Michael C


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