Source line with only 'Exit' cannot have a breakpoint? lazarus / 12-Debugger ---------------------------------------------------------------------- AlexTP · 2022-03-18 18:24 As I see - SUBJ - yes, it cannot have a breakpoint. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if SomeTest() then  Exit; IDE don't allow to place it on 'Exit' line. So I must add 'begin end' with additional fake operator like "if Assigned(fm) then ;". Not handy. ---------------------------------------------------------------------- MarkMLl · 2022-03-18 18:27 But exit(something) will usually work since it actually generates code rather than being a syntactic element... I've not tried exit(result). MarkMLl ---------------------------------------------------------------------- Martin_fr · 2022-03-18 18:40 It's something the compiler decides. The debugger just "reacts". (Not tested, but...) Have you tried with -O- ? No optimization at all. Even -O1 could cause stuff like this. (At leat on Win...) In the same way, the compiler adds the info that some of the code in the final "end;" of a procedure is in the "begin" line. Hence the debugger jumps around. The fact that it jumps several times, is because it "steps over" the internal "finally" block that fpc added (and finally is a subroutine). That (the several times jumping around) is something that should be fixable in the debugger (in FpDebug). ---------------------------------------------------------------------- MarkMLl · 2022-03-18 18:46 Curiously, I've noticed both of the issues Alex mentions myself over the last couple of weeks (Linux+gdb), which might be related to upgrading FPC from 3.2.0 to 3.2.2. if exit(result) worked I'd be tempted to define it as a macro EXIT_ or similar (I say that in order to bait somebody into telling me that it could be done better with templates). MarkMLl ---------------------------------------------------------------------- markftl · 2022-03-18 21:28 I usually use Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     if SomeTest() then begin      Exit;    end;  if I need to break at the exit. Has always worked for me.