Bryan Meredith wrote:
Hello chaps,
I have looked through the list but cant find anything definitive on this one...
I am using -gstabs to compile as -g on its own gives "internal error - unimplemented function unk_lang_create_fundamental_type called." (as per an earlier post).
I can get things to display by casting them to their type Type(Var) with initial letters capitalised. Where I get really stuck is trying to use this technique on a thingy (its a union in C - I dont know much pascal so I dont know what its called - sorry).
This isnt real code - its so I can try to explain a little better...
TYPE
header = RECORD item1 : WORD; item2 : WORD; item3 : LONGWORD; END;
type1 = PACKED RECORD hdr ; header; custom1 : BYTE; END;
{ you get the idea...}
thingy = RECORD CASE INTEGER OF 1: (member1 : type1); 2: (member2 : type2); 3: (member3 : type3); END;
VAR dummy1 : header; dummy2 : type1; dummy3 : thingy;
From within GDB when the program is running, I can inspect the contents of
dummy1 by doing
p Header(Dummy1) ( I would expect a simple p dummy1 to work but any debug is better than none).
Using gpc-20030507 (or newest gpc-20030830) and gdb-5.2 (or gdb-5.3) I have no problem to print dummy2:
(gdb) print dummy2 $8 = {Hdr = {Item1 = 0, Item2 = 0, Item3 = 0}, Custom1 = 0} (gdb) print dummy2.Hdr $9 = {Item1 = 0, Item2 = 0, Item3 = 0} (gdb)
However `dummy3' is a variant record. AFAIKS gdb lacks proper support for variant records (and gpc may have own problems, just masked by gdb inability). Variant records are very much like C unions -- but members (variants) are named by constants. It is possible to store name of active variant in a separate field (called selector), but this field is ommited from `dummy3', so you have to use the same methods you would use for a C union.
Just a little hint: call command in gdb allows you to write your own print functions -- may be worthwile if you will be working for long tie with the code.