Sunday 17 June 2012

Managed Debugging


Debugging is a process of analysing the dumps of the application. Dumps can be of different types-crash, hang, etc.  This debugging plays a major role in support of any product that any company ships. This also helps in determining the further improvements in the code base for future releases.

Debugging can be of two types-unmanaged and managed. Unmanaged is the one which involves the application written in unmanaged language for example C++ or VC++. Managed code on the hand involves the applications written in managed code-all supporting the .Net framework(C#, VB, etc.)

Unlike unmanaged debugging which involves analysing the dump files written in unmanaged code(C, C++), managed debugging is relatively easy. Most of the work will be done for you by the CLR (Common Language Runtime). Even the crashes, hangs are very limited in case of the managed application. Thanks to the CLR and the efficient Garbage collector provided by the .Net framework.

WinDbg is the tool that I generally use for debugging the crash, hang dumps. For managed debugging you will have to load the symbols first. You can do this using the following command.

.sympath SRV*D:\symbols*http://msdl.microsoft.com/download/symbols
This will load the Microsoft symbols.
Next process is to load the extension that provides the commands for managed debugging. This extension is called SOS. To load the extension use the following command
.loadby sos mscorwks
This will load the SOS extension. From now on you can use the command provided by the SOS for analysing the dump files.
You can find the commands here

1 comment:

Do you like our Content?