【问题标题】:Can I set a breakpoint at a source code of managed application when I use WinDbg?使用 WinDbg 时可以在托管应用程序的源代码处设置断点吗?
【发布时间】:2012-07-12 23:09:01
【问题描述】:

我尝试在 c# 应用程序的源代码中使用 WinDbg 设置断点,但没有成功。 当我使用 WinDbg 时,有没有办法在托管应用程序的源代码处设置断点?

复制步骤如下:

1.制作一个简单的c#应用程序

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

2.从 WinDbg 启动 .NET 应用程序
3.将其源文件打开到WinDbg
4.Break执行(而ReadLine()中的应用程序)
5.设置符号路径并加载sos.dll
6.使用F9在Console.WriteLine("test")处设置断点
7.执行“g”命令
8.发生错误

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

我有应用程序的私有符号,所以我不认为这是与符号相关的问题。

【问题讨论】:

    标签: windbg sos


    【解决方案1】:

    试试:

    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…
    

    【讨论】:

      【解决方案2】:

      使用 !sex.mbp。例如,要在 myapp.cs 处中断,第 10 行: !mbp myapp.cs 10

      你可以从http://www.stevestechspot.com免费下载sosex

      【讨论】:

        猜你喜欢
        • 2011-04-26
        • 1970-01-01
        • 2020-08-20
        • 1970-01-01
        • 2018-05-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-07-11
        相关资源
        最近更新 更多