Recent

Author Topic: debugging levels  (Read 3061 times)

cpat

  • Newbie
  • Posts: 6
debugging levels
« on: September 21, 2017, 08:34:04 pm »
I'm new to Lazarus and am attempting to debug the code I've written, not some Lazarus code that has been working for years.

How do I set any debugger options to only debug my code?

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: debugging levels
« Reply #1 on: September 21, 2017, 09:45:57 pm »
The debugger has no way to distinguish between your code and LCL code, so AFAIK this cannot be done by setting options.
In theory you could generate a Lazarus setup that had no debug info in the LCL ppus.
However, AFAIK, the makefiles specify the debug info should be added. So generating an LCL stripped of debug info is not for the faint-hearted. I suppose lazbuild can do this, but I've never tried.

I think, unless you are quite experienced at compiling complex projects and libraries and using compiler switches like -XX, -Xs, -CX that your best bet when debugging is to "step over" (F8) LCL routines rather than "step into" them. Just step into your own code routines as needed.

cpat

  • Newbie
  • Posts: 6
Re: debugging levels
« Reply #2 on: September 21, 2017, 10:27:10 pm »
Thanks,
while I was waiting I discovered another problem. Using Opera as my browser there was no 'Reply' button on this forum. I had to login on Firefox.

Michl

  • Full Member
  • ***
  • Posts: 226
Re: debugging levels
« Reply #3 on: September 21, 2017, 11:11:31 pm »
You have to build the LCL without debug symbols, then the degugger can't step into it.

Open MainMenu -> Package -> Open loaded Package ... -> Select LCLBase and open it.
In the new opened Package Manager Window open Options -> Compiler Options -> Debugging -> Deselect "Generate debugging info for GDB" and click OK.
Now click Compile.
The package would compiled without debug info.

Do the same for LCL.

Maybe it works without it, but no problems should occur, if you after that, in Package Manager, click on Use -> Install and rebuild IDE (all packages used by IDE that use the LCL are recompiled).

Now you can compile your apps without debugging the LCL (the LCL debug symbols aren't in your executable anymore) .

Edit: Btw, to just enable the debugging of the LCL in a special build mode or special project, you can add the wanted debug symbols in project options "Additions and Overrides".
« Last Edit: September 21, 2017, 11:29:23 pm by Michl »
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

 

TinyPortal © 2005-2018