Home » Blog
date 17.Nov.2013

■ Full-featured debugging with minimal toolset: windbg


Most windows developers spend their life using Microsoft Visual Studio, an integrated development environment (IDE) that edits and debugs C++ programs and other languages. It is a splendid tool but over the years got extremely bloated. Version 6 that I mostly use is 175MB installed, whereas VS2010 breaks the scales at 1.57GB, a 10-fold increase of lard without much benefit <g>

Having one copy of visual studio installed is bad enough, but what if you had to have 10 copies? Nowadays, one needs to test code in a variety of operating systems, which means multiple virtual machines, each one of which needs a separate copy of the same programs and tools. I test on windows 98, 2000, XP, vista, windows 7, 8, 8.1 and don't forget that most versions have a separate 32 and 64 bit flavor... that's a lot of virtual machines!

After automatic windows updates gobbled up the allocated space in a few of the virtual machines I set up rather sparringly, I realized that I could uninstall visual studio and have almost the same debugging capabilities using a single 500KB (!) program windbg, the "user friendly" windows debugger. I have already praised windbg for post mortem debugging using crash minidumps so I am delighted to find yet another use for this miniature tool.

Debugging without visual studio requires:

Note you don't need the full debugging tools installation, you can just extract WINDBG.EXE (and its dependent libraries DBGENG.DLL and DBGHELP.DLL) and ignore the rest. Put the source code files in a folder, and the compiled executable + PDB files in a subfolder. Start windbg and use Open executable menu command to pick your program. Set the symbol, source and image file paths in File menu to the folders you just created with your project files, then hit <F5> to start debugging.

Windbg is a rather complex tool, but for the simple stuff it really reminds you of visual studio's debugger. I don't have the time to learn the console commands of windbg but it has a debugging toolbar that looks like VS, and similar keyboard shortcuts e.g. <F10> to single step. To set a breakpoint, press <Ctrl+O> to open the source code file you need, mark the line and press <F9>, easy! You also have access to all the usual debugging panels, like the output window, local variables, stack etc. The docking function is a bit fidgety but with a little effort you can arrange panels to taste. windbg with standard debugging panes

Although it isn't as convenient as the full visual studio debugger, you get a lot out of this 500KB debugger. And if you want to dig in deeper, it can do any crazy trick as you can think of, to satisfy the hard core kernel debugger. For the rest of us don't forget to enable unicode string display in the locals window so you can examine your strings.

A slight let-down is that PDB files generated by the ancient VS6 I use are not fully compatible with windbg so some of the variables won't show in the watch window. But if you use any modern VS version you will have all mod cons.

Post a comment on this topic »

Share |

©2002-2013 ZABKAT, all rights reserved | Privacy policy | Sitemap