[fpc-devel] -godwarfsets and set encoding

Martin lazarus at mfriebe.de
Thu Jan 6 16:56:14 CET 2011


  Couple of observations, along with the questions:
- are they known ?
- caused by fpc ?
- caused by gdb ?

observed with
- fpc.2.4.4 and trunc (aprox 2 month old)
- gdb 6.7.50, 7.0 and 7.2-1
all on w32 vista

given:
   type
     TEnum = (One, Two, Three);
     TEnumSet = set of TEnum;
   var
     ArgEnumSet: TEnumSet;

issuing the following at gdb
   Whatis ArgEnumSet
   ptype ArgEnumSet
   Whatis TEnumSet
   ptype TEnumSet

Stabs are nice and consisten:
<Whatis ArgEnumSet>   ~"type = TENUMSET\n"
<ptype ArgEnumSet>    ~"type = set of TENUM\n"
<Whatis TEnumSet>      ~"type = TENUMSET\n"
<ptype TEnumSet>        ~"type = set of TENUM\n"

Dwarf without sets just give TEnumSet on all questions, but thats ok....

Dwarf with sets:
<Whatis ArgEnumSet>    ~"type = TENUMSET\n"
<ptype ArgEnumSet>      ~"type = set of "
                                           ~"ONE..THREE\n"
<Whatis TEnumSet>       ~"type = set of "
                                           ~"ONE..THREE\n"
<ptype TEnumSet>         ~"type = set of "
                                          ~"ONE..THREE\n"

So for some reason dwarf does resolve TEnum into it's definition => 
there is no way of getting that it is a "set of TEnum".
As long as "ONE" is only defined as a member of TEnum, and has no other 
meaning, it is possible to ask what ONE is...

Also curious where the new lines are coming from?
May be gdb, as gdb 7.2-1 breaks the line differently ( also one more 
line break):
<ptype ArgEnumSet>
   ~"type = set of ONE"
   ~"..THREE"
   ~"\n"


Getting the ".." notation means that it is impossible to get a complete 
list of all the enum values in the set....

-----------------------------
If you have:
   type
     TSet = Set of (Alpha, Beta, Gamma);
   var
     ArgSet: TSet


then STABS reports
<ptype ArgSet>     ~"type = set of  = (ALPHA, BETA, GAMMA)\n"
good => got a list.
strange => got that extra "=" after "set of "

DWARF with sets reports again
<ptype ArgSet>   ~"type = set of "
                              ~"ALPHA..GAMMA\n"

No way to get all the entities of the set.
<ptype ALPHA>     ~"type =  = (ALPHA, BETA, GAMMA)\n"
helps, except is alpha is locally defined as some other type....













More information about the fpc-devel mailing list