[fpc-devel] GDB barfs on FPC generated stabs.

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Sep 9 15:53:17 CEST 2007


On 09 Sep 2007, at 14:49, Bruce Tulloch wrote:

> ie, the DW_AT_comp_dir field is nil. It appears as if GDB mangles the
> name of the file if DW_AT_comp_dir is specified by prepending the
> difference between the full path and working directory to the reported
> file name. Based on your feedback it seems to do this in linux (Fedora
> in your case, Debian in mine) but not in Apple's fork of gdb.

There was actually a bug in our compiler: for source files not in the  
current directory, we set the "current compiler directory" to the  
location of the source file, but at the same time also specified that  
those source files were located in an "include directory" (which is a  
relative path from the cwd when you started the compilation).

I've fixed this now in svn. It won't be in 2.2.0 though, since that  
one will be released somewhere during the next couple of days.

> As for the stabs/crash problem, I've tried creating a few small test
> projects to reproduce it but so far have succeeded only with the very
> large application we're porting (which while it runs fine with Delphi
> has numerous other unrelated bugs from FPC's point of view).

The two major semantical differences between FPC and Delphi I'm aware  
of are described at
http://wiki.freepascal.org/index.php? 
title=Code_Conversion_Guide#Semantical_differences

Another issue is that uninitialized variables often have different  
values when the program is compiled with FPC rather than with Delphi,  
but that's not really FPC-specific. You can use -gt till -gttt in FPC  
to initialise all (non-refcounted) local variables, function results  
and out parameter with garbage (or with 0/nil in case of -gtttt, but  
that's not really recommended since it's more likely to hide than  
help find errors), to more easily track these down.

> I'll send an example project if/when I can create one.

Thanks.


Jonas



More information about the fpc-devel mailing list