-gstabs+ generates bad stabs for bitsize fields. -gstabs (without GNU extensions) does not have this problem. Please note that on some platforms -gstabs+ is the default. Consequently, -g and -ggdb will produce the same error. Consider the following type definition, taken from the GNU Pascal runtime library (time.pas) const DateTimeLength = 11; { MUST match constants.h } type DateTimeString = String (DateTimeLength); GPC_TimeStamp = packed record DateValid, TimeValid : Boolean; Year : Integer; Month : 1 .. 12; Day : 1 .. 31; DayOfWeek : 0 .. 6; { 0 means Sunday } Hour : 0 .. 23; Minute : 0 .. 59; Second : 0 .. 61; { to allow for leap seconds } MicroSecond: 0 .. 999999; TimeZone : Integer; { in seconds east of UTC } DST : Boolean; TZName1, TZName2 : String (32); end; Through the runtime library, GPC_TimeStamp is included in the debug information for hello.pas. [G4:~/gnu/testgpc/adriaan] adriaan% gpc -v Reading specs from /Developer/Pascal/gpc332d1/lib/gcc-lib/powerpc-apple-darwin/3.3.2/specs Configured with: ../gpc-332d1/configure --enable-languages=pascal,c --prefix=/Developer/Pascal/gpc332d1 --enable-threads=posix --target=powerpc-apple-darwin Thread model: posix gpc version 20030830, based on gcc-3.3.2 [G4:~/gnu/testgpc/adriaan] adriaan% gpc -c -o hello.o hello.pas -g [G4:~/gnu/testgpc/adriaan] adriaan% objdump hello.o -g hello.o: file format mach-o-be Bad stab: Datevalid:(0,5)=@s8;-16;,0,1;Timevalid:(0,5),1,1;Year:(0,1),2,32;Month:(0,6)=r(0,1);1;12;,34,4;Day:(0,7)=r(0,1);1;31;,38,5;Dayofweek:(0,8)=r(0,1);0;6;,43,3;Hour:(0,9)=r(0,1);0;23;,46,5;Minute:(0,10)=r(0,1);0;59;,51,6;Second:(0,11)=r(0,1);0;61;,57,6;Microsecond:(0,12)=r(0,1);0;999999;,63,20;Timezone:(0,1),83,32;Dst:(0,5),115,1;Tzname1:(0,13)=s44Capacity:(0,14)=r(0,14);0000000000000;0037777777777;,0,32;length:(0,14),32,32;_p_Schema_:(0,15)=ar(0,1);1;33;(0,2),64,264;;,128,352;Tzname2:(0,16)=s44Capacity:(0,14),0,32;length:(0,14),32,32;_p_Schema_:(0,17)=ar(0,1);1;33;(0,2),64,264;;,480,352;; Last stabs entries before error: n_type n_desc n_value string SO 0 0000000000000000 /Users/adriaan/gnu/testgpc/adriaan/ SO 0 0000000000000000 hello.pas OPT 0 0000000000000000 gcc2_compiled. LSYM 0 0000000000000000 integer:t(0,1)=r(0,1);-2147483648;2147483647; LSYM 0 0000000000000000 char:t(0,2)=@s8;-20; LSYM 0 0000000000000000 Complex:t(0,3)=R4;16;0; LSYM 0 0000000000000000 Timestamp:t(0,4)=s104Datevalid:(0,5)=@s8;-16;,0,1;Timevalid:(0,5),1,1;Year:(0,1),2,32;Month:(0,6)=r(0,1);1;12;,34,4;Day:(0,7)=r(0,1);1;31;,38,5;Dayofweek:(0,8)=r(0,1);0;6;,43,3;Hour:(0,9)=r(0,1);0;23;,46,5;Minute:(0,10)=r(0,1);0;59;,51,6;Second:(0,11)=r(0,1);0;61;,57,6;Microsecond:(0,12)=r(0,1);0;999999;,63,20;Timezone:(0,1),83,32;Dst:(0,5),115,1;Tzname1:(0,13)=s44Capacity:(0,14)=r(0,14);0000000000000;0037777777777;,0,32;length:(0,14),32,32;_p_Schema_:(0,15)=ar(0,1);1;33;(0,2),64,264;;,128,352;Tzname2:(0,16)=s44Capacity:(0,14),0,32;length:(0,14),32,32;_p_Schema_:(0,17)=ar(0,1);1;33;(0,2),64,264;;,480,352;; ... The problem is the semicolon after "=@s8;-16" that should not be there. Waldek Hebisch has provided a patch that solves the problem: diff -ru gcc-3.3.2.orig/gcc/dbxout.c gcc-3.3.2/gcc/dbxout.c --- gcc-3.3.2.orig/gcc/dbxout.c Fri Oct 31 21:23:40 2003 +++ gcc-3.3.2/gcc/dbxout.c Sat Nov 1 00:08:30 2003 @@ -1375,7 +1375,7 @@ fputs ("@s", asmfile); CHARS (2); print_wide_int (BITS_PER_UNIT * int_size_in_bytes (type)); - fputs (";-20;", asmfile); + fputs (";-20", asmfile); CHARS (4); } else @@ -1397,7 +1397,7 @@ fputs ("@s", asmfile); CHARS (2); print_wide_int (BITS_PER_UNIT * int_size_in_bytes (type)); - fputs (";-16;", asmfile); + fputs (";-16", asmfile); CHARS (4); } else /* Define as enumeral type (False, True) */ Regards, Adriaan van Os www.microbizz.nl/gpc.html
Could you update the patch to the mainline and submit it gcc-patches@gcc.gnu.org with a changelog?
The patch was posted here: <http://gcc.gnu.org/ml/gcc-patches/2003-11/msg00129.html> .
Note darwin now supports dwarf2 (except you have to have a newer gdb).
Actually I disagree with the patch as no other TYPE needs this patch, are you sure that this is not a gdb problem? Also I will note that GPC cannot be compiled on the mainline at all where a bug fix would go first so closing as invalid.
Andrew, that comment doesn't make any sense. The code only occurs for two types, so of course no other type needs it. The bad bit of stabs is: Datevalid:(0,5)=@s8;-16;,0,1;Timevalid:(0,5),1,1;... (0,5),1,1 is valid for a field. It's TYPENAME,BITOFFSET,BITLEN. "@s8;-16" is a valid TYPENAME; the "@s8;" prefix is consumed and the type is "-16". "@s8;-16;" is not a valid TYPENAME; types do not end in a semicolon. I'm sure you could reproduce this in some other language if you tried.
Subject: Re: Bad stabs for bitsize fields Thanks Daniel for your additional comment. I regret that the gpc compiler currently doesn't compile on the mainline. Tree SSA has broken more than one frontend. We have to catch up first. Once we have, it will be reproducable again in Pascal also. Regards, Adriaan van Os
stabs support was removed: r13-2361-g7e0db0cdf01e9c So won't fix.