Hi all,
I am currently trying to improve GDB pascal support by trying to add support for printing individual chars of a string. (printing the whole strings does work for both compilers).
The code that I have works now nicely for Free Pascal, but when I tried to check the code for GPC, I got several bad surprises.
test.p
var S : string;
begin S:='Simple test'; Writeln(s); end.
1) ptyp S where S is a pascal string leads to problems... because the stabs format for the strings is weird...
.stabs "S:S(0,46)=s264Capacity:(0,4),0,32;length:(0,4),32,32;_p_schema_:(0,47)=@ s2048;@S;S(0,48)=r(0,1);0000000000001;0000000000400;,64,2048;;",40,0,5,_S Looking into stabsread.c I found out that @S sets is_string to 1, but the fact that after this the type is a S mans that GDB inteprets this as a set type which is transformed into a bitstring type...
(you can see this if you use) (gdb) p S._p_schema_
Thus, if I add the missing support for bitstring indexes, I get a true or false printout.... where I would like to have a char output...
The problem is that bitstring seems to be the wrong choice here, I understand bitstring as being a packed array of boolean values (probably fortran or modula-2)
the correct choice would be to get the compiler to generate an array type instead of a set type after the @S; this would then give a correct TYPE_CODE_STRING type for the _p_schema_ field....
I am now rather clueless about how to add support for this feature for GPC :(
PS: I would like to have more feedback about the pascal language support in GDB from all of you.
Does noone on this list use GDB? If you ever encounter any pascal language problems in GDB, please report them, I does not read all GPC list mails completely, but I always give more attention if debugger is involved...
Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99