[fpc-devel] x86_64 stabs info - patch (sort of)

Willibald Krenn Willibald.Krenn at gmx.at
Tue Oct 12 22:31:06 CEST 2010


Am 12.10.2010 21:02, schrieb Jonas Maebe:
>> I don't know exactly what to conclude from this discussion.
>
> Try using the -WB0040000 command line option.

PS C:\source\bugs\exception> del *.o
PS C:\source\bugs\exception> del *.exe
PS C:\source\bugs\exception> fpc -gw -WB0040000 .\project1.lpr
PS C:\source\bugs\exception> gdb .\project1.exe
(gdb) list
invalid dwarf2 offset 504164
(gdb)

>> Are 32 bit pointers enough for WinPE? Then stabs would be fine anyways.
>
> The problem is that GDB (at least in the past) zero-extends all offsets
> in the stabs debug information. That means that a local variable at
> location ebp-16 is interpreted as being at location ebp+4294967280.
> There are probably more such small problems, because Stabs was never
> designed nor implemented to be used for 64 bit platforms within the GNU
> tool chain.

At least on my system, having stabs info like the following

58     FUN    0      18     0000000000401540 3216   RAISEEXCEPTION:F1
59     PSYM   0      20     00000000fffffff8 3234   A:5
60     PSYM   0      21     00000000fffffff0 3238   B:5
61     PSYM   0      22     00000000ffffffe8 3242   C:5
62     PSYM   0      23     00000000ffffff90 3246   D:6
63     PSYM   0      24     00000000ffffff88 3250   E:7
64     SOL    0      0      0000000000401540 3254   project1.lpr

yields

Breakpoint 2, RAISEEXCEPTION () at project1.lpr:44
44        raise EAbort.Create('test');
(gdb) info locals
A = 20
B = 1
C = 2
D = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 
19, 20}
E = 0x42c150 'Hello World!'

which is quite ok ;-).

>>> You may also want to try with the external linker (-Xe).
>>
>> Hmm, -Xe does not seem to work on my system.
>
> What does "not work" mean?

Sorry, I meant to say that it does not improve the situation.

PS C:\source\bugs\exception> del *.o
PS C:\source\bugs\exception> del *.exe
PS C:\source\bugs\exception> fpc -gw -Xe .\project1.lpr
[0.578] Using util C:\source\mingw64\bin\ld.exe
PS C:\source\bugs\exception> gdb .\project1.exe
(gdb) list
invalid dwarf2 offset 6439543

> I'm not opposed to committing that change, it's just that Stabs is a
> dead end and since no compiler I know of uses it for generating 64 bit
> debug information (other than a few older Mac OS X compilers, but Mac OS
> X uses its own fork of GDB), it's probably also very badly tested within
> GDB itself.

Yes, I understand that stabs is a dead-end. But it's also very useful if 
you want to work with the compiler on Win64 :)

Cheers,
  Willi



More information about the fpc-devel mailing list