[Lazarus] BreakIf
Marc Weustink
marc at dommelstein.nl
Fri Mar 27 16:02:26 CET 2015
Joost van der Sluis wrote:
> 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...
when setting a BP, (the original) fpdebug checks if location of the BP
already has a INT3 (not sure about INT 3). In that case it doesn't
insert a new one, it only records it.
So fpdebug is aware of coded breakpoints. when it hits a coded BP, it
stops execution (and might raise a SIGTRAP)
Marc
More information about the Lazarus
mailing list