zoukankan      html  css  js  c++  java
  • WinDbg 加载 dotnet core 的 sos.dll 辅助调试方法

    本文告诉大家如何加载 .NET Core 或 .NET 5 的 sos.dll 文件到 WinDbg 的方法

    和 .NET Framework 或 dotnet core 2.0 不相同的是,当前的 sos.dll 是放在独立的 https://github.com/dotnet/diagnostics 仓库里面,也需要独立安装。好在 sos 通过 dotnet tool 进行分发,安装方法非常简单

    请通过如下命令行命令进行安装

    dotnet tool install -g dotnet-sos
    

    以上是添加 dotnet sos 工具,接下来还需要调用此工具进行安装,请在命令行输入下面命令进行安装

    dotnet sos install
    

    如安装成功,那么大概会输出以下内容

    Installing SOS to C:Userslindexi.dotnetsos
    Creating installation directory...
    Copying files from C:Userslindexi.dotnet	ools.storedotnet-sos5.0.236902dotnet-sos5.0.236902	ools
    etcoreapp2.1anywin-x64
    Copying files from C:Userslindexi.dotnet	ools.storedotnet-sos5.0.236902dotnet-sos5.0.236902	ools
    etcoreapp2.1anylib
    Execute '.load C:Userslindexi.dotnetsossos.dll' to load SOS in your Windows debugger.
    SOS install succeeded
    

    如上面提示,当前可以在 WinDbg 通过如上命令进行加载 sos 文件

    .load C:Userslinde.dotnetsossos.dll
    

    但是此文件默认是 x64 的,如果期望调试的应用是 x86 的,那么以上命令将会提示如下错误

    .load C:Userslinde.dotnetsossos.dll
    
    The call to LoadLibrary(C:Userslindexi.dotnetsossos.dll) failed, Win32 error 0n193
        "%1 不是有效的 Win32 应用程序。
    

    此时的解决方法是去获取 x86 版本的 sos.dll 如下面命令

    .load C:Userslindexi.dotnet	ools.storedotnet-sos5.0.236902dotnet-sos5.0.236902	ools
    etcoreapp2.1anywin-x86sos.dll
    

    需要自己去找放在 C:Userslindexi.dotnet ools.storedotnet-sos 文件夹的对应的 dotnet 版本的 sos 的 win-x86 版本的文件

    博客园博客只做备份,博客发布就不再更新,如果想看最新博客,请到 https://blog.lindexi.com/

    知识共享许可协议
    本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。欢迎转载、使用、重新发布,但务必保留文章署名[林德熙](http://blog.csdn.net/lindexi_gd)(包含链接:http://blog.csdn.net/lindexi_gd ),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。如有任何疑问,请与我[联系](mailto:lindexi_gd@163.com)。
  • 相关阅读:
    CF1454F Array Partition
    leetcode1883 准时抵达会议现场的最小跳过休息次数
    leetcode1871 跳跃游戏 VII
    leetcode1872 石子游戏VIII
    CF1355C Count Triangles
    CF1245D Shichikuji and Power Grid
    CF1368C Even Picture
    CF1368D AND, OR and square sum
    CF1395C Boboniu and Bit Operations
    SpringBoot和开发热部署
  • 原文地址:https://www.cnblogs.com/lindexi/p/15120503.html
Copyright © 2011-2022 走看看