应用调试基础

**Windbg 符号表环境变量**

```shell
# _NT_SYMBOL_PATH
# C:Symbols 路径自行设置
srv*C:Symbols*https://msdl.microsoft.com/download/symbols
```

![image-20200410095655748](C:%5CUsers%5CZilor%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20200410095655748.png)

上面是.NET Core本地符号表

**SOS安装**

```shell
dotnet tool install -g dotnet-sos
dotnet-sos install
```

![image-20200410095832162](C:%5CUsers%5CZilor%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20200410095832162.png)

记住图中红框的加载指令

**Windbg基本用法**

```shell
# 运行
windbgx dotnet .ConsoleApp1.dll
# 加载coreclr
sxe ld coreclr
# 继续
g
# 加载SOS
.load C:Usersilor.dotnetsossos.dll
# 查看插件
.chain
# 函数断点
!bpmd ConsoleApp1.dll ConsoleApp1.Program.Main
```

如有错误,欢迎您指出。
本文版权归作者和博客园共有,欢迎转载,但必须在文章页面给出原文链接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/qingyunye/p/12707377.html