Hello.
Pierre Muller wrote:
- 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...
The code in GPC which generates the stabs for strings is rather old - and obviously buggy.
(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...
What would be the correct `.stabs' for a Pascal string?
It is a record internally, containing the capacity, the length, and the actual chars. It would be nice if GDB could "know" that it as a string.
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)
It's a `set' or `packed array of Boolean' in Pascal, and probably also in Modula 2. (I have never seen such a thing in Fortran.)
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 :(
I do not yet really understand how the compiler outputs debug information, but I get the impression that I can add support for that feature in GPC when you help me to understand how those `.stabs' work at all.
Does noone on this list use GDB?
I use it regularly, but due to some bugs in GPC's debug information output (e.g. concerning strings;-) I never dared to dive more deeply into it.
Thanks,
Peter