by Bob Swart (aka Dr.Bob)
Turbo Debugger for Windows [16/32]
The first debugger that comes to mind when you think of a tool especially suited to debug your Delphi code is of course Borland's own Turbo Debugger for Windows. For the 16-bits version of Delphi you can find this debugger in the RAD Pack (which also contains Resource Workshop, Resource Expert, Visual Solutions Pack, the VCL source code and the ObjectPascal Language Manual). Alternately, you can buy the latest version of Turbo Assembler, which also includes Turbo Debugger for Windows. One of the reasons to use the stand-alone Turbo Debugger for Windows (and not the integrated IDE Debugger) is that the former just can do more things, like debugging DLLs for example.
For more information about Turbo Debugger for Windows and the RAD Pack for Delphi, check out Borland's website at http://www.borland.com/delphi/delcomp/radfact.html
HeapTrace, written by Juanco Añez, is a shareware heap debugger for Delphi 1.x and 2.x applications that enables debugging of heap memory use. HeapTrace helps you to find memory leaks, dangling pointers and memory overruns in your programs. It also provides optional logging of all memory allocations, de-allocations and errors. Usage of HeapTrace is fairly easy: just include HeapTrac as the first unit in your main project USES clause. HeapTrace is optimised for speed, so there's only a small impact on performance even on larger applications. HeapTrace is configurable and you can also change the format and destination of logging output, choose what to trace, etc. You can trace each allocation and de-allocation, and find out where each block of memory is being created and freed. You can leave HeapTrace compiled to your production executables where it will only activate itself when it sees the /HEAPTRACE option in the command line! You can tell HeapTrace to output heap memory errors to a log file, or have it raise an exception when the error occurs. Finally, HeapTrace can be used to simulate Out of Memory condition, to test your program in stress conditions.
You can find more information about HeapTrace at http://www.modelistica.com/heaptrace
MemMonD, written by Per Larsen, is another shareware memory monitor for Delphi 1.x applications. MemMonD is a stand-alone utility for monitoring memory and stack use. You don't need to change your source code, but only need to compile with debug information included. MemMonD detects memory leaks, de-allocations with wrong size, memory overwrites in the heap. It reports the 10 most stack consuming routines, does some limited performance profiling and more. The latest version MemMonD 2.11 adds tracking of memory used for code and static data as well as monitoring of global memory and DOS memory in the Windows VM.
MemMonD is for the 16 bit version of Delphi, only. TurboPower Software has purchased exclusive rights to the 32-bit version of MemMonD and are selling and supporting it under the name of Memory Sleuth.
For more information about MemMonD for Delphi 1.0x, check out Per Larsen's website at http://ourworld.compuserve.com/homepages/PBLarsen/memmond.htm
MemSleuth is the 32-bits big brother of MemMonD, written by Per Larsen, and licensed exclusively to TurboPower Software. Where MemMonD is for Delphi 1.x only, MemSleuth is only for the 32-bits version of Delphi.
For more detailed information about MemSleuth, check out the TurboPower Software website at http://www.tpower.com/sleuth.htm
Nu-Mega became famous with BoundsChecker, a debugger for C/C++ development environments. This debugging tool intercepts the new and delete calls to the memory manager, and uses this information to keep a list of allocated (and freed) memory. When a program terminates, BoundsChecker only needs to check the list of allocated memory to see which memory is not freed and - even more important - where it was allocated in the first place. Using this information, one can detect memory and resource leaks in C/C++ applications real fast. The only problem I had with BoundsChecker is that it can result in a very big list, especially when using a C++ Application Framework like OWL (Object Windows Library) or MFC (Microsoft Foundation Class). In these cases, it's hard to find out if a reported leak is indeed a leak, and whether or not it was caused by us or by the application framework. Because of this, I personally found BoundsChecker to be useful for small programs or program fragments, and not big entire C++ projects.
Why this long story about BoundsChecker for C++? Well, Nu-Mega has finished a new version of BoundsChecker for Windows that is also able to work with Delphi 2. BoundsChecker for Delphi can also pinpoint thousands of Windows (API) errors, including static, stack, and heap (pointer) errors, numerous API and OLE method errors and Windows OS-specific errors.
For more information about BoundsChecker for Delphi 2, check out the Nu-Mega website at http://www.numega.com/WWW/numega1/bounds.html
reAct is not really a Debugger for Delphi, but more a Delphi Component Tester. However, this tool is a real pleasure to use, so I couldn't resist including it in this list of debugging tools. Currently, reAct is for Delphi 2 only, but a 16-bits version is in the works (and should be available by the time you read this column).
reAct version 2.0 is a really nice component test file generator for Delphi 2.0. With it, you can quickly generate test programs for components, view and change properties at run-time with the built-in Component Inspector, monitor events in real-time (as events are triggered, LED lights flash), set breakpoints and log events visually and dynamically. You can find elusive bugs, evaluate third party components, and learn how poorly-documented components really work. If you build or purchase components, you need this tool. It's totally integrated with Delphi 2.0 and the CDK 2.0.
For more information about reAct, check out Eagle Software's homepage at http://www.eagle-software.com
For a "live" summary overview of the links mentioned in this column, point your browser at my homepage The Delphi Clinic at http://home.pi.net/~drbob/ and click on the "Dr.Bob's Journal" link. This link will bring you to the contents page that lists the bi-monthly themes and Delphi Internet Inspector columns, starting with this month on Debugging Tools for Delphi.