Pierre Muller a écrit :
I just want to send you a note that I started to integrate pascal language support inside GDB. ( I now have "Write after approval" rights in the cygwin main GDB cvs tree and I just committed 4 new files specific to pascal language).
I already mentionned several time that I have patches to add pascal support for GDB, but I never got any feedback from the GNU pascal team. (I am one of the developpers of Free Pascal Compiler, another GPL pascal compiler).
Does any of you use GDB to debug pascal code? Where annoyed by getting some "unknown type 10" error?
Currently my patches only support Free Pascal strings and I have no idea of the current support of pascal string in GNU pascal, could someone please enlight me?
from the (old) gpc info file:
The string type in gpc is something equivalent to
TYPE STRING = RECORD Capacity : integer; length : integer; string : packed array [ 1..Capacity ] of char; END;
where Capacity is the maximum length (can vary from 1 to maxint at declaration time) length is the current length string is the actual string, starting from 1.
integer is the default integer size in gpc, i.e. 32 bits for most platforms, but not guaranteed (may be 64 bits in the future): in any case it can be safely declared as equivalent to "int" in C (gcc) for the same platform.
In fact I suppose that it is actually cardinal (identical to word), i.e. "unsigned int" in C (this doc is somewhat outdated).
Of course gpc strings can contain any number of #0 inside the actual length.
On the other hand Pchar exists, with an equivalent (but more understandable) Cstring, to enable interface with C system functions, and there are lots of conversion functions between the two, but you don't need to know for GDB interface, they are just like other functions.
I wellcome you for that effort. The need to use silly C language constructs to debug pascal programs is a headache for most users of gpc: for example to have the content of a string St I usually type (in rhide) (char[])St.string nothing simpler works, and the result does not take into account the length parameter, so it stops at the first #0 character.
Maurice