Already some time ago I wanted to add support for GPC strings in GDB pascal extensions. But when I tried to look at it I discovered that its changes from the version I used at that time to a more recent one (this was around a year ago or even more).
Are GPC strings now stable ?
I need some advice about the following:
This is what I got using gpc2953 for djgpp I do understand the meaning of the two first fields quite easily, but what is _p_schema_ ???
While is the length indicated as having 12 bytes when apparently only 9 are used (is this just padding) ?
Most importantly, where are the chars ? This the length of the stabs incorrect and a variable just has the chars at the end of this kind of header (as Free Pascal Ansistrings do) ? Or is the data accessed via some pointer again.
What is the position in memory of the first char of the string ? Is this value still susceptible to changes ?
.stabs "String:t(0,19)=s12Capacity:(0,4),0,32;length:(0,4),32,32;\",128,0,0,0 .stabs "_p_schema_:(0,20)=@s8;@S;S(0,21)=r(0,1);0000000000001;0000000000001;,64,8;; ",128,0,0,0
I really need some feedback to be able to enhance string support for GPC.
Pierre Muller wrote:
Already some time ago I wanted to add support for GPC strings in GDB pascal extensions. But when I tried to look at it I discovered that its changes from the version I used at that time to a more recent one (this was around a year ago or even more).
Are GPC strings now stable ?
More or less, yes. We'll add BP compatible strings someday, but they won't influence the format of existing strings.
I need some advice about the following:
This is what I got using gpc2953 for djgpp I do understand the meaning of the two first fields quite easily, but what is _p_schema_ ???
AFAIK (I'm not too familiar with these issues myself), this is the field that contains the actual characters.
While is the length indicated as having 12 bytes when apparently only 9 are used (is this just padding) ?
I can't read stabs, so I don't know where it says that length has 12 bytes.
Most importantly, where are the chars ? This the length of the stabs incorrect and a variable just has the chars at the end of this kind of header (as Free Pascal Ansistrings do) ? Or is the data accessed via some pointer again.
No, the format is:
type String (Capacity: Integer) = record Length: 0 .. Capacity; String: packed array [1 .. Capacity + 1] of Char end;
So, there's the Capacity field (type Integer, i.e. 4 bytes on IA32, but not necessarily on every platform), Length (same type), and then the chars (1 extra char for a #0 terminator when interfacing to C strings, and probably padded for alignment, I guess).
But I think the debugger shouldn't need hard-coded field sizes/offsets and can use the field names (Capacity, length, _p_schema_).
However, there might be errors in the stabs output generated by GPC. Since I can't read stabs, I can't tell.
Frank