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]

Double ';' problem in stabs


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

Attachment: InterScan_Disclaimer.txt
Description: Text document


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