4 ms·
I have written a C/C++ tool to find deadlocks under Windows. It should not replace existing tools but extend the tool collection. The tool does monitor Windows
by __builtin_trap 3y ago
I have written a C/C++ tool to find deadlocks under Windows. It should not replace existing tools but extend the tool collection.
The tool does monitor Windows Critical Sections and std::mutex. This allows you to test whole programs (or a DLL) or source code parts that are not testable with ThreadSanitizer under Linux. It uses the deadlock algorithm from the C++ library Abseil.
The API monitoring works like that: The header file cppguard.hpp is automatically included in all source files using the Visual Studio option “Forced Include File”. Macros like #define EnterCriticalSection(x) cppguard_enter_critical_section(x) will intercept the API call. This works better than expected.
Later I want to try to extend the tool to find memory and handle leaks as well. On other idea is to provide robustness test e.g. sockets functions will return an error now and then. However, the tool should always remain fast.
- jjgreen 3y agoThat's just a C++ tool right?
- __builtin_trap 3y agoto compile CppGuard you need C++, but you can also Test programms written in C