This is the mail archive of the gdb@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]

c++/cfront puzzler


In obsoleting the cfront stuff, I ran into this (I am tossing
this out here, just in case, while I do some more research):

dbxread.c and mdebugread.c: (ignore the printf's)

		/* The semantics of C++ state that "struct foo { ... }"
		   also defines a typedef for "foo".  Unfortuantely, cfront
		   never makes the typedef when translating from C++ to C.
		   We make the typedef here so that "ptype foo" works as
		   expected for cfront translated code.  */
		else if (psymtab_language == language_cplus)
		  {

//		    printf ("TYPEDEF FORCED\n");
//                  printf ("file = %s\n", objfile->name);
//		    printf ("namestring = %s\n\n", namestring);

		    /* Also a typedef with the same name.  */
		    add_psymbol_to_list (namestring, p - namestring,
					 VAR_NAMESPACE, LOC_TYPEDEF,
					 &objfile->static_psymbols,
					 nlist.n_value, 0,
					 psymtab_language, objfile);
		  }


I was about to ifdef this out, when I discovered that it is actually still
executed.

It happens when there is a stab entry with a 'T' (for structure) and
no typedef (i.e. not a 'Tt' stab) and this is in a c++ file.

For kicks I checked while executing classes.exp (misc.cc file). 
And this is what happens:

(gdb) b main
Breakpoint 1 at 0x80489de: file /home/ezannoni/sources/src/gdb/testsuite/gdb.c++/misc.cc, line 557.
(gdb) r
Starting program: /home/ezannoni/sources/native/gdb/testsuite/gdb.c++/misc 

TYPEDEF FORCED
file = /usr/lib/libstdc++-libc6.2-2.so.3
namestring = type_info:T(3,1)=s8__name:/1(3,2)=*(0,2),0,32;.vf(3,1):(3,3)=*(0,23),32;type_info::(3,4)=#(3,1),(0,21),(3,5)=*(3,1),(0,1),(0,21);:_._9type_info;2A*2;(3,1);;operator=::(3,6)=##(3,7)=&(3,1);:__as__9type_infoRC9type_info;0A.;type_info::(3,8)=##(3,5);:RC9type_info;0A.(3,9)=##(3,5);:PCc;1A.;before::(3,10)=##(0,12);:RC9type_info;2B.;name::(3,11)=##(3,2);:;2B.;operator==::(3,10):__eq__C9type_infoRC9type_info;2B.;operator!=::(3,10):__ne__C9type_infoRC9type_info;2B.;;~%(3,1);

TYPEDEF FORCED
file = /usr/lib/libstdc++-libc6.2-2.so.3
namestring = exception:T(2,1)=s4.vf(2,1):(2,2)=*(0,23),0;operator=::(2,3)=##(2,4)=&(2,1);:__as__9exceptionRC9exception;2A.;exception::(2,5)=##(2,6)=*(2,1);:RC9exception;2A.(2,7)=##(2,6);:;2A.(2,8)=#(2,1),(0,21),(2,6),(0,1),(0,21);:_._9exception;2A*2;(2,1);;what::(2,9)=##(2,10)=*(0,2);:;2B*3;(2,1);;;~%(2,1);

TYPEDEF FORCED
file = /usr/lib/libstdc++-libc6.2-2.so.3
namestring = upcast_result:T(2,2)=s12target_obj:(0,20),0,32;whole2target:(2,1),32,32;base_type:(2,3)=*(2,4)=xstype_info:,64,32;operator=::(2,5)=##(2,6)=&(2,2);:__as__Q216__user_type_info13upcast_resultRCQ216__user_type_info13upcast_result;2A.;upcast_result::(2,7)=##(2,8)=*(2,2);:__Q216__user_type_info13upcast_resultRCQ216__user_type_info13upcast_result;2A.(2,9)=##(2,8);:__Q216__user_type_info13upcast_result;2A.;;

TYPEDEF FORCED
file = /usr/lib/libstdc++-libc6.2-2.so.3
namestring = bad_alloc:T(1,1)=s4!1,020,(1,2)=xsexception:;operator=::(1,3)=##(1,4)=&(1,1);:__as__9bad_allocRC9bad_alloc;2A.;bad_alloc::(1,5)=##(1,6)=*(1,1);:RC9bad_alloc;2A.(1,7)=##(1,6);:;2A.(1,8)=#(1,1),(0,21),(1,6),(0,1),(0,21);:_._9bad_alloc;2A*2;(1,1);;what::(1,9)=##(1,10)=*(0,2);:;2B*3;(1,1);;;~%(1,2);


Breakpoint 1, main ()
    at /home/ezannoni/sources/src/gdb/testsuite/gdb.c++/misc.cc:557
557	  dummy();
(gdb) 


So, for some symbols we do this anyways. But should we?

Elena





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