Debugging startup code of services and COM servers

Debugging the startup code of a service or an out-of-process COM server usually looks like a difficult task, especially if the service/server is running under a non-administrative user account. But in practice, there is a number of tools and techniques that can make this task much easier - almost as easy as debugging an interactive application.

WinDbg the easy way

This article introduces CDB debugger as an effective complement to Visual Studio debugger for various advanced debugging tasks. It shows how to install and configure CDB, and how to use its command line options and commands for retrieving useful information about the internal state of the debuggee - without interrupting the main debugging session in Visual Studio.

Debugging custom filters for unhandled exceptions

This article shows how to debug custom filters for unhandled exceptions, and how to ensure that our filter is always properly registered (which sometimes is not easy to do, especially if other components of the application want to register their own filters). We will also explore how the operating system registers and calls custom filters, and what system components may want to utilize custom filters for their own purposes (and thus interfere with our own filters).

Minidumps and matching modules

In the process of debugging a minidump, matching modules are as important as matching symbols. If the debugger cannot find matching modules, it usually cannot load symbols and cannot show good call stacks and other kinds of important information. In this article we will explore how debuggers work with modules - where do they look for them, and what data do they use to check whether a module is matched. We will see how to configure the most popular debuggers to search for matching modules in correct places (module search path). We will also discuss situations when matching modules cannot be found, and try to find workarounds.

NTSD as a better Dr. Watson

Dr. Watson is probably the most popular just-in-time debugger for Windows applications. But do we have a better choice? This article discusses some limitations of Dr. Watson, and introduces another debugger, NTSD, which is more flexible, configurable, and capable of replacing Dr. Watson in many just-in-time debugging scenarios.

Effective minidumps

In this article, we will try to figure out how to create the minidumps that are small but contain enough information for successful debugging. We will discuss various configuration options of MiniDumpWriteDump function, and explore the ways to customize the contents of our minidumps with the help of MiniDumpCallback function.

Matching debug information

This article discusses the concept of matching between an executable and the corresponding debug information file. It describes how debug information is stored in PE executables, what kinds of data are used to refer to separate files with debug information (PDB and DBG), and how the executables and debug information files are tied together to avoid loading an unmatched debug information file. Various related problems are also discussed (e.g. how to force a debugger to load an unmatched debug information file). An accompanying example shows how to access debug information structures in PE executable.

Generating debug information with Visual C++

This article describes how to generate debug information for Visual C++ applications. It starts with discussing the typical contents of debug information and existing debug information formats. Then it proceeds to the steps needed to produce debug information for Visual C++ applications (Visual C++ 6.0, 2002 and 2003 are discussed). Additional interesting information is also included, such as the effect of debug information on the size of the executable, debuggers and their support for various debug information formats, and also debug information formats used by operating system symbol files.

How to use DbgHelp to access type information

This article shows how to analyze type information using DbgHelp library. This interesting topic is often discussed in debugger newsgroups, but it is clear that there is no sufficient information and examples yet. This article gives detailed description of the type information and shows how to use DbgHelp to read and analyze it. Complete example is included (with source code).