Recent

Author Topic: How to Stop Debuggng on Internal Laz Files  (Read 648 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1269
How to Stop Debuggng on Internal Laz Files
« on: October 26, 2025, 12:17:45 am »
How do I stop the debugger from opening and debugging internal Laz files in Laz 4.2??
I am using the FpDebug option cause its the only one I could get working.
Also, a lot has changed sine 3.2... I am kind of lost with the debugger settings in this new version.
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 4.2.0 •  VSSTUDIO(.Net) 2022 • Win11 • 32G RAM • Nvida RTX 4070 Ti Super

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12014
  • Debugger - SynEdit - and more
    • wiki
Re: How to Stop Debuggng on Internal Laz Files
« Reply #1 on: October 26, 2025, 12:43:06 am »
You need to compile LCL (and other packages) without debug info.

(afaik) You can for many of them get that done by
menu Tools > Configure build lazarus
memo "custom options", add: -g-

You can also do it via "Addition and overrides", by creating a section for the packages in question (search wiki).

Or edit each package's options.



Btw, that is the same for all the debuggers. Gdb, lldb, they all will do the same for packages.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12014
  • Debugger - SynEdit - and more
    • wiki
Re: How to Stop Debuggng on Internal Laz Files
« Reply #2 on: October 26, 2025, 12:47:53 am »
Most of the time it should actually not matter.

If you step with F8 "step over" then you will not step into packages.

If you need to step in
Code: Pascal  [Select][+][-]
  1.   MyFunction(SomeLclFunction(1), 2);
Then you need F7 "Step into", which enters SomeLclFunction first.
But you can immediately use "Step out" and then "step in" again, at you will be in MyFunction

If your RTL is compiled with debug info, then that may step into other RTL functions (e.g. object/class checks)




If your problem is that at the end of
Code: Pascal  [Select][+][-]
  1. procuder TForm.Button1Pressed(Sender: TObject);
  2. begin
  3. //...
  4. end; // "step over" here

You do step into the LCL => that you can not avoid.

If you compile the LCL without debug info, then that will step into assembler.

The current function ends, the debugger will go to the calling function.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12014
  • Debugger - SynEdit - and more
    • wiki
Re: How to Stop Debuggng on Internal Laz Files
« Reply #3 on: October 26, 2025, 12:51:09 am »
Let me know which of the option you need info on....

This page https://wiki.freepascal.org/Debugger_Setup wich should open with F1 (it should, not tested now) looks still up to date...

Thausand

  • Sr. Member
  • ****
  • Posts: 454
Re: How to Stop Debuggng on Internal Laz Files
« Reply #4 on: October 26, 2025, 01:45:08 am »
You do step into the LCL => that you can not avoid.
If have set breakpoint fe want debug code onclick and want see many iteration then example describe can also have press run, then button click for new debug iterate.

If know where is continue code when LCL is return and there have other breakpoint then run is make break for continue debug (where continue code not know every time, is depend on code  :) )
« Last Edit: October 26, 2025, 01:52:27 am by Thausand »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12014
  • Debugger - SynEdit - and more
    • wiki
Re: How to Stop Debuggng on Internal Laz Files
« Reply #5 on: October 26, 2025, 10:20:36 am »
If I understand the below: It is stepping at the end of a function?

If know where is continue code when LCL is return and there have other breakpoint then run is make break for continue debug (where continue code not know every time, is depend on code  :) )

- So you are at the end of (example): "Button1Click".
- Then your code has Button2Click, Timer1Timer, Edit1EditDone, Edit1KeyDown, Form1Focus, ..... many events
And you want to stop in any of them?

Then you must set a breakpoint in every one of them. Stepping can not do that.


Alternative you change your code for debugging

In each and every procedure, as the very first line
Code: Pascal  [Select][+][-]
  1. procedure Form1xxxxx;
  2. begin
  3.   MyDebugHelpFunction;
  4.   ....

and
Code: Pascal  [Select][+][-]
  1. procedure MyDebugHelpFunction;
  2. begin
  3.   sleep(1);  // ONE breakpoint here
  4. end;

(there are similar ways with debugbreak from the windows kernel, or asm code / but they need a bit more knowledge)

 

TinyPortal © 2005-2018