The content of message Posted by: wp « on: June 29, 2018, 12:29:23 am is very good.
=== Windows only ===
For myself, in my FPC D:\fpc-laz-asus\FPC directory I have the following substructure :
D:\fpc-laz-asus\FPC\3_0_4 : Complete 3_0_4 source and -O2 units
D:\fpc-laz-asus\FPC\3_0_4-dbg-bak : Only units I build for debugging -O1 + some debug switches
D:\fpc-laz-asus\FPC\3_0_4-dbg : Only units that I copied from D:\fpc-laz-asus\FPC\3_0_4-dbg-bak that interest me with the correct substructure. They have to be deleted from this directory when in non debug mode
in fpc.cfg used by fpc.exe I have AFTER the
# searchpath for units and other system dependent things
etc... block
2 additional lines :
# DEBUG searchpath for debug units
-FuD:\fpc-laz-asus\FPC\3_0_4-dbg\units\$fpctarget/*
The fpc compiler then considers that additional -FuD as overrides, for .o and .ppu's in it, BEFORE the normal -O2 in D:\fpc-laz-asus\FPC\3_0_4\units are considered.
See attachment .txt file containing the commands I copy to the command prompt for
building the FPC rtl directory.
I more or less frequently also build debug version for \packages\fcl-db with usable results.
Switches that give me reasonable success for debugging are :
FPC : OPT="-O1 -gw2 -godwarfsets -gl"
+ in lazarus : -O1 -gw2 -godwarfsets -gl
option -OoREGVAR improves speed but makes debugging slightly more difficult ...
Note 1 : Sometimes I manage to make a real mess ... that takes hours to clean up. Dont forget backups !
Note 2 : If you have made modifications to an FPC source within Lazarus editor, don't forget to save them before redoing a make, I have been catched by that a few times.