I now have committed into GDB CVS tree my main patches to add pascal support into the GNU Debugger. To test it out, simply go to sourceware.cygnus.com/gdb and see the CVS checkout instructions.
I have an unsubmitted patch that would handle GNU Pascal TP like Strings better, but as my GNU Pascal knowledge is close to zero, I would like to know if someone is working with the CVS tree of GDB?
Currently, only Free Pascal strings are printout in a pascalisch way, whereas GNU pascal strings are printed out as records.
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
On 4 Sep 00, at 10:47, Pierre Muller wrote:
I now have committed into GDB CVS tree my main patches to add pascal support into the GNU Debugger. To test it out, simply go to sourceware.cygnus.com/gdb and see the CVS checkout instructions.
I have an unsubmitted patch that would handle GNU Pascal TP like Strings better, but as my GNU Pascal knowledge is close to zero, I would like to know if someone is working with the CVS tree of GDB?
Currently, only Free Pascal strings are printout in a pascalisch way, whereas GNU pascal strings are printed out as records.
GPC strings are schema, and therefore printing them out as records is not too far off the mark.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) Author of: Chief's Installer Pro v5.22.1 for Win32 http://www.bigfoot.com/~African_Chief/chief32.htm Email: African_Chief@bigfoot.com
Prof Abimbola Olowofoyeku wrote:
On 4 Sep 00, at 10:47, Pierre Muller wrote:
I now have committed into GDB CVS tree my main patches to add pascal support into the GNU Debugger. To test it out, simply go to sourceware.cygnus.com/gdb and see the CVS checkout instructions.
I have an unsubmitted patch that would handle GNU Pascal TP like Strings better, but as my GNU Pascal knowledge is close to zero, I would like to know if someone is working with the CVS tree of GDB?
Currently, only Free Pascal strings are printout in a pascalisch way, whereas GNU pascal strings are printed out as records.
GPC strings are schema, and therefore printing them out as records is not too far off the mark.
Some notes on debugging info for schemata:
Schemata are represented as records where the discriminants look like regular fields, and the schema's contents are a special field called `schema$'. The example below shows a schema record, a schema array and a (less common) schema that contains a plain type, and what gdb (without any Pascal support) prints for them.
To access schemata under gdb comfortably, it would be best if gdb simply "skips" the `schema$' field (like an implicit `with' statement in Pascal), i.e., it should translate:
Foo.Discriminant Foo.Discriminant Foo.Bar Foo.schema$.Bar Bar.Discriminant Bar.Discriminant Bar[n] Bar.schema$[n] Baz.Discriminant Baz.Discriminant Baz Baz.schema$
I hope that's easy to do. The identifier `schema$' should make those fields to "skip" easy to recognize.
Strings are a little different: Capacity is a regular discriminat (as described) above, and the characters are stored in the `schema$' field (so far, that' just like a schema array). However, the Length field is not stored within `schema$' (because that's an array), but as a field `length' (lower-case) in the outer record. This means the following translations should be done:
S.Capacity S.Capacity S[n] S.schema$[n] S S.schema$[1..S.length] Length (S) S.length
I don't know if it's easy to make gdb recognize `Length' as a function and expand it like this. But perhaps it's easier if we add to the run time system a global `Length' function which can be called from gdb in the normal way (usually in Pascal code `Length' is expanded to inline code, of course, but adding a `Length' function for debugging shouldn't be a problem).
Likewise, we could also provide a routine (for debugging) that takes a Pascal string as an argument and returns its contents in a format gdb understands better (a CString, I guess). I don't know if that's easier, since gdb would have to call this function (unlike Length) automatically when the user wants to print a string.
program Foo;
type SchemaRecord (Discriminant : Integer) = record foo : Integer; bar : array [1 .. Discriminant] of Integer end;
SchemaArray (Discriminant : Integer) = array [1 .. Discriminant] of Integer;
SchemaInteger (Discriminant : Integer) = Integer;
var foo : SchemaRecord (42); bar : SchemaArray (42); baz : SchemaInteger (42); s : String (42);
begin
end.
(gdb) print Foo $1 = {Discriminant = 42, schema$ = {Foo = 0, Bar = {0 <repeats 42 times>}}} (gdb) print Bar $2 = {Discriminant = 42, schema$ = {0 <repeats 42 times>}} (gdb) print Baz $3 = {Discriminant = 42, schema$ = 0} (gdb) print S $4 = {Capacity = 42, length = 0, schema$ = {0 '\000' <repeats 43 times>}}
Frank