[Lazarus] How to make debugging ignore exceptions?

Martin Frb lazarus at mfriebe.de
Sun Jun 25 15:04:12 CEST 2017


On 24/06/2017 07:23, Bo Berglund via Lazarus wrote:
> I might add that I have visited:
>   Tools/Options/Debugger/Language Exceptions
> and unchecked the box "Notify on Lazarus Exceptions"
> (which is a similar setting as in Delphi).
> But it does not stop the IDE from breaking on the exception handler I
> want to debug.
> I need to stop the Lazarus debugger pop-up from triggering by the
> exception and allow me to reach the exception handler instead.
> How can this be accomplished?
>

Do you want it to "not stop at all"
Or do you want it to "stop in the except/finally block"?

If you want to get to the finally block, then you have to stop in the 
except first, and then do single steps. That should take you there.
There is no way to stop directly in the finally/except block.

If you do not want to stop at all, then that is "Notify on Lazarus 
Exceptions"
That is all exceptions by "raise ...".
Run errors are separate, so are Signals (SigSegV, Sig....). Signals can 
afaik not be suppressed.

"Notify on Lazarus Exceptions" just prevents the notification, internally the execution still stops, but is continued immediately.
If of course your code throws hundreds of exceptions, then that still is a slow down.
There is no option to prevent this.


For the handling of exceptions see
components\lazdebuggergdbmi\gdbmidebugger.pp line 5531
   procedure ProcessException;
nested in
function TGDBMIDebuggerCommandExecute.ProcessStopped

To prevent the internal stop in exceptions search the file for FExceptionBreak

You will find calls to
    FExceptionBreak.SetByAddr
or
    FExceptionBreak.SetBy....
    FExceptionBreak.SetBoth
    FExceptionBreak.SetAt...

Those need to be commented out.



More information about the Lazarus mailing list