Quantcast
Channel: Debugging – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 40

Some notes/links on Windows Debugging CLR applications

$
0
0

I only need it every once in a while, so finding the right links and tips to help me usually takes too much time.

So here is a small list to get started:

Keywords: CLR, SOS.DLL, WinDbg, mscordacwks.dll, PSSCOR4

Some tips:

  • Except for .NET 1.x, get the SOS.DLL and mscordacwks.dll from the system you want to debug on (I tried maintaining a directory with each and every version: too hard to keep that complete).
    For .NET 1.x, get the SOS.DLL from Download and Install Debugging Tools for Windows or from a Windows Server 2003 installation.
  • Favour .loadby over .load
  • Favour PSSCOR4 over SOS
.NET Framework version CLR version CLR filename
1.1 1.1 mscorwks.dll
2.0 2.0 mscorwks.dll
3.0 2.0 mscorwks.dll
3.5 2.0 mscorwks.dll
4.0 4.0 clr.dll
4.5 4.0 clr.dll

DumpStacks.bat Batch file I use for dumping the stack of a .NET 1.x process:

@echo on
if "%1" == "" goto :usage
if NOT "%2" == "" goto :run

:usage
echo Usage: %0 ^<pid^> ^<dumpfile^>
goto :quit

:run
setlocal
set output=%~f2
pushd %~dp0
Debuggers\ntsd -pv -p %1 -cf DumpStacks.ntsd.debugscript -logo %output%
popd
endlocal

:: .load C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\sos.dll
:: .load Debuggers\clr11\sos.dll

:quit

It assumes the file DumpStacks.ntsd.debugscript exists in the same directory as the batch file:

.load Debuggers\clr11\sos.dll
~*k
!EEStack
.detach
q

This assumes a Debuggers directory under the directory of the batch file, which has a clr11 directory containing sos.dll

I copied the Debuggers directory after installing the Download and Install Debugging Tools for Windows.

–jeroen


Filed under: .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Debugging, Development, Software Development

Viewing all articles
Browse latest Browse all 40

Trending Articles