应用调试基础

**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:\Users\Zilor\.dotnet\sos\sos.dll
# 查看插件
.chain
# 函数断点
!bpmd ConsoleApp1.dll ConsoleApp1.Program.Main
```

猜你喜欢

转载自www.cnblogs.com/qingyunye/p/12707377.html