[fpc-devel] debug formats, differences and options?

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Nov 8 15:54:07 CET 2010


On 08 Nov 2010, at 15:34, Martin wrote:

> A few questions about the different debug formats (stabs, dwarf  
> 1,2,3(,4))
>
> I don't know at which stage debug info is added:  when creating .ppu/ 
> o or when creating .exe
> That is to say, when a unit is compiled into a ppu, do you already  
> need to decide on which format to use, or can you use one ppu and  
> later decide if the exe schould have dwarf or stabs?

The debug information is part of the object file format and hence is  
added when compiling the unit.

> In case it is in the ppu, are later dwarf downward compatible? eg,  
> compiling units with -gw3 or -gw4 => will it allow to create an exe  
> with -gw1 ?

Yes and no: you can compile your executable with any debug information  
you want regardless of the debug format used to compile its units, but  
the debug information in the units will not change. Furthermore, on  
some platforms, e.g. Mac OS X, the linker will strip all Stabs debug  
information if at least one object file contains DWARF debug  
information. On other platforms, the debugger may support mixing debug  
information in multiple formats in a single binary.

> Is there a list of the advantages, disadvantages of each format. (I  
> understand dwarf 3, and 4 are unstable, but what extra features to  
> they add (as in actually implemented features in fpc)

-gw4 does not do anything more than -gw3 at this time (and I don't  
think that it will any time soon). -gw3 adds support for ansistring/ 
widestring/dynamic arrays compared to -gw2 (they are treated like  
plain pointers with -gw2).

Stabs (-gs, the default on most non-64 bit platforms and on Win64) is  
legacy and will generally not be updated except for small fixes. Some  
things that -gw2 supports and -gs doesn't are declarations of absolute  
variables, and of properties that map directly to fields.


Jonas



More information about the fpc-devel mailing list