【问题标题】:Set breakpoint in managed code using DebugDiag使用 DebugDiag 在托管代码中设置断点
【发布时间】:2015-12-09 18:29:39
【问题描述】:

每次调用特定方法时,我都会尝试使用Debug Diagnostic Tool 创建 Minidump。

我从简单的控制台应用开始:

namespace FastFailApp {
    class Program {
        static void Main(string[] args) {
            Console.WriteLine("Starting...");
            for (int i = 0; i < 20; i++) {
                Console.Write(".");
                Thread.Sleep(1000);
            }
            Environment.FailFast("Not so unexpected failure...");
        }
    }
}

然后我在 DebugDiag 中创建了规则以在每个 Program.Main 调用上创建 minidump: 不幸的是,它不起作用,在 DebugDiag 日志中我收到消息:

[12/9/2015 8:05:15 PM] Attempting to set managed breakpoint at FailFastApp.dll!FailFastApp.Program.Main
[12/9/2015 8:05:15 PM] bpID = -2
[12/9/2015 8:05:15 PM] Current Breakpoint List(BL)
SYMSRV:  https://msdl.microsoft.com/download/symbols/kernel32.pdb/996C94DB18DE43688CA110D2FF25B8542/kernel32.pdb not found
SYMSRV:  C:\Program Files\DebugDiag\sym\kernel32.pdb\996C94DB18DE43688CA110D2FF25B8542\kernel32.pdb not found
DBGHELP: C:\Windows\system32\kernel32.pdb - file not found
DBGHELP: kernel32.pdb - file not found
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\system32\KERNEL32.dll - 
DBGHELP: KERNEL32 - export symbols
SYMSRV:  https://msdl.microsoft.com/download/symbols/ntdll.pdb/6048FDB62DCD41C18835594844CE71432/ntdll.pdb not found
SYMSRV:  C:\Program Files\DebugDiag\sym\ntdll.pdb\6048FDB62DCD41C18835594844CE71432\ntdll.pdb not found
DBGHELP: C:\Windows\SYSTEM32\ntdll.pdb - file not found
DBGHELP: ntdll.pdb - file not found
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SYSTEM32\ntdll.dll - 
DBGHELP: ntdll - export symbols
[12/9/2015 8:05:15 PM] Thread exited. Exiting thread system id - System ID: 3568. Exit code - 0x00000000
CLR: Managed code called FailFast, saying "Not so unexpected failure..."

我已经在 DebugDiag 中设置了符号服务器,并使用 WinDBG 检查了此配置:

有人有什么建议吗?

PS。我尝试调试的应用程序是 64 位的。我尝试将当前进程目录(带有 pdb 文件)添加到符号路径,并使用各种格式的断点表达式(如 Module!Class::MethodModule.dll!Class.Method(OtherType))但没有成功。

【问题讨论】:

标签: c# debugdiag debug-diagnostic-tool


【解决方案1】:

不应该是 FailFastApp.exe!FailFastApp.Program.Main 吗?不确定您是否已将代码放入类库并将其编译为 DLL,但如果您还没有这样做,那么它应该是 .exe

如果这不起作用,那么看看你是否可以通过使用这个断点来获取 sleep 方法的转储

mscorlib.dll!System.Threading.Thread.Sleep

希望对你有帮助

【讨论】:

  • 感谢您指出我的错误,确实我使用了.dll insted of .exe。不幸的是它仍然不起作用
  • 您能分享您在日志中看到的内容吗? “mscorlib.dll!System.Threading.Thread.Sleep”断点是否有效?
猜你喜欢
  • 2012-11-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-29
  • 2011-04-26
  • 1970-01-01
  • 2010-12-10
  • 2020-09-30
  • 2017-04-26
相关资源
最近更新 更多