windebug常用命令
使用~查看所有线程
切换到一号线程:~1s
查看所有线程的托管堆栈 ~* e!clrstack
怎么查看,当前线程下,变量的信息?
对于托管代码而言,最核心的命令就是!do(dump object的缩写),后面是要加上变量的地址。
怎么知道当前线程的所有变量的地址?
先来看另外一个命令,!dso(Dump Stack Objects的缩写)
!da 查看数组内容
OS命令(SOS Commands)
=======================
!threads |
view managed threads |
查看所有托管线程 |
!clrstack |
view the managed call stack |
查看托管调用栈 |
!dumpstack |
view combined unmanaged & managed call stack |
查看非托管和托管结合的调用栈 |
!clrstack -p |
view function call arguments |
查看托管函数调用的参数 |
!clrstack –l |
view stack (local) variables |
查看托管栈的局部变量 |
!name2ee module class |
view addresses associated with a class or method |
查看某个类或方法的内存地址 |
!dumpmt –mdaddress |
view the method table & methods for a class |
查看指定地址的方法表和一个类的方法集 |
!dumpmd address |
view detailed information about a method |
显示指定地址的MethodDesc结构信息 |
!do address |
view information about an object |
显示某地址的对象的信息, 包括fields, EEClass, Method Table和object size |
!dumpheap –stat |
view memory consumption by type |
显示堆内存的使用 |
!dumpheap –min size |
view memory consumption by object when at least size |
查看堆内存使用, 忽略小于size字节大小的对象 |
!dumpheap –typetype |
view memory consumption for all objects of type type |
查看所有类型为type的对象的内存使用 |
!gcroot address |
view which object are holding a reference to address |
查看所有对指定地址的对象的引用 |
!syncblk |
view information about managed locks |
查看托管的锁(SyncBlock结构) |
SOS 2.0 命令(SOS 2.0 Commands)
!bpmd module method |
set breakpoint |
在指定模块的某一指定的方法上设置断点 |
!DumpArray address |
view contents of an array |
查看数组中的元素 |
!PrintException |
view information about most recent exception |
格式化地显示最近的异常信息 |