A basic understanding of how Valgrind works on Linux



A MinGW and MSYS installation, and some experience of gcc in general and MinGW in particular

An SVN client, to keep up with upstream development



Autotools, to be able to run the autogen.sh. If requested, I might be convinced to run a make dist now and then to create a tarball that includes my diffs and a pre-generated configure script.

Debugging tools for Windows, to get the latest windbg.dll, and to get WinDbg which is essential for finding out how undocumented things work. (Of course, if you have more advanced tools like SoftICE available, the better.)

Literature (or a good knowledge of these things by heart...). I recommend the following books:

Windows NT/2000 Native API Reference by GaryNebbett. Documents the kernel "native" API. Needed for writing wrappers for kernel system calls. Might be hard to find. Much of the same information is also available on the web.



by GaryNebbett. Documents the kernel "native" API. Needed for writing wrappers for kernel system calls. Might be hard to find. Much of the same information is also available on the web.

Windows Internals, Fifth Edition by Mark E. Russinovich, David A. Solomon and Alex Ionescu. A classic, the fifth edition of which has just been published.

by Mark E. Russinovich, David A. Solomon and Alex Ionescu. A classic, the fifth edition of which has just been published.

Advanced Windows Debugging by Mario Hewardt and Daniel Pravat.

by Mario Hewardt and Daniel Pravat.

Windows Graphics Programming: Win32 GDI and DirectDraw by Feng Yuan might also be useful.



by Feng Yuan might also be useful. Wine and ReactOS sources can be useful at times

Decide whether all this makes any sense at all, whether it's best just to declare it a failure before wasting any more time.



Write wrappers for more kernel system calls.

Write wrappers for such Win32 (GDI, USER) system calls that modify data (to tell the tool what memory has been written to, to avoid invalid warnings about use of uninitialized data). Mostly undocumented territory here.



Fix the mysterious issues in handling callbacks from system calls (this happens a lot in GUI programs; in fact most user code in such executes in callbacks). Callbacks are a bit like signal handlers in POSIX, except that they aren't, as callbacks and system calls can be stacked arbitrarily high.

in GUI programs; in fact most user code in such executes in callbacks). Callbacks are a bit like signal handlers in POSIX, except that they aren't, as callbacks and system calls can be stacked arbitrarily high. Fix issues related to communication with csrss.exe. Again, this is mostly undocumented foo...



Does SEH need any handling?

Read MSVC debugging information (.pdb files). (Either using Microsoft's APIs, or the existing code in Valgrind.)



Test on Vista and Windows 7

Make it cross-compilable from Linux



Make it buildable with Microsoft's tools. (Either just a makefile for nmake, or a Visual Studio project.)



Once it works well enough, some kind of integration with Visual Studio

During the ongoing Novell Hack Week I have been working on a port of Valgrind to Windows. I had done some initial hacking on this earlier this year in my spare time, but then left it to rest.At first I had to resolve lots of SVN merge conflicts after doing an SVN update for the first time in months. The code for Darwin had been merged into Valgrind's trunk and this of course had touched lots of the same places that also my changes touch. After getting it to build again I was relieved to find that it still worked more or less like last time I had hacked on it, and I could continue with real coding.Despite warnings from upstream developers that a Windows port of Valgrind would basically mean a total rewrite, it hasn't turned out to be that bad. In most of the source files with conditional compilation for the different platforms, the Windows code is basically just one more elif branch. Many parts of Valgrind, like the VEX virtual CPU or the Stabs and Dwarf debug information handling, practically work as such also on Windows.So, does Valgrind work on Windows? Yes but actually no;)For trivial console programs, sure, it kinda works, Memcheck detects the kinds of errors it is supposed to detect. (Memcheck is the only Valgrind tool that builds so far.)But for "real" programs with a GUI it basically doesn't work. A lot of work remains to be done, and some mysteries remain to be solved. A healthy dose of pessimism is useful: I am not that sure it will ever work well enough to be useful.What kinds of applications could Valgrind eventually be useful for on Windows? Personally, I would look forward to the possibility to use it on Open Source applications based on Open Source libraries like the GTK+ and (partial) GNOME stacks. GIMP or Evolution come to mind. Why not Qt-based applications, too. Perhaps even OpenOffice.org. I am not personally interested in making Valgrind work for applications based on weird proprietary technologies like COM.I have been hacking it on 32-bit XP. Some minor additions are needed to handle also WOW64, i.e. 32-bit code on 64-bit Windows, and more major additions for 64-bit Windows.So, what can you do to help? If you are an application developer with no in-depth Windows knowledge, don't bother. If you are an experienced Windows hacker with knowledge of kernel and Win32 subsystem system calls (or are prepared to learn about such things, like I was), you can help.For anybody interested in helping, prerequisites would be as follows:What remains to be done? Lots of things. Off the top of my head:It is a bit sad that when doing web searches for undocumented Windows information useful in a project like this, a lot of the times you end up at information originating in the malware-oriented community.Making Valgrind buildable with Microsoft tools would not be impossible. If I get offers of help from otherwise qualified people who would want to help but can't/won't use MinGW, I might try. A couple of short inline assembly parts would need MSVC syntax versions. A couple of assembler source files would need MASM syntax versions. Does MSVC support vararg macros in its preprocessor?I have diffs at http://www.iki.fi/tml/valgrind/ . Apply to valgrind trunk from SVN as of the time indicated. Making binaries available is not really useful at this stage (if ever).