Re: Delphi debugging problems

Posted by webmaster Guido on July 09, 2005

In Reply to: Delphi debugging problems posted by Elaine P15160 on July 08, 2005

: I have a problem in debugging my Delphi programs.
: When I set a break point in the code, it does not stop at the point where I assigned the breakpoint, but elsewhere. It appears as though it does not relate with the actual code.

When Delphi compiles the source code, it can "optimize" the program, replacing code (mostly loops) by more efficient code. That's probably what is happening in your case.

Therefore, it's best to switch of this code optimization as long as you are in the debugging phase. Only optimize before a last compile, when the program is bug-free.

Uncheck this option (exact location can depend from your Delphi version) :
Project Options : Compiler : Code generation : Optimization

Good luck!
Guido, DelphiLand Team