Delphi .NET (2) Database (71) Delphi IDE (90) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
|
Delphi compiler settings for debugging
6 comments. Current rating: (4 votes). Leave comments and/ or rate it.
To be able to use the built-in debugger efficiently (and the same applies to external debuggers like TDW - Turbo Debugger for Windows), you need to ensure a few compiler settings are set the right way.
Important settings are:
- Optimization Off
Enabling optimization would prevent you from examining the value of a variable after it has gone out of scope. A variable is gone out of scope if there is no further reading access to this variable in the flow of code even though you may be far from the end of a function's code block. At that point it is no longer available for inspection - there's no point holding on to what no one else is going to need, right? Usually this seems to happen just right after you want to look at this value.. but instead you get an error message "Variable 'XXX' inaccessible here due to optimization".
So turn off optimizations for your debugging builds.
- Stack Frames On
This supports the ability to view the call stack. If this option is not turned on, then certain types of calls will be optimized to the point where they cannot be viewed.
I've found these two to be critical in my work with Delphi 5. Other good options for debugging purpose are to enable all built-in checks like Range and Overflow Checking and of course to enable Assertions - if you use the assert() statement in your code. I use assert() heavily.
A note on assert():
Always make sure that the term in your assertion does not have side effects. Look at the example below. The first assertion is ok, the second assertion is a bad idea because the code will be very different when assertions are disabled.
A production build should never include enabled assertions!
 | |  | | var
iResult : integer;
begin
iResult := function_call(x);
assert(iResult > 0);
assert(function_call(x) > 0);
| |  | |  |
Comments:
|
|
|
|
|
|
|
|
|
but why does the copiler kill my variable, if it's used in the prosedure. it works in thew first cycle and does not is the second one inside the CASE OF construction?
|
|
|
|
|
Please, could you help me? My program that run in Delpi 4 for several minutes, now runs extremely slowly, the whole day long. It seems that it happened after updates of Windows XP. But I do not understand the reason. If I compile program on my computer and then run *.exe file on the computer with Windows 95, it runs very quickly, and vice versa the same program compiled under Delphi 3 on the computer with Windows 95, runs very quickly on my computer with XP. But when I compile the same program under Delphi 4 or 5 on computers with Windows XP and run on the same computers, which are much more powerful than the computer with Windows 95, the program hangs for extremely long time (it calculates but very and very slowly). I do not know how to cope with this situation. Elena.
|
|
|
|
|
Please, could you help me? My program written under Delphi 4 that run for several minutes now runs extremely slowly (during the whole day). It is probable that it happened after updates of Windows XP, but I am not sure what could be the reason.
If I compile the program on my computer with Windows XP and then run on an old computer with Windows 95, it runs very quickly. The same program compiled under Delphi 3 on the computer with Windows 95 runs on my computer with Windows XP also very quickly. But if I compile it on my computer with Windows XP, under Delpi 4 or 5, it calculates extremely slowly. The same happens on the other more powerful computer with Windows XP. What may be the reason and is it possible to do anything to return to a normal work? Elena.
|
|
|
|
|
Where can I find the compiler on my computer?
|
|
|
|
|
Hi to all,
I am using delphi 7 and TMS Grid control. (TAdvStringGrid)
also i am having more than 1 million records on SQL Server. I want to
load that records to grid by loading on demand. That is if the user scroll
the mouse then only the next pages loaded fron server. is it possibe?
Please help me.
Thanks
P.Muthuraman
|
|