Lazarus
Using the Lazarus IDE => Debugger => Topic started by: pcurtis on October 21, 2021, 12:21:09 pm
-
Is there a way to disable the debugger for a section of code?
-
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.
-
If i remeber correctly, delphi you could do
{$IFDEF DEBUG}
{$D-}
{$ENDIF}
.... your code
{$IFDEF DEBUG}
{$D+}
{$ENDIF}
never tried it laz/fpc + i could be totally wrong
Josh
-
never 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
-
never 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 :o
-
Thanks for checking and correcting me :-)
MarkMLl
-
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.
-
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 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
-
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 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 ....