Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set a breakpoint at a source code of managed application when I use WinDbg?

Tags:

windbg

sos

I tried to set a breakpoint using WinDbg at a source code of a c# application, but it didn’t work. Is there a way to set a breakpoint at a source code of managed application when I use WinDbg?

Repro step is the below:

1.Make a simple c# application

class Proram
{
  static void MyWrite(){
      Console.WriteLine("test");
  }
  static void Main(string[] args){
      Console.ReadLine();
      MyWrite();
  }
 }

2.Start the .NET application from WinDbg
3.Open its source file into WinDbg
4.Break execution (while the app in ReadLine())
5.Setup symbol path and load sos.dll
6.Set a breakpoint at Console.WriteLine("test") using F9
7.Execute "g" command
8.Error occurred

Unable to insert breakpoint 0 at <address>, Win32 error 0x998 
     "Invalid access to memory location."
bp0 at <address> failed
WaitForEvent failed

I have the app's private symbol, so I don't think this is a symbol related problem.

like image 751
boby Avatar asked Jul 12 '12 23:07

boby


1 Answers

Try:

0:000> sxe ld clrjit.dll

ModLoad: 72ea0000 72f1d000   C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll

0:000> .loadby sos clr

0:000> !bpmd SslStreamTest.exe SslStreamTest.Program.Main

Found 1 methods in module 00bb2edc…
like image 112
kiewic Avatar answered Oct 13 '22 07:10

kiewic