[Lazarus] BreakIf

Sven Barth pascaldragon at googlemail.com
Fri Mar 27 14:53:58 CET 2015

Am 27.03.2015 14:17 schrieb "Joost van der Sluis" <joost at cnoc.nl>:
> 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.

This might be true on an embedded system, but if you run any of the normal
OSes where you can't modify interrupt handlers anyway then on x86(_64) INT
3 (or $CC) /always/ means breakpoint. And from experience I know that both
GDB and WinDBG respect these as they should.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150327/b04f7ef4/attachment-0003.html>

More information about the Lazarus mailing list