[fpc-devel] Archer and Dwarf-3

Joost van der Sluis joost at cnoc.nl
Wed May 20 23:26:50 CEST 2009


Hi all,

I've switched back to Linux/Fedora 11 to continue testing Dwarf-3 and
Archer further. (Because that's my natural habitat, Windows just slows
me down - especially using GIT)

So I'm on the 'official' fedora-archer-gdb version now, and recent
fpc-trunk.

I have a few remarks:

Case sensitivity

The name of dynamic arrays are case-sensitive, while the names of
'normal' arrays aren't case-sensitive. When you look at the code of
dbgdwarf this makes sense, since for 'normal' arrays the dwarf-2 code is
called, while for dwarf-3 some other code is executed. So it could be
that the dwarf-3 code is case sensitive, but I can't see why. Besides,
using objdump -w, I see no difference between the defined name of a
dynamic array and a normal array. So why does gdb handles them
differently?

When dwarf-2 is used, all names are stored in capitals into the
debug-information. For dwarf-3 they are stored as how ther are defined
in the sources. Is that something new in dwarf-3? That you can supply
the casing as it is in the source, but that they still can be handled
case-insensitive?

Printing arrays

Printing the contents of an array doesn't work (print arrr). They are
showed as a pchar, but using 'whatis arr' then the type is correctly
given. Except that the size of dynamic arrays is bogus. (way too large)

Using 'print[x]' works fine on arrays of shortint, though. But it fails
on arrays of ansistrings. It always prints the value of the first
member. I would say that this is a gdb bug, and not the debug-info. But
that's just a guess.

Outside an array, ansistrings work fine!

Joost

ps, code I used:

program debugtest;

{$mode objfpc}{$h+}

uses sysutils;

var DArr : Array of integer; // case sensitive
    Arr : Array[0..9] of integer; // case insensitive
    SArr : array[0..9] of string; // case insensitive
    SDArr : Array of string; // case sensitive
    s   : String; // case sensitive
    i   : integer; // case sensitive

begin
  s := 'Test'#0'String';
  SetLength(Darr,10);
  SetLength(SDArr,10); 
  for i := 0 to 9 do
    begin
    Arr[i] := i;
    DArr[i] := i+100; 
    SArr[i] := 'str'+inttostr(i);
    SDArr[i] := 'str'+inttostr(i+100);
    end;
  writeln(s); // I've placed a breakpoint here and printed the var.
  for i := 0 to 9 do 
    writeln(arr[i],'-',darr[i]);
  for i := 0 to 9 do 
    writeln(Sarr[i],'-',Sdarr[i]);
end.






More information about the fpc-devel mailing list