Reputation: 15817
I am trying to use WinDBG to create a breakpoint in a source file. I have followed the advice here: http://www.codeproject.com/Articles/22245/Quick-start-to-using-WinDbg, but when I press F5 I get an error which says:
Unable to insert breakpoint 0 at 00db0861, Win32 error 0n998
"Invalid access to memory location."
I have researched this error and discovered that it could be because I have not loaded the CLR i.e. .loadby sos clr. However, when I run this statement I get an error, which says: Unable to find module 'clr'. I am able to load the CLR if I follow the advice in this blog: http://humblecoder.co.uk/uncategorized/spotting-a-memory-leak-with-windbg-in-net, but this is for an ASP.NET application.
Therefore I am able to load SOS.DLL if I am debugging an ASP.NET application, which runs in a 64 bit process, but I am unable to load the CLR when running a VB.NET client app that runs in a 32 bit process. Therefore I have two questions:
1) Is loading the SOS.DLL likely to resolve the original problem (unable to add breakpoint) 2) Why am I able to execute the .loadby sos clr statement when debugging an ASP.NET app, but not a VB.NET app.
Upvotes: 1
Views: 1294
Reputation: 3273
The "Unable to find module 'clr'" error is because clr.dll isn't loaded yet. Add this breakpoint:
sxe ld clr
When it breaks, clr.dll will be loaded. Then you can do:
.loadby sos clr
Upvotes: 0
Reputation: 3027
You can use !sosex.mbp and !sosex.mbm to set breakpoints, even before the CLR is loaded.
.load sosex
!mbp mysource.cs 23 <--sets a BP at mysource.cs, line 23.
Upvotes: 2