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]

Re: Double ';' problem in stabs



Debashis,

I have committed the suggested fix.
http://sources.redhat.com/ml/gdb-patches/2002-01/msg00035.html

Thanks
Elena


debashis  mahata writes:
 > Hi all,
 > 
 > This problem was observed while using Gdb on code that is 
 > compiled with Sun C Compiler Forte 6 update 2.( cc - 5.3)
 > 
 > While going through the Gdb code, I have noticed one issue
 > in handling stabs for a structure / union, looks like some
 > assumptions has been made about the format, which is not
 > documented. The assumption made is - the structure or union
 > stabs should end with two consecutive semicolon i.e. ';;'.
 > 
 > One example (using Sun compiler) - For the structure
 > 	struct node{
 > 		int I;
 > 		char C;
 > 	};
 > the generated stab is - "node:T(0,21)=s8I:(0,3),0,32;C:(0,1),32,8;;"
 > where,
 > $cc -V
 > cc: WorkShop Compilers 5.0 98/12/15 C 5.0
 > 
 > You can see that the stab has two consecutive ';' at the
 > end. But the last ';' is not documented in Sun stab document.
 > Neither the Gdb stab document says that the last ';' should be
 > present. The code is in file stabsread.c (function:
 > read_struct_fields()), where Gdb searches for the last ';'.
 > The corresponding code is -
 > 
 >   /* Read each data member type until we find the terminating ';' at the
 > end
 > of
 >      the data member list, or break for some other reason such as
 > finding
 > the
 >      start of the member function list. */
 > 
 >   while (**pp != ';')
 >     {
 > 	.....
 > 
 > Some compilers does not generates the last ';'. For the
 > above mentioned example and using the
 > $cc -V
 > cc: Sun WorkShop 6 update 2 C 5.3 2001/05/15
 > 
 > compiler the generated stab is -
 > "node:T(0,21)=s8I:(0,3),0,32;C:(0,1),32,8;"
 > 
 > In this example the last ';'is missing.
 > 
 > Questions:
 > 1. Is it anywhere documented that the last ';' (the second one) should
 > be present?
 > 2. If not, is it a bug (the assumption that last ';' should
 > be persent) in Gdb, which requires a fix?
 > 3. In case a fix is required what will be the long term strategy?
 > 
 > Thanks in advance,
 > debashis
 > -------------------------------------------------------------------------------------------------------------------------
 > Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and
 > is intended for use only by the individual or entity to which it is
 > addressed, and may contain information that is privileged, confidential or
 > exempt from disclosure under applicable law. If you are not the intended
 > recipient or it appears that this mail has been forwarded to you without
 > proper authority, you are notified that any use or dissemination of this
 > information in any manner is strictly prohibited. In such cases, please
 > notify us immediately at mailto:mailadmin@wipro.com and delete this mail
 > from your records.
 > ----------------------------------------------------------------------------------------------------------------------


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