在WinDBG中没有击中断点

问题描述 投票:1回答:1

C#中有一个简单的程序:

namespace Stack_and_call_x86
{
    class Program
    {
        static void Main(string[] args)
        {
            int result = Add(2,4);
        }

        static int Add (int a, int b)
        {
            int answer = a + b;
            return answer;
        }
    }
}

我在MVS 2019中编写并编译了它。我正在尝试在WinDbg中对其进行调试。看来我做对了一切,注册了符号的路径,指示了.cs文件的位置,我使用了Launch可执行程序。 (我正在使用Debug文件夹中的.exe)。我设置了一个断点:

bp Stack_and_call_x86!主要

它产生以下内容:

WARNING: Unable to verify checksum for Stack_and_call_x86.exe
Operation not supported by integrated managed debugging.
error at 'Stack_and_call_x86! main'
The breakpoint expression "Stack_and_call_x86! Main" evaluates to the inline function.
Please use bm command to set breakpoints instead of bp.

好的,我放了bm:

bm Stack_and_call_x86!主要

好吧,好像已经设置好了:

1: <MSIL: 00ca0000> @! "Stack_and_call_x86! Main"

然后,运行并出现以下错误:

ModLoad: 75e20000 75e99000 C: \ WINDOWS \ SysWOW64 \ ADVAPI32.dll
Breakpoint 1's offset expression evaluation failed.
Check for invalid symbols or bad syntax.

P.S。

如果我通过文件-开源文件打开.cs文件,并在代码中放置了一个断点,则它会被设置,但是当我启动它时,会出现错误:

无法在00ca0001处插入断点0,Win32错误0n998“无效的尝试访问内存地址。”00ca0001的bp0失败

c# debugging windbg breakpoints
1个回答
1
投票

对我来说,下一步工作正常:

  1. 下载sosex.dll
  2. 在WinDbg中:

    2.1。打开可执行文件

    2.2。编写以下命令:

    • sxe ld clrjit
    • g
    • 。load C:\ SOSEX \ sosex.dll(您的sosex.dll路径)
    • !mbp Program.cs 14(您的Name.cs文件和行插入断点)
    • g
© www.soinside.com 2019 - 2024. All rights reserved.