[Lazarus] BreakIf

Joost van der Sluis joost at cnoc.nl
Fri Mar 27 14:17:22 CET 2015

On 03/27/2015 01:45 PM, JuuS wrote:
> procedure BreakIf( b : Boolean );
> begin
>   if b then
>   asm
>     INT 3    <======debugger would then stop here
>              and one could then F8 step to the offending
>              routine based on the boolean condition passed
>   end;
> end;
> I believe this is windows specific (?) and I'm now working on Linux
> machines.
> The question is:
> This does not work in Linux and I wonder if there is a similar way to
> achieve this in Linux environment?

Wow.. that's a nasty trick....

And it should still work, also on Linux.

But I think that debuggers nowadays are more clever, they detect that 
the breakpoint is actually self-inflicted, and so they decide to 
continue. After all: the developer can have it's reasons to call this 
interrupt, and the debugger should not influence normal execution.

I don't know if fpdebug has this same check. (I think it has, though, 
but I'm not sure) If you are using a development Lazarus version you can 
try to install the LazDebuggerFp package, and choose the 'Fpdebug 
internal Dwarf-debugger' as debugger in the debugger-options. See what 
happens if you do that...



More information about the Lazarus mailing list