[CLOSED] Disable debugger lazarus / 12-Debugger ---------------------------------------------------------------------- pcurtis · 2021-10-21 10:21 Is there a way to disable the debugger for a section of code? ---------------------------------------------------------------------- ccrause · 2021-10-21 12:09 In a roundabout way, perhaps.  Move the code you don't want to debug into a unit (or units), disable all debug info, then compile with -Ur option.  Then move unit source and compiled unit (.o and .ppu) to a separate folder (this may not be necessary, but in my case it avoids confusion), add this folder to the project (or compiler command line using -Fu). Now a debugger will not find debug info for the compiled unit, and Lazarus will not try to recompile the unit to add back the debug info (which you obviously want to add to your project). This way you can still "step into instruction" when in assembler view, but normal F7 should step over a function call into this unit. ---------------------------------------------------------------------- Josh · 2021-10-21 12:13 If i remeber correctly, delphi you could do 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 {$IFDEF DEBUG}{$D-}{$ENDIF} ....  your code {$IFDEF DEBUG}{$D+}{$ENDIF}  never tried it laz/fpc + i could be totally wrong Josh ---------------------------------------------------------------------- MarkMLl · 2021-10-21 13:01 Quote from: josh on October 21, 2021, 02:13:19 pmnever tried it laz/fpc + i could be totally wrong Documentation at https://www.freepascal.org/docs- html/current/prog/progsu89.html#x97-960001.3.6 suggests that it's supported, so is worth trying. MarkMLl ---------------------------------------------------------------------- ccrause · 2021-10-21 13:10 Quote from: MarkMLl on October 21, 2021, 03:01:11 pmQuote from: josh on October 21, 2021, 02:13:19 pmnever tried it laz/fpc + i could be totally wrong Documentation at https://www.freepascal.org/docs- html/current/prog/progsu89.html#x97-960001.3.6 suggests that it's supported, so is worth trying. MarkMLl It is a global directive, so would not give local control over debug info.  I've tested this with FPC 3.2.0 and Lazarus 2.0.10 (win64), where the directive did not appear to have any effect at all ---------------------------------------------------------------------- MarkMLl · 2021-10-21 13:13 Thanks for checking and correcting me :-) MarkMLl ---------------------------------------------------------------------- Martin_fr · 2021-10-21 13:36 If you do not want to "step in" => disable debug info for that code (that is per package only // well you may be able to do per unit, but not sure) If it is exception handling => no, because that happens in the code of the "raise" procedure, and therefore is not bound to any section of code. ---------------------------------------------------------------------- MarkMLl · 2021-10-21 17:19 Quote from: Martin_fr on October 21, 2021, 03:36:38 pmIf you do not want to "step in" => disable debug info for that code (that is per package only // well you may be able to do per unit, but not sure) If I might ask a stupid question: what is a package in this context? If it's to do with Lazarus rather than FPC, what would happen if a program were built with a makefile? MarkMLl ---------------------------------------------------------------------- Martin_fr · 2021-10-22 11:54 Quote from: MarkMLl on October 21, 2021, 07:19:47 pmQuote from: Martin_fr on October 21, 2021, 03:36:38 pmIf you do not want to "step in" => disable debug info for that code (that is per package only // well you may be able to do per unit, but not sure) If I might ask a stupid question: what is a package in this context? If it's to do with Lazarus rather than FPC, what would happen if a program were built with a makefile? MarkMLl Lazarus Package. In Lazarus you have compiler options for the project, and each package. So if you want to compile a single unit without debug info ....