Managed Watson Dump

From .Net Framework 2.0, Dr. Watson is able to generate dump compatible with .Net framework. This means, dumps with heap data generated by Dr. Watson contains information about managed heap so they can be analyzed with sos.dll. Some update to Dr.Watson is necessary to make this happen. Dumps generated by older Dr.Watson is not compatible with…


Inspect a 32 bit Process Dump Generated by a 64 bit Debugger

64 bit Windows can run both 32 bit process and 64 bit process. For debugging though, you want to use 32 bit debugger to debug 32 bit process, and 64 bit debugger for 64 bit process. Otherwise it won’t be pretty. Occasionally, I receive a 32 bit process dump generated by a 64 bit debugger….


Event Handles “leak”

On our stress run, we saw our process’ handle count steadily increases until certain point, then it stabilizes. However the number of handles is high. Most of those handles are Event handles. We are concerned about it. So we went off and did some investigation. Turns out the Event handles are coming from the use…


Use !htrace to debug handle leak

Windbg Debugger’s !htrace extension is very handy to debug handle leak. The process essentially boils down to the following simple steps: 1.       Enable trace 2.       Take a snapshot 3.       Run scenario 4.       Show the diff On step 4, !htrace will show all the extra opened handles after the last snapshot, along with the callstack if…


A case study of a NullReferenceException

We are seeing a NullReferenceException in our stress program. The investigation process may be helpful to some folks.   Thread 22 is showing a Watson dialog.   This is a register corruption.   0:022> kp ChildEBP RetAddr  091bc9a0 76961220 ntdll!ZwWaitForSingleObject(void)+0x15 091bca10 76961188 kernel32!WaitForSingleObjectEx(void * hHandle = 0x00001034, unsigned long dwMilliseconds = 0x4e20, int bAlertable =…


Getting the right exception context from a memory dump

When debug a memory dump, the dump may not in the right exception context when it is first loaded in the debugger. However, we can figure out the right context from the dump. Let’s load the dump. c:\debuggers>cdb -z c:\temp\foo.dmp Symbol search path is: *** Invalid ******************************************************************************** Symbol loading may be unreliable without a symbol…


Calculating the size of each GC generation

Sos.dll does not have a command to tell the size of each GC generation. However, you can calculate the size based on the output of !eeheap -gc. For example, 0:000> !eeheap -gc Number of GC Heaps: 1 generation 0 starts at 0x1da6c430 generation 1 starts at 0x1da5c240 generation 2 starts at 0x01a41000 ephemeral segment allocation context:…


Figuring out object allocation graph from a managed memory dump

  when debugging a managed memory dump, we can use Sos.dll to inspect managed objects inside the dump. for example, we can do !dumpheap to list the managed objects in GC Heap, we can also use !gcroot to figure out the reference path to a particular object. However, if we want to understand the whole…


From Unhandled Exception to Debugger Attach

I was always wondering what is happening between an application throws an unhandled exception, and a debugger attached to the process. Apparently the information is right under my nose, but I was blind. Windows Debugger’s documentation about post-mortem debugging has all the details you want to know. Enabling Postmortem Debugging The most common application errors…


Mismatched PDBs — Why?

If you are developing software, most likely you have encountered the “mismatched pdbs” debugger error. It usually happens when you point the debugger to the wrong symbol path. But there are times you are confident that the symbols you point to are the correct symbols, and it left you wondering why the debugger believes the…