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

Florian Klaempfl florian at freepascal.org
Tue Oct 12 09:25:50 CEST 2010


Am 12.10.2010 01:04, schrieb Willibald Krenn:
> Hi,
> 
> On my Win64 machine, gdb kept crashing whenever I tried to step into
> fpc_raiseexception with an error saying that the reg '-1' wasn't
> defined. And yes, stabs info showed:
> 
> 
> 4943   FUN    0      187    0000000000408710 66408  fpc_raiseexception:F129
> 4944   RSYM   0      625    0000000000000001 66432  OBJ:R129
> 4945   RSYM   0      625    0000000000000002 66441  ANADDR:R4
> 4946   RSYM   0      625    00000000ffffffff 66451  AFRAME:R4
> 
> (AFRAME should be 8, since it's passed in R8...)
> 
> So in the end I looked into x86reg.dat and was quite amazed that stabs
> index for all 'new' AMD64 regs is set to -1, which is wrong of course.
> Hacking along I changed the stabs-reg indices to match the dwarf64 index
> (see also here:
> http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/amd64-tdep.h?rev=1.18&content-type=text/x-cvsweb-markup&cvsroot=src)
> and after bootstrapping the compiler, I can now step into raise as
> expected. (That said, I did not double-check whether dwarf64 index
> always matches stabs index...)
> 
> Notice: This fix is absolutely necessary if you are working with Lazarus
> on Win64, as Lazarus automatically sets a breakpoint in fpc_raise...
> which then crashes gdb, which in turn crashes any running debugging
> session - in case an exception is raised. Of course it affects also all
> methods/funs that take e.g. three params that can be passed in regs...
> 
> Perhaps someone with more knowledge of stabs and the x86reg.dat can do a
> proper fix? TIA!

Afaik, stabs does not support x86-64 that's why it's probably never
fixed/noticed.



More information about the fpc-devel mailing list