Forum > Debugger

[CLOSED] Disable debugger

(1/2) > >>

pcurtis:
Is there a way to disable the debugger for a section of code?

ccrause:
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:
If i remeber correctly, delphi you could do


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$IFDEF DEBUG}{$D-}{$ENDIF} ....  your code {$IFDEF DEBUG}{$D+}{$ENDIF} 
never tried it laz/fpc + i could be totally wrong

Josh

MarkMLl:

--- Quote from: josh on October 21, 2021, 02:13:19 pm ---never tried it laz/fpc + i could be totally wrong

--- End quote ---

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:

--- Quote from: MarkMLl on October 21, 2021, 03:01:11 pm ---
--- Quote from: josh on October 21, 2021, 02:13:19 pm ---never tried it laz/fpc + i could be totally wrong

--- End quote ---

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

--- End quote ---
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  :o

Navigation

[0] Message Index

[#] Next page

Go to full version