Recent

Author Topic: How debug RTL/Lazarus source code?  (Read 1114 times)

ssawgift

  • New Member
  • *
  • Posts: 48
    • My Personal Website
How debug RTL/Lazarus source code?
« on: November 28, 2022, 05:32:22 pm »
Is there any official method to step into (F7) source code of RTL/Lazarus components?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9870
  • Debugger - SynEdit - and more
    • wiki
Re: How debug RTL/Lazarus source code?
« Reply #1 on: November 28, 2022, 07:30:19 pm »
It should work for any code compiled with debug info.

So if the method you are looking for is in the LCL, then make sure the LCL has debug info (Dwarf, if you are using FpDebug / and you should use FpDebug).
If it is in LazUtils => then same for LazUtils.
Those can be set in the options of each package.
Those can also be set in project options "additions and overrides".
Those can also be set in menu Tools > "configure build lazarus" (custom options)



If you want to step into the RTL (or packages that are part of FPC) => then you need to build Fpc from scratch.... (with debug info)

duzenko

  • New Member
  • *
  • Posts: 41

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: How debug RTL/Lazarus source code?
« Reply #3 on: August 27, 2023, 08:06:01 am »
Recompile as deep as you need with debug info on, preferably also with optimizations off. Although I feel like these days the debug info is smart enough to consider optimizations into account as well, but since you're stepping at source level which might be erased / modified by optimizations, you might feel weird if the highlight skips certain lines. AFAIK RTL/FCL must be recompiled outside the IDE, as it only has direct access to LCL.

 

TinyPortal © 2005-2018