Tools > Configure Build IDE
If you use gdb add
-gw -godwarfsets -O-
If you use fpdebug add
-gw3 -O-
Other options, as you like: -Criot -Sa -gh
Rebuild the IDE.
The open from the install folder ide/lazarus.lpi
And hit Run / F9
---
Some packages do not follow the global settings, then
$(IDEBuildOptions)
to the packages custom options