Category Archives: WinDbg

Beware of using stack-based COM objects from .NET

COM objects that don’t have the expected lifetime can cause chaos when combined with .NETs garbage collection system.

Also posted in .NET, COM, Debugging, Software Development | Tagged , , , , , , | Leave a comment

Getting IUnknown from __ComObject

How do you find the unmanaged COM object that’s being referenced by a .NET object?

Also posted in .NET, COM, Debugging, Software Development, Windows | Tagged , , , , | 4 Comments

Finding the largest free block of address space

I’ve been seeing problems recently with fragmented virtual address space. During the lifetime of a process, bits and pieces of memory are allocated throughout the 2GB 32-bit address space to such an extent that large contiguous blocks of free space are no longer available. If anything subsequently requires a large block of memory (like, for [...]

Also posted in Software Development, Windows | Tagged , , , , , | 2 Comments

Diagnosing out of memory errors with VMMap

VMMap is a new tool from Mark Russinovich et al that’s very useful for diagnosing virtual memory/address space exhaustion issues. I describe it here, and give some information that should help you interpret what it reports.

Also posted in Debugging, Software Development, Windows | Tagged , , , , | 1 Comment

WinDbg !locks command broken

It seems that the extremely useful !locks command is broken in 6.11.1.40x, the current and previous release of WinDbg from the debugging tools for Windows.
You’ll get errors like:

0:007> !locks
NTSDEXTS: Unable to resolve ntdll!RTL_CRITICAL_SECTION_DEBUG type
NTSDEXTS: Please check your symbols

The suggested solution seems to be to roll-back to version 6.10.3.233, available from here, or you can just [...]

Also posted in Debugging | Tagged , | 1 Comment

Troubleshooting an InvalidProgramException

One of the developers who uses the .NET/COM interop DLL that I wrote recently informed me that when they used it in a certain way, they would get a fatal System.InvalidProgramException. Nasty. So I set about seeing how I could find out exactly why this was happening: here are the gory details…
To spoil the ending [...]

Also posted in .NET, Software Development, Windows | Tagged , , , , , , , , | Leave a comment

Creating a featherweight debugger

What do I mean by “featherweight debugger”? I mean implementing just enough of the debugging framework to get what we need from the debuggee and nothing more.
The problem I was trying to solve was how to get more information from first chance exceptions. We have a great deal of library code that uses catch(…) blocks [...]

Also posted in Debugging, Software Development, Windows | 5 Comments

Dumping Excel XLL add-in calls

Using WinDbg it’s possible to get a dump of each XLL call that is made by Excel as it calculates. If you’re using Excel 2003, create the following breakpoint that dumps the symbol at eax+4 (the entry point that is about to be called), then continues.:
bu EXCEL!MdCallBack+0xa880 “dds @eax+0×4 L1; g”
You’ll need to adjust the [...]

Also posted in Debugging, Excel | 2 Comments