DebugTools library
What is it
DebugTools is a library containing common debugging tools for code written in C++. (Since version 0.3.0, the library is for C++ only. The old C/C++ version is maintained on the 0.2 branch.) There are four major tools - a logger, a memory tracker, a stack/execution tracer (which can also work as a profiler), and a unit testing framework.
The goal of the project is to develop a powerful self-debugging/profiling library, completely re-usable in any C++ project on any platform.
Features
- Free and open source (zlib license)
- Written entirely in C++ with very few dependencies, even on the standard libraries (no STL, except for the optional STL-related features)
- Logger
- Modular and customizable logging destination and style
- Logging output is structured to allow automated processing if needed
- Memory allocation tracker
- Ability to mix code which uses the Memory tracker with (usually external) code which doesn't.
- Option to simulate the maximum available memory (useful for memory-limited devices)
- Option to log all allocations when total allocation reaches a specified amount (useful when optimizing the memory usage of an application)
- Option to break into the debugger on a specified allocation id, or log the stack trace at that point (useful when hunting leaks).
- Option to log the peak memory footprint (all memory allocations at the peak of memory usage) at program exit
- Option to mark and release all allocations made by a block of code
- Option to supply custom allocators for tracked and untracked allocations
- Stack tracer
- Requires manual function instrumentation
- Option to profile function calls and code blocks
- Option to log the complete program flow
- Uses DbgHelp on Win32 for automatic stack tracing (without manual instrumentation)
- Unit testing framework
- Simple test definitions with automatic registration
- Test fixtures
- Option to customize the test tracking
- Test for C++ exceptions and assert failures
- Catch unhandled system exception with the VC++ compiler
- Catch memory leaks
- Option for non-fatal tests which do not fail the final test result
- Test timing
- Platform independence
Supported platforms (so far):
- Win32 (Desktop Windows, Windows Mobile)
- Symbian OS (Nokia Series 60)
- PalmOS
Supported compilers (so far):
- Microsoft Visual C++ 6.0 / 7.0 / 7.1
- Microsoft Embedded Visual C++ 3.0 / 4.0
- MinGW (as included in Dev-Cpp and Borland C++ BuilderX)
- GNU C++ (as included in the Series 60 SDK)
- Metrowerks CodeWarrior for PalmOS
- Additional Win32 tools, like crash handling and DbgHelp support
- Thread safety for all modules
Example
This is sample output of the self tests:
HTML format: test.html
Plain text format: test.txt
Download
| Version |
Date |
File |
Changes |
| 0.4.0 |
20 December 2005 |
DebugTools0.4.0.zip |
- Added unit testing framework (the Tester)
- Many bug fixes and code improvements
- Added Visual C++ 2005 (8.0) project files
- Documentation not complete yet
- No time to support the C++ BuilderX, Series 60 and PalmOS ports
|
| 0.3.0 |
8 April 2005 |
DebugTools0.3.0.zip |
- Major redesign. Moved entirely into C++, C support was dropped
- Much cleaner code
- Unit tests
- New features, mostly in the Logger (structured logging format, isolated log target and formatting)
- Added Dev-Cpp and Borland C++ BuilderX project files
- No time to test Series 60 and PalmOS support
|
| 0.2.1 |
24 February 2005 |
DebugTools0.2.1.zip |
- Added Microsoft Visual C++ 7.1 project files
- Bug fixes and code improvements
|
| 0.2.0 |
5 October 2004 |
DebugTools0.2.0.zip |
- Improved C++ new/delete handling
- Any combination of tracked/untracked delete chains is handled
- An option to log the peak memory footprint (all memory allocations at the peak of memory usage)
- Memory tracking blocks (mark and release all allocations within a code block)
- PalmOS support started (not fully tested yet)
- Doxygen documentation
- Lots of bug fixes and improvements
|
| 0.1.0 |
10 March 2004 |
DebugTools0.1.0.zip |
Initial version. |
If you want access to the latest state of the project, or even take part in the development of the library, please contact the authors at the e-mail address specified below.
Documentation
Look at the included docs/DebugTools.chm or use Doxygen to build the HTML documentation.
Look at the DebugToolsTest project and the included unit tests for usage examples.
License
The most relaxed zlib license. Read it here.
Authors/Contributors
- Ivan Kolev, mail to ik at ikolev com