Skip to content

Slides and demos for my Advanced .NET Debugging with WinDbg and SOS talk.

Notifications You must be signed in to change notification settings

spnow/AdvancedDotNetDebugging

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced .NET Debugging with WinDbg and SOS

The first demo involves taking a crash dump of a process that encounters an unhandled exception during startup. To capture the dump, use the following command:

procdump -e -ma -x 1_Crash\Binaries\FileExplorer.exe crash.dmp

Then, open the dump in Visual Studio or in WinDbg. In WinDbg, load SOS and then issue the !PrintException command to obtain a stack trace of the exception that occurred.

The second demo involves a memory leak and is somewhat more complicated to diagnose. The source of the memory leak has to do with the finalization queue: the application creates objects at a rate of 100/second, but each object's finalizer takes 20ms to run (because it calls Thread.Sleep). As a result, only 50 objects can be cleaned up per second, creating a memory leak. Some commands that are useful for the diagnosis:

!dumpheap -stat
.foreach (bytearr {!dumpheap -type System.Byte[] -min 500 -short}) {!gcroot bytearr; .echo --------}
!finalizequeue

The third demo involves a deadlock -- two threads are waiting to acquire two different synchronization objects, but each object is owned by another thread. To diagnose the situation, use the SOSEX debugging extension and its !dlk command.

About

Slides and demos for my Advanced .NET Debugging with WinDbg and SOS talk.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published