存档

帖子标记'WinDBG的'

Silverlight的调试WinDbg和SOS救援中心

08年12月19日 没有评论

介绍

在以前的帖子视觉工作室Silverlight的调试 ,我演示了Visual Studio是一个强大的和最方便的工具进行调试托管应用程序。 但是,对于一些先进的调试情况,如内存泄漏,死锁,失控的进程/线程,内核调试,以及先进的远程/崩溃/界面调试等,WinDbg中(或国家开发银行,的NTSD,科威特第纳尔)通常是首选,如果不是唯一的选择。

调试Windows工具

概观

WinDbg中的一部分是用于Windows调试工具包:

image_thumb5

即使WinDbg中是一个GUI程序,它主要是用来作为命令行调试器一样经常与)科威特第纳尔(以及国家开发银行和的NTSD,共享相同的调试引擎和命令。 这是超级强大和可扩展性,特别适合系统适合/低级别的驱动程序和其他类似的操作系统组件的调试。 它需要良好的硬件知识,操作系统,编译器以获得最大效益的工具集。 这是一个伟大的(或完美的,我应该说 :-) 本机调试,其广泛和可扩展的命令和图形用户界面。 托管调试调试支持是通过延长SOS救援中心,是不如本机调试好,但有巨大的价值能够在做综合管理和跨边界本地调试,并为Silverlight,它是唯一的工具,我知道可以加载SOS救援中心并集成调试。

命令

WinDbg中/国家开发银行/的NTSD /科威特第纳尔已经存在很长时间,因此他们很详细的记载。 它强烈建议您阅读有关调试工具Windows为microsoft.commsdn的 在这里我只作简要概述它的命令,给你的感觉和快速参考。 所有的命令来帮助与运行时间(通过?|。帮助|!帮助[<cmd>]下文讨论),所以一概述通常足以让你的开始。

WinDbg中有3套的命令:

标准命令

主要是:

  • 乙*命令来设置/清除/列表/启用/禁用断点地址或访问
  • D *等命令来检查内存(堆栈/堆,本地/全局变量和参数),电子*命令来修改内存,和S *寻找记忆
  • 的K *命令来检查调用堆栈
  • 磷,吨,用于执行命令的控制克*

以下? 命令的输出是一个伟大的概述和使用WINDBG /国家开发银行/的NTSD / kd的人经常提到:

0:006>?

打开debugger.chm完整调试文件

乙[ç |开发|英] [<bps>] -清除/禁用/启用断点(第)
基本法-断点列表
广管局<access> <size> <addr> -集处理器断点
血压<地址> -设置软断点
Ð [类型] [<range>] -内存转储
申命记[- ñ | Ÿ] [[模!名称]] [[- N的| y]个领域]
[地址] [- l列出] [- 1 [] | ç |我|邻|研究[#] |五] -利用类型信息转储
的DV [<名称>] -转储本地变量
é [类型] <地址> [<values>] -进入内存值
克[Ĥ | ŋ] [= <地址> [<地址> ...]] -走
K表<count> -堆栈跟踪
京都议定书<count> -带源参数堆栈跟踪
LM滚动族[k |升| ü |五] -列表模块
LN的<expr> -符号列表最接近
P [= <addr>] [<值>] -跨越
Q -退出
ṛ[[<reg> [= <expr>]]] -查看或设置寄存器
真相[<opts>] <range> <values> -搜索记忆
SX的[(É |开发|我| n)的[- c“的Cmd1”] [- c2的“Cmd2”] [- H]的(异常|活动| *)] -事件过滤器
Ŧ [= <地址>] [<expr>] -追踪到
ü [<range>] - unassemble
版本-显示调试者和调试器版本
十[<* |模块>!]<*|符号> -查看符号
<expr> -显示表达
?? <expr> -显示的C + +表达式
$ <文件名> -以命令的输入从文件

点击进入...

<expr>行动:一元+ -不是禾创投qwo蒲喜低
二进制行动:+ - * /模(%)和(&)异或(^)或(|)
比较:==(=)<>!=
操作数:<reg>人数目前基数,公共符号,
<类型>号:B(字节),钨(词),为d [的](符号]双字[带),
1(ASCII码),C级(DWORD值和Char),铀(unicode编码),升(名单)
楼(浮动)的D(双)号,S |秒(ASCII码/ Unicode字符串)
与Q(四字)
<pattern>:[(新台币| <dll-name>)!] <var-name>(<var-name>可以包括哪些内容?和*)
<range>:<地址> <地址>
:<地址> L <count>

用户模式的选择:
〜 -名单线程状态
〜#的s -设置默认的线程
| -名单进程的状态
|#的s -设置默认进程

86选项:
危险品<selector> -转储选择
<reg>:[英]斧头,[英]本钢,[英]国泰航空,[英]的DX,[英]思,[英]二,[英]英国石油公司,[英]藻,[英]的IP,[ é]佛罗里达州,
人啊,基本法,波黑,氯,总,分升,卫生署,政务司司长,副秘书长,服务中心,财政司司长,GS认证,不锈钢
dr0,dr1,DR2基因,DR3的,dr6,dr7
fpcw,fpsw,fptw,st0 - ST7的,mm0 - mm7
xmm0 - xmm7
<flag>:iopl,对,df的,如果转铁蛋白,铁蛋白,采埃孚,自动对焦,pf的,比照
<addr>:#<16位保护模式[赛格:]地址>,
&<V86-mode [seg:]address>

打开debugger.chm完整调试文件

梅塔命令

那些有一大部分是用于高级调试点开始。 一些重要的命令,你应该知道:

  • 。symfix和。sympath使用符号服务器
  • 。srcfix和。sources原始码搜索路径使用源服务器
  • 。负荷。loadby。卸下。链。setdll管理调试扩展
  • 。服务器。遥感进行远程调试

这是非常值得您的时间来与符号服务器,源服务器和远程调试熟悉的:他们将让你的生活更轻松了很多。 下面是输出。help命令:

0:006>。帮助
命令:
。放弃-放弃目前的进程
。allow_exec_cmds [0 | 1] -控制执行命令
。allow_image_mapping [0 | 1] -控制点播图像文件映射
。apply_dbp [选项>] -当前的数据添加到一个断点状态
登记范围
。汇编[选项>] -设置拆卸方案
。汇编- [选项>] -明确拆卸方案
。重视<proc> -重视<proc>在下次执行
。块)(<命令> -括号内的命令执行的一组嵌套
。多线程debuggees bpsync [0 | 1断点行为为] -特别
。突破-打破封闭的循环
。唱到-打入科威特第纳尔
。缓存[选项>] -虚拟内存缓存控制
。致电<fn>(<arg1>,<arg2>,...) -调试运行中的一个函数
。赶上)(<命令> -捕捉在命令失败
。链-电流扩展列表
。childdbg <0 | 1> -把孩子的过程调试或关闭
。客户-目前活跃客户名单
。closehandle [选项>] [<handle>] -关闭给予处理
。继续-继续封闭的循环
。copysym [选项>] <路径-当前符号文件复制到一个目录
。创建<命令行> -创建一个新进程
。createdir [选项>] [<路径] -控制进程创建选项
。胸部X光<地址> -在指定的地址记录倾倒情况
这给以后的K *胸部X光栈
。dbgdbg -调试器附加到当前的调试器
。] - debug_sw_wow [0 | 1允许软件仿真互动哇
。分离-脱离当前进程/转储
。<文件- dml_file输出文件内容的DML
。dml_flow <start> <addr> -显示基本块码流
。dml_start [选项>] -调试通航的活动概述
。做)(<命令(<cond>) -执行<命令,直到<cond>为零
。驱动器-这个命令被删除-使用'流明'或。重装- 1)
。倾倒[选项>] <文件名> -创建一个主机系统转储文件在
。dvalloc [选项>] <bytes> - VirtualAlloc的调试内存在
。dvfree [选项>] <offset> <bytes> - VirtualFree调试内存在
。回声[“字符串>”|字符串>] -返回string
。echotime -输出调试时间
。echotimestamps [0 | 1] -切换时间戳记输出事件
。ecxr -对当前异常转储上下文记录
。effmach [<machine>] -改变目前的机型
。否则)(<命令> -如果/那么/其他有条件执行
。elsif(<cond>))(<命令> [<else clauses>] -如果/那么/其他有条件
执行
。enable_long_status [0 | 1] -转储默认龙种基地
和Unicode字符串。enable_unicode [0 | 1] -倾倒USHORT数组/指针
。endsrv <标识-禁用特定引擎服务器
。endpsrv -导致当前会话的远程服务器退出
。enumtag -枚举可用的标记数据
。event_code -显示缓存的事件说明
。事件日志-最近发生的事件显示日志
。事件-显示并选择可用的事件
。eventstr -显示任何情况下调试通过字符串注册
。exepath [<目录> [;...]] -设定可执行文件的搜索路径
。exepath + [<目录> [;...]] -可执行文件的搜索路径追加
。expr的-控制表达式计算器
。exptr <地址> -做的事。exr和。胸部X光为EXCEPTION_POINTERS
。exr <地址> -在指定地址转储异常记录
。extmatch [<opts>] <pattern> -显示所有扩展模式匹配
。extpath <opts> [<目录> [;...]] -集扩展的搜索路径
。extpath + <opts> [<目录> [;...]] -追加扩展的搜索路径
。F十-设置当前堆栈帧帧调用当前
。架F - -设置当前堆栈帧被调用者的当前帧
。纤维<地址> -设置纤维的背景下在地址
重置背景下,如果没有指定地址
。fiximports <pattern> -试图将图像进口
。fnent <地址> -给定的代码转储函数的入口地址为
。fnret <fnaddr> [<retval>] -返回值的显示格式
。为(<init>; <cond>; <step>))(<命令> - <命令和执行
<step>直到<cond>是

。违约force_radix_output [0 | 1转储整数类型] -基地
。force_system_init [选项>] -力有待系统初始化如果可能的话
。force_tb -强行让分行追踪
。的foreach [选择采用](<alias>(<tcmds>)))(<ecmds> -为执行<ecmds>
每个令牌
输出<tcmds>
。fpo选项> -控制覆盖FPO信息
。架[指定正确格式] -设置当前堆栈帧的当地人
。格式<expr> -显示表达式的结果在许多格式
。帮助[选项>] -显示这个帮助
。holdmem选项> [范围] -内存中的数据进行比较
。若(<cond>))(<命令> [<else clauses>] -如果/那么/其他有条件
执行
。ignore_missing_pages [0 | 1] -控制核心转储失踪摘要
页面错误信息
。imgscan选项> -体育扫描图像记忆
。<jdi_addr> - jdinfo解释AeDebug项信息
。kframes <count> -设置默认的堆栈跟踪深度
。杀死-杀死当前进程
。lastevent -显示最后一个事件发生
。离开-出口封闭。赶上
。线-线符号载入中切换
。<name> -在负载添加此扩展DLL来扩展链
。loadby <名称<mod> -添加扩展DLL的模块
目录链的延伸
。现场[<locale>] -当前区域设置
。日志文件-显示登录状态
。logopen [<文件] -打开新的日志文件
。logappend [<文件] -追加到日志文件
。logclose -关闭日志文件
。netsyms [0 | 1] -允许/禁止净符号路径
。netuse [选项>] -管理网络连接
。noshell的-禁用shell命令
。noversion -禁用扩展的版本检查
。ofilter <pattern> -给定模式调试器输出对
。ocommand <前缀> -把命令的输出作为一个给定的前缀
。opendump <文件-打开转储文件
。outmask <mask> -输出掩模组位在当前
。outmask - <mask> -输出面具明确在当前位
。的PCMD [选项>] -控制每个命令提示符
。流行[选项>] -流行状态
。模式的默认prefer_dml [0 | 1] -控制的DML
。输出“<格式>”,<args…> -格式化输出
。过程[<地址>] -集隐进程
如果没有重置默认地址指定
。prompt_allow [选项>] -控制哪些信息可以显示
在提示
。按[选项>] -推进国有
。quit_lock [选项>] -锁对意外退出会议
。readmem <文件<range> -看原始文件从内存
。record_branches [0 | 1] -控制处理器记录分支
。重载[<image.ext> [= <地址>,<size>]] -重载符号
。重新启动-要求重新启动一个会话
。远程<pipename> -服务器开始remote.exe
。安全[0 | 1] -不允许操作主机的危险
。send_file选项> -文件发送到远程服务器
。服务器选项> -启动引擎服务器
。服务器-积极的远程服务器列表
。setdll <名称-调试器将扩展在此DLL搜索第一
。壳[<command>] -执行shell命令
。show_read_failures [<opts>] -控制额外的输出读失败
。show_sym_failures [<opts>] -控制输出额外的象征失败
。睡眠<milliseconds> -调试休眠指定的时间
用来进行访问的游戏机
在一个破碎的NTSD在三维
。srcfix [<路径extra>] -固定源的搜索路径
。srcfix extra>] + [<路径-追加固定源的搜索路径
。负荷输出srcnoisy [0 | 1] -控制详细来源
。sources原始码搜索路径[<目录> [;...]] -集源搜索路径
。sources原始码搜索路径+ [<目录> [;...]] -追加源搜索路径
。step_filter [<opts>] [“<pattern> [; <pattern> ...]"] -设置标志图案
跳过时加强
。symfix [<localsym>] -修复符号搜索路径
。symfix + [<localsym>] -追加固定符号搜索路径
。symopt <flags> -设置符号选项
。symopt + <flags> -设置符号选项
。symopt - <flags> -清除符号选项
。sympath [<目录> [;...]] -设置符号搜索路径
。sympath + [<目录> [;...]] -追加符号搜索路径
。螺纹[<地址>] -设置在地址范围内螺纹
重置默认情况下,如果没有指定地址
。时间-显示会议的时间信息
。ttime -显示线程的时间信息
。键入tlist -正在运行的进程列表
。<flags> - typeopt设置/清除型的选择
。卸下<名称-删除扩展DLL这个扩展的DLL从名单
。unloadall -删除扩展DLL的所有扩展的DLL从列表
。唤醒-唤醒了。sleep'ing调试
。一段时间(<cond>))(<命令-执行<命令而<cond>是非零
。writemem <文件<range> -原始内存写入到一个文件

使用“。架HH <command>”或调试目录打开debugger.chm在得到
详细的文件上的命令。

扩展命令

那些开始!,通常用于特定地区,如托管SOS扩展调试命令。 你可以使用!安装MS04。帮助列出扩展命令,如!exts.help。 对于先进的系统调试,如检测内存泄漏,死锁等,你必须非常熟悉这些扩展指令。

SOS救援中心

概观

SOS是为儿子的打击缩写(不要问我为什么),一为托管调试调试扩展。 我相信它是由CLR的团队发明了CLR的调试,所以一直是很长一段时间,并且有良好的信息在网络上很多。 一些推荐读物:

每个CLR版本都有其(。NET Framework 3.5中仍使用自己的SOS救援中心的CLR 2.0和Silverlight有自己的CLR):

目录中的C:\ Program Files文件\调试工具为Windows \ clr10
2007年9月19日下午7时01 948784 sos.dll
1文件(县)948784字节

目录中的C:\ Program Files文件\微软Silverlight \ 2.0.31005.0
2008年10月5日上午02时16分495424 sos.dll
1文件(县)495424字节

目录中的C:\的Windows \ Microsoft.NET \框架\ v1.1.4322
2004年7月15日上午12时35 319488 SOS.dll
1文件(县)319488字节

目录中的C:\的Windows \ Microsoft.NET \框架\ v2.0.50727
2008年7月27日上午10时03 392184 SOS.dll
1文件(县)392184字节


命令

SOS救援中心运行时的帮助是如此之大,你几乎不需要任何其它Doc除了一些尝试和一些挫折和错误 :-)

0:016>!帮助
---------------------------
SOS是一个调试器扩展DLL,旨在帮助托管调试
方案。 函数是按类别列出,然后大致顺序
的重要性。 流行的功能快捷名字列在括号。
键入“!帮助<functionname>”该功能的详细信息上。

检查对象检查代码和堆栈
---------- ----------
DumpObj(做)主题
DumpArray(大)CLRStack
DumpStackObjects人(DSO)IP2MD
DumpHeap ü
DumpVC DumpStack
GCRoot EEStack
ObjSize GCInfo
FinalizeQueue EHInfo
PrintException(体育)COMState
TraverseHeap BPMD

CLR数据结构检查诊断工具
---------- ----------
DumpDomain VerifyHeap
EEHeap VerifyObj
Name2EE FindRoots
SyncBlk HeapStat
DumpMT GCWhere
DumpClass ListNearObj(LNO为)
DumpMD GCHandles
Token2EE GCHandleLeaks
EEVersion FinalizeQueue(啡)
DumpModule FindAppDomain
线程池SaveModule
DumpAssembly ProcInfo
DumpSigElem StopOnException(国有企业)
DumpRuntimeTypes DumpLog
DumpSig VMMap
RCWCleanupList的vmstat
DumpIL MinidumpMode
AnalyzeOOM(澳)

审视历史上其他地方选区
---------- ----------
HistInit常见问题
HistStats
HistRoot
HistObj
HistObjFind
HistClear

样品调试示范

我将用在以前的职位(同最简单的Silverlight应用程序的Silverlight使用Visual Studio调试 ),以证明WinDbg中SOS救援中心与调试:

image_thumb

这里是我的说明(启动调试日志/ /):

/ /设置符号路径使用符号服务器
0:013>。sympath
符号搜索路径为:<空>
0:013>。symfix C:\用户\ ningz \应用程序数据\本地的\ Temp \符号
0:013>。sympath
符号搜索路径为:的SRV * C:\用户\ ningz \应用程序数据\本地的\ Temp \符号\ * \符号\符号

/ /添加应用程序的临时区议会的路径正在调试
0:013>。sympath +“C:\用户\ ningz \文档\ Visual Studio 2008的\项目\ SilverlightApplication1 \ SilverlightApplication1 \斌\调试”
符号搜索路径为:的SRV * C:\用户\ ningz \应用程序数据\本地的\ Temp \符号*
http://msdl.microsoft.com/download/symbols;
C:\用户\ ningz \文档\ Visual Studio 2008的\项目\ SilverlightApplication1 \ SilverlightApplication1 \斌\调试

/ /重新加载所有的符号
0:013>。刷新
重新加载当前模块
.................................................. .................................................. ..............

/ /设置源路径使用源服务器
0:013>。sources原始码搜索路径
源的搜索路径是:<空>
0:013>。srcfix
源的搜索路径是:的SRV *
0:013>。sources原始码搜索路径+“C:\用户\ ningz \文档\ Visual Studio 2008的\项目\ SilverlightApplication1 \ SilverlightApplication1”
源的搜索路径是:的SRV *; C:\用户\ ningz \文档\ Visual Studio 2008的\项目\ SilverlightApplication1 \ SilverlightApplication1

/ /加载SOS救援中心。 请注意:
/ / 1。 它似乎是在Silverlight的mscorwks coreclr替换
/ / 2。 而不是。loadby,你也可以使用。负荷的“C:\ Program Files文件\微软Silverlight \ 2.0.31005.0 \ sos.dll”
0:013>。loadby SOS救援中心coreclr
加载ç:\ Program Files文件\微软Silverlight \ 2.0.31005.0 \ SOS扩展的DLL

/ /设置一个断点处理程序的按钮单击事件
0:013>!bpmd SilverlightApplication1 SilverlightApplication1.Page.Button_Click
发现1的方法...
MethodDesc = 03983a30
待添加断点...
0:013>基本法
0 é 0428215b 0001(0001)0 :****
0:013>克
ModLoad:70800000 7080c000 ç:Windowssystem32dwmapi.dll

/ /点击并打入WinDBG的按钮
命中断点0
***警告:无法验证SilverlightApplication1.dll为校验
SilverlightApplication1!Button_Click:
04850398 55推EBP的
综合管理调试不支持枚举变量的地方。
http://dbg/managed.htm了解更多详情。
管理框架处理失败,0x80004005的HRESULT

/ /比较!线程和〜*输出
0:005>!线程/ /列表管理线程只
THREADCOUNT封:3
UnstartedThread:0
BackgroundThread:3
PendingThread:0
DeadThread:0
托管运行:是
先发制人的气相色谱的alloc锁
编号OSID ThreadOBJ国家语境域计数的GC亚太异常
5 1 1b08 043576e0 220残疾人04f9f214:04f9ffe8 06f529d8 0 STA中
9 2 928 043689c8 b220启用00000000:00000000 0433c738 0的MTA(终结器)
1220 10 3 1e8c 06f509d0启用00000000:00000000 0433c738 0 Ukn
0:005>〜* / /列表中的所有线程
0编号:162c.1a28挂起:1 Teb:7ffde000未冻
开始:的IEXPLORE!为wWinMainCRTStartup(00a52d79)
优先级:0优先级:32亲和力:3
2编号:162c.1020挂起:1 Teb:7ffdc000未冻
开始:OLE32中存在!CRpcThreadCache::RpcWorkerThreadEntry(76dfe0cc)
优先级:0优先级:32亲和力:3
3编号:162c.1e00挂起:1 Teb:7ffda000未冻
开始:ntdll中!TppWaiterpThread(778ab61b)
优先级:0优先级:32亲和力:3
4编号:162c.1f00挂起:1 Teb:7ffd9000未冻
开始:msvcrt!_endthreadex 0 x6f(76162da8)
优先级:0优先级:32亲和力:3
。五编号:162c.1b08挂起:1 Teb:7ffd8000未冻
开始:IEFRAME!CTabWindow::_TabWindowThreadProc(6c163fdb)
优先级:0优先级:32亲和力:3
7编号:162c.170挂起:1 Teb:7ffd6000未冻
开始:npctrl!CXcpDispatcher::DispatcherTimerCallback(6a6d16f4)
优先级:0优先级:32亲和力:3
8编号:162c.1cd0挂起:1 Teb:7ffd5000未冻
开始:coreclr!DebuggerRCThread::ThreadProcStatic(640eb5cd)
优先级:0优先级:32亲和力:3
9编号:162c.928挂起:1 Teb:7ffd4000未冻
开始:coreclr!主题::intermediateThreadProc(63fb8e4f)
优先级:0优先级:32亲和力:3
10编号:162c.1e8c挂起:1 Teb:7ffd3000未冻
开始:coreclr!主题::intermediateThreadProc(63fb8e4f)
优先级:0优先级:32亲和力:3
11编号:162c.1fac挂起:1 Teb:7ffaf000未冻
开始:agcore!CMulticoreTaskScheduler::WorkerThread(660547de)
优先级:0优先级:32亲和力:3
12编号:162c.1b78挂起:1 Teb:7ffae000未冻
开始:agcore!CMulticoreTaskScheduler::WorkerThread(660547de)
优先级:0优先级:32亲和力:3
13编号:162c.1d18挂起:1 Teb:7ffdb000未冻
开始:ntdll中!RtlUserThreadStart(778c9a78)
优先级:0优先级:32亲和力:3
管理框架处理失败,0x80004005的HRESULT
综合管理调试不支持枚举变量的地方。
http://dbg/managed.htm了解更多详情。

/ /比较!clrstack&K等输出
0:005>!clrstack磷/ /列表仅托管堆栈帧
操作系统线程ID:0x1b08(5)
EIP的电除尘器
0450f850 04800398 SilverlightApplication1.Page.Button_Click(System.Object的,System.Windows.RoutedEventArgs)
参数:
今(<CLR reg>)= 0x04f59c78
寄件人(<CLR reg>)= 0x04f5b948
é(0x0450f854)= 0x04f9f1f0

0450f858 048cde0d System.Windows.Controls.Primitives.ButtonBase.OnClick()
参数:
今(0x0450f864)= 0x04f5b948

0450f870 048cdd10 System.Windows.Controls.Button.OnClick()
参数:
本= <无data>

0450f880 048cdc3d System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
参数:
今(0x0450f884)= 0x04f5b948
é(0x0450f880)= 0x04f9f188

0450f890 048cdba1 System.Windows.Controls.Control.OnMouseLeftButtonUp(System.Windows.Controls.Control,System.EventArgs)
参数:
按Ctrl = <无data>
é = <无data>

0450f8a0 0483a0e7 MS.Internal.JoltHelper.FireEvent(新窗口,IntPtr,的Int32,System.String)
参数:
unmanagedObj(0x0450f8f8)= 0x04355c48
unmanagedObjArgs(0x0450f8f4)= 0x0707be00
argsTypeIndex(0x0450f928)= 0x000000a9
eventName(0x0450f924)= 0x04f9f16c

0450fa74 63ef17b0 [GCFrame:0450fa74]
0450fb30 63ef17b0 [ContextTransitionFrame:0450fb30]
0450fc28 63ef17b0 [UMThkCallFrame:0450fc28]
0:005> kP的/ /列出所有堆栈帧
ChildEBP RetAddr
0450f868 048cde0d SilverlightApplication1!Button_Click(<HRESULT 0x80004001>)
0450f868 048cdd10 System_Windows!System.Windows.Controls.Primitives.ButtonBase.OnClick(<HRESULT 0x80004001>)+0 x5d
0450f878 048cdc3d System_Windows!System.Windows.Controls.Button.OnClick(<HRESULT 0x80004001>)+0 x48
0450f888 048cdba1 System_Windows!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(<HRESULT 0x80004001>)+0 x85
0450f898 0483a0e7 System_Windows!System.Windows.Controls.Control.OnMouseLeftButtonUp(<HRESULT 0x80004001>)+0 X41笔记本
0450f91c 63ef17b0 System_Windows!MS.Internal.JoltHelper.FireEvent(<HRESULT 0x80004001>)+0 x1b7
0450f934 63ef5f98 coreclr!CallDescrWorker +0 x33
0450f9b0 63f032bc coreclr!CallDescrWorkerWithHandler 0 x8e
0450f9d0 63f0345c coreclr!ForwardCallToManagedMethod +0 x55
0450faf4 63fc4abf coreclr!DoUMThunkCallWorker +0 x199
0450fbe0 04c513d2 coreclr!DoUMThunkCall +0 x1b4
警告:框架没有任何已知的IP模块。 以下框架可能是错误的。
0450fc10 6607e0db 0x4c513d2
0450fc70 6a6dc1fc agcore!CCoreServices::CLR_FireEvent +0 x183
管理框架处理失败,0x80004005的HRESULT
0450fc84 6a6dc187 npctrl!CommonBrowserHost::CLR_FireEvent +0 x2a
0450fcc8 6a6dc048 npctrl!CControlBase::ScriptCallback +0 x366
0450fd08 6a6dc013 npctrl!CXcpDispatcher::OnScriptCallback +0 xee
0450fd14 6a6dbfef npctrl!CXcpDispatcher::OnWindowMessage +0 x3a
0450fd2c 7731f8d2 npctrl!CXcpDispatcher::的WindowProc +0 x7f
0450fd58 7731f794 USER32!InternalCallWinProc +0 x23
0450fdd0 77320008 USER32!UserCallWinProcCheckWow +0 x14b

/ /检查堆,注意堆方便强类型对象,
/ /而不是联合国类型字节,在本地堆
0:005>!dumpheap型SilverlightApplication1
地址吨尺寸
04f4f31c 046336b0 36
04f59c78 04633a6c 68
共2个对象
统计:
吨数TotalSize类名称
046336b0 1 36 SilverlightApplication1.App
04633a6c 1 68 SilverlightApplication1.Page
共有2个对象
0:005>!做04f59c78
名称:SilverlightApplication1.Page
MethodTable:04633a6c
EEClass:0463196c
尺寸:68(0x44)字节
文件:SilverlightApplication1,版本= 1.0.0.0,文化=中立,PublicKeyToken =空
领域:
野外型室速教师责任观偏移值名称
047d97a0 40000dc 4 ... al.NativeResource 0实例04f5a5c0 m_nativePtr
04853ab8 40000df 8 ... System.Windows]] 0实例00000000 _valueTable
047d9874 40000e0 ç ... reTypeEventHelper 0实例04f5a600 _coreTypeEventHelper
04856388 40000e3 10 ... bject,mscorlib程序]] 0实例04f79a58 _treeChildren
047ae03c 40000e4 14 ... rnal.IManagedPeer 0实例00000000 _treeParent
03d50a90 40000dd 2b0 System.IntPtr一共享静态StaticNativePointer
>>域名:值0433c738:NotInit 06f529d8:00000000 <<
03d50f28 40000de 2B4组System.Boolean一共享静态_isCoreCreate
>>域名:值0433c738:NotInit 06f529d8:0 <<
047ae384 40000e1 8 .... DependencyObject的0共享静态PropertyReferencesHolder
>>域名:值0433c738:NotInit 06f529d8:04f489b8 <<
04661618 40000e2 ç ... flection.Assembly 0共享静态_executingAssembly
>>域名:值0433c738:NotInit 06f529d8:00000000 <<
047d0b90 40000f1 18 ... rs.AutomationPeer 0实例00000000 m_pAP
047d7404 40000e8 10 ... ependencyProperty 0共享静态OpacityProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a4a8 <<
047d7404 40000e9 14 ... ependencyProperty 0共享静态ClipProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a4d0 <<
047d7404 40000ea 18 ... ependencyProperty 0共享静态RenderTransformProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a4f8 <<
047d7404 40000eb集成电路... ependencyProperty 0共享静态OpacityMaskProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a50c <<
047d7404 40000ec 20 ... ependencyProperty 0共享静态RenderTransformOriginProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a534 <<
047d7404 40000ed 24 ... ependencyProperty 0共享静态IsHitTestVisibleProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a548 <<
047d7404 40000ee 28 ... ependencyProperty 0共享静态VisibilityProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a570 <<
047d7404 40000ef 2C型... ependencyProperty 0共享静态RenderSizeProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a598 <<
047d7404 40000f0 30 ... ependencyProperty 0共享静态UseLayoutRoundingProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a5ac <<
00000000 4000108 00000000 BindingValidationError集成电路0实例
04856ae4 400010a 20 ... angedEventHandler 0实例00000000 DPChanged
048bc8a4 400010b 24 ... angedEventHandler 0实例00000000 DataContextChanged
03d50f28 400010c 2C型System.Boolean一实例0 _isDataContextBound
0481f43c 400010d 28 ... angedEventHandler 0实例00000000 _sizeChanged
047d7404 40000f2 34 ... ependencyProperty 0共享静态TriggersProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a144 <<
047d7404 40000f3 38 ... ependencyProperty 0共享静态ResourcesProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a158 <<
047d7404 40000f4 3c中... ependencyProperty 0共享静态LanguageProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a180 <<
047d7404 40000f5 40 ... ependencyProperty 0共享静态ActualWidthProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a194 <<
047d7404 40000f6 44 ... ependencyProperty 0共享静态ActualHeightProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a1a8 <<
047d7404 40000f7 48 ... ependencyProperty 0共享静态WidthProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a1bc <<
047d7404 40000f8 4c中... ependencyProperty 0共享静态HeightProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a1d0 <<
047d7404 40000f9 50 ... ependencyProperty 0共享静态MinWidthProperty
>>域名:值0433c738:NotInit 06f529d8:04f5a1e4 <<
047d7404 40000fa 54 ... ependencyProperty 0共享静态MaxWidthProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a1f8 <<
047d7404  40000fb       58 ...ependencyProperty  0   shared   static MinHeightProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a20c <<
047d7404  40000fc       5c ...ependencyProperty  0   shared   static MaxHeightProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a220 <<
047d7404  40000fd       60 ...ependencyProperty  0   shared   static HorizontalAlignmentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a234 <<
047d7404  40000fe       64 ...ependencyProperty  0   shared   static VerticalAlignmentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a248 <<
047d7404  40000ff       68 ...ependencyProperty  0   shared   static MarginProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a25c <<
047d7404  4000100       6c ...ependencyProperty  0   shared   static StyleProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a284 <<
047d7404  4000101       70 ...ependencyProperty  0   shared   static ParentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a2ac <<
047d7404  4000102       74 ...ependencyProperty  0   shared   static NameProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a2c0 <<
047d7404  4000103       78 ...ependencyProperty  0   shared   static TagProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a2d4 <<
047d7404  4000104       7c ...ependencyProperty  0   shared   static TagInternalProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a2fc <<
04851464  4000105       80 ...ndows.RoutedEvent  0   shared   static LoadedEvent
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a420 <<
047d7404  4000106       84 ...ependencyProperty  0   shared   static CursorProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a440 <<
047d7404  4000107       88 ...ependencyProperty  0   shared   static InstanceDelegateStoreProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a468 <<
047d7404  4000109       8c ...ependencyProperty  0   shared   static DataContextProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a494 <<
047a1e2c  400010e       90 ...rence, mscorlib]]  0   shared   static _staticDelegateList
>> Domain:Value  0433c738:NotInit  06f529d8:00000000 <<
00000000  4000264       30 ...angedEventHandler  0 instance 00000000 IsEnabledChanged
047d7404  4000252      430 ...ependencyProperty  0   shared   static IsTabStopProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59ce4 <<
047d7404  4000253      434 ...ependencyProperty  0   shared   static TabIndexProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59cf8 <<
047d7404  4000254      438 ...ependencyProperty  0   shared   static TemplateProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59d20 <<
047d7404  4000255      43c ...ependencyProperty  0   shared   static TabNavigationProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59d48 <<
047d7404  4000256      440 ...ependencyProperty  0   shared   static PaddingProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59d70 <<
047d7404  4000257      444 ...ependencyProperty  0   shared   static HorizontalContentAlignmentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59d98 <<
047d7404  4000258      448 ...ependencyProperty  0   shared   static VerticalContentAlignmentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59dc0 <<
047d7404  4000259      44c ...ependencyProperty  0   shared   static BackgroundProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59de8 <<
047d7404  400025a      450 ...ependencyProperty  0   shared   static BorderBrushProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59dfc <<
047d7404  400025b      454 ...ependencyProperty  0   shared   static BorderThicknessProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e10 <<
047d7404  400025c      458 ...ependencyProperty  0   shared   static FontSizeProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e24 <<
047d7404  400025d      45c ...ependencyProperty  0   shared   static FontFamilyProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e4c <<
047d7404  400025e      460 ...ependencyProperty  0   shared   static ForegroundProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e60 <<
047d7404  400025f      464 ...ependencyProperty  0   shared   static FontWeightProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e88 <<
047d7404  4000260      468 ...ependencyProperty  0   shared   static FontStyleProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59eb0 <<
047d7404  4000261      46c ...ependencyProperty  0   shared   static FontStretchProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59ed8 <<
047d7404  4000262      470 ...ependencyProperty  0   shared   static DefaultStyleKeyProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59eec <<
047d7404  4000263      474 ...ependencyProperty  0   shared   static IsEnabledProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59f00 <<
04857f14  4000265      478 ... System.Windows]]  0   shared   static _resourceDictionaryCache
>> Domain:Value  0433c738:NotInit  06f529d8:04f5cae4 <<
03cf5668  4000266      47c      System.Object[]  0   shared   static _controlDelgates
>> Domain:Value  0433c738:NotInit  06f529d8:04f59f14 <<
047d7404  4000501      77c ...ependencyProperty  0   shared   static ContentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59cd0 <<
04852580  4000002       34 ...ows.Controls.Grid  0 instance 04f79770 LayoutRoot
04852a10 4000003       38 ...s.Controls.Button  0 instance 04f5b948 button
03d50f28  4000004       3c       System.Boolean  1 instance        1 _contentLoaded

// two lines above is the button object of the page object
// remember its address 04f5b948 , since we will refer to it later
// we can get the same address for the button object via dumpheap command:
0:005> !dumpheap -mt 04852a10
Address       MT     Size
04f5b948 04852a10       92
total 1 objects
统计:
MT    Count    TotalSize Class Name
04852a10        1           92 System.Windows.Controls.Button
Total 1 objects
0:005> !gcwhere 04f5b948 // button is in gen0, since there is no GC yet
Address            Gen   Heap   segment            begin              allocated           size
04f5b948   0      0     04f40000   04f41000   04f9fff4    0x5c(92)
0:005> !gcroot 04f5b948  // see who's holding reference to the button object
Note: Roots found on stacks may be false positives. Run "!help gcroot" for
more info.
// registry references
ecx:Root:  04f59c78(SilverlightApplication1.Page)->
04f5b948(System.Windows.Controls.Button)->
edx:Root:  04f5b948(System.Windows.Controls.Button)->
// stack references
Scan Thread 5 OSTHread 1b08
ESP:450f860:Root:  04f5ca18(System.Windows.RoutedEventHandler)->
04f59c78(SilverlightApplication1.Page)->
04f5b948(System.Windows.Controls.Button)->
ESP:450f864:Root:  04f5b948(System.Windows.Controls.Button)->
ESP:450f874:Root:  04f5b948(System.Windows.Controls.Button)->
ESP:450f884:Root:  04f5b948(System.Windows.Controls.Button)->
ESP:450f894:Root:  04f5b948(System.Windows.Controls.Button)->
ESP:450f8d4:Root:  04f5b948(System.Windows.Controls.Button)->
ESP:450f8e4:Root:  04f5b948(System.Windows.Controls.Button)->
Scan Thread 9 OSTHread 928
Scan Thread 10 OSTHread 1e8c
// domain references
DOMAIN(06F529D8):HANDLE(Pinned):46412f8:Root:  05f44260(System.Object[])->
04f45234(System.Collections.Generic.List`1[[System.Object, mscorlib]])->
04f59980(System.Object[])->
04f59c78(SilverlightApplication1.Page)->
04f5b948(System.Windows.Controls.Button)->
Managed frame processing failed, HRESULT 0x80004005
Integrated managed debugging does not support enumeration of local variables.
See http://dbg/managed.htm for more details.

// examine the button object itself
0:005> !do 04f5b948
Name:        System.Windows.Controls.Button
MethodTable: 04852a10
EEClass:     0482e5f0
Size:        92(0x5c) bytes
File:        c:\Program Files\Microsoft Silverlight\2.0.31005.0\System.Windows.dll
Fields:
MT    Field   Offset                 Type VT     Attr    Value Name
047d97a0  40000dc        4 ...al.NativeResource  0 instance 04f5bd58 m_nativePtr
04853ab8  40000df        8 ... System.Windows]]  0 instance 04f5c0bc _valueTable
047d9874  40000e0        c ...reTypeEventHelper  0 instance 04f5bd88 _coreTypeEventHelper
04856388  40000e3       10 ...bject, mscorlib]]  0 instance 04f5bee8 _treeChildren
047ae03c  40000e4       14 ...rnal.IManagedPeer  0 instance 04f79770 _treeParent
03d50a90  40000dd      2b0        System.IntPtr  1   shared   static StaticNativePointer
>> Domain:Value  0433c738:NotInit  06f529d8:00000000 <<
03d50f28  40000de      2b4       System.Boolean  1   shared   static _isCoreCreate
>> Domain:Value  0433c738:NotInit  06f529d8:0 <<
047ae384  40000e1        8 ....DependencyObject  0   shared   static PropertyReferencesHolder
>> Domain:Value  0433c738:NotInit  06f529d8:04f489b8 <<
04661618  40000e2        c ...flection.Assembly  0   shared   static _executingAssembly
>> Domain:Value  0433c738:NotInit  06f529d8:00000000 <<
047d0b90  40000f1       18 ...rs.AutomationPeer  0 instance 00000000 m_pAP
047d7404  40000e8       10 ...ependencyProperty  0   shared   static OpacityProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a4a8 <<
047d7404  40000e9       14 ...ependencyProperty  0   shared   static ClipProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a4d0 <<
047d7404  40000ea       18 ...ependencyProperty  0   shared   static RenderTransformProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a4f8 <<
047d7404  40000eb       1c ...ependencyProperty  0   shared   static OpacityMaskProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a50c <<
047d7404  40000ec       20 ...ependencyProperty  0   shared   static RenderTransformOriginProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a534 <<
047d7404  40000ed       24 ...ependencyProperty  0   shared   static IsHitTestVisibleProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a548 <<
047d7404  40000ee       28 ...ependencyProperty  0   shared   static VisibilityProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a570 <<
047d7404  40000ef       2c ...ependencyProperty  0   shared   static RenderSizeProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a598 <<
047d7404  40000f0       30 ...ependencyProperty  0   shared   static UseLayoutRoundingProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a5ac <<
00000000  4000108       1c                       0 instance 00000000 BindingValidationError
04856ae4  400010a       20 ...angedEventHandler  0 instance 00000000 DPChanged
048bc8a4  400010b       24 ...angedEventHandler  0 instance 00000000 DataContextChanged
03d50f28  400010c       2c       System.Boolean  1 instance        0 _isDataContextBound
0481f43c  400010d       28 ...angedEventHandler  0 instance 00000000 _sizeChanged
047d7404  40000f2       34 ...ependencyProperty  0   shared   static TriggersProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a144 <<
047d7404  40000f3       38 ...ependencyProperty  0   shared   static ResourcesProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a158 <<
047d7404  40000f4       3c ...ependencyProperty  0   shared   static LanguageProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a180 <<
047d7404  40000f5       40 ...ependencyProperty  0   shared   static ActualWidthProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a194 <<
047d7404  40000f6       44 ...ependencyProperty  0   shared   static ActualHeightProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a1a8 <<
047d7404  40000f7       48 ...ependencyProperty  0   shared   static WidthProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a1bc <<
047d7404  40000f8       4c ...ependencyProperty  0   shared   static HeightProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a1d0 <<
047d7404  40000f9       50 ...ependencyProperty  0   shared   static MinWidthProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a1e4 <<
047d7404  40000fa       54 ...ependencyProperty  0   shared   static MaxWidthProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a1f8 <<
047d7404  40000fb       58 ...ependencyProperty  0   shared   static MinHeightProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a20c <<
047d7404  40000fc       5c ...ependencyProperty  0   shared   static MaxHeightProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a220 <<
047d7404  40000fd       60 ...ependencyProperty  0   shared   static HorizontalAlignmentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a234 <<
047d7404  40000fe       64 ...ependencyProperty  0   shared   static VerticalAlignmentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a248 <<
047d7404  40000ff       68 ...ependencyProperty  0   shared   static MarginProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a25c <<
047d7404  4000100       6c ...ependencyProperty  0   shared   static StyleProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a284 <<
047d7404  4000101       70 ...ependencyProperty  0   shared   static ParentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a2ac <<
047d7404  4000102       74 ...ependencyProperty  0   shared   static NameProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a2c0 <<
047d7404  4000103       78 ...ependencyProperty  0   shared   static TagProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a2d4 <<
047d7404  4000104       7c ...ependencyProperty  0   shared   static TagInternalProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a2fc <<
04851464  4000105       80 ...ndows.RoutedEvent  0   shared   static LoadedEvent
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a420 <<
047d7404  4000106       84 ...ependencyProperty  0   shared   static CursorProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a440 <<
047d7404  4000107       88 ...ependencyProperty  0   shared   static InstanceDelegateStoreProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a468 <<
047d7404  4000109       8c ...ependencyProperty  0   shared   static DataContextProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5a494 <<
047a1e2c  400010e       90 ...rence, mscorlib]]  0   shared   static _staticDelegateList
>> Domain:Value  0433c738:NotInit  06f529d8:00000000 <<
00000000  4000264       30 ...angedEventHandler  0 instance 00000000 IsEnabledChanged
047d7404  4000252      430 ...ependencyProperty  0   shared   static IsTabStopProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59ce4 <<
047d7404  4000253      434 ...ependencyProperty  0   shared   static TabIndexProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59cf8 <<
047d7404  4000254      438 ...ependencyProperty  0   shared   static TemplateProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59d20 <<
047d7404  4000255      43c ...ependencyProperty  0   shared   static TabNavigationProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59d48 <<
047d7404  4000256      440 ...ependencyProperty  0   shared   static PaddingProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59d70 <<
047d7404  4000257      444 ...ependencyProperty  0   shared   static HorizontalContentAlignmentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59d98 <<
047d7404  4000258      448 ...ependencyProperty  0   shared   static VerticalContentAlignmentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59dc0 <<
047d7404  4000259      44c ...ependencyProperty  0   shared   static BackgroundProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59de8 <<
047d7404  400025a      450 ...ependencyProperty  0   shared   static BorderBrushProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59dfc <<
047d7404  400025b      454 ...ependencyProperty  0   shared   static BorderThicknessProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e10 <<
047d7404  400025c      458 ...ependencyProperty  0   shared   static FontSizeProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e24 <<
047d7404  400025d      45c ...ependencyProperty  0   shared   static FontFamilyProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e4c <<
047d7404  400025e      460 ...ependencyProperty  0   shared   static ForegroundProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e60 <<
047d7404  400025f      464 ...ependencyProperty  0   shared   static FontWeightProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59e88 <<
047d7404  4000260      468 ...ependencyProperty  0   shared   static FontStyleProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59eb0 <<
047d7404  4000261      46c ...ependencyProperty  0   shared   static FontStretchProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59ed8 <<
047d7404  4000262      470 ...ependencyProperty  0   shared   static DefaultStyleKeyProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59eec <<
047d7404  4000263      474 ...ependencyProperty  0   shared   static IsEnabledProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f59f00 <<
04857f14  4000265      478 ... System.Windows]]  0   shared   static _resourceDictionaryCache
>> Domain:Value  0433c738:NotInit  06f529d8:04f5cae4 <<
03cf5668  4000266      47c      System.Object[]  0   shared   static _controlDelgates
>> Domain:Value  0433c738:NotInit  06f529d8:04f59f14 <<
03cf44e8  40002b4       34        System.Object  0 instance 00000000 _treeContent
047d7404  40002b3      530 ...ependencyProperty  0   shared   static ContentTemplateProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5bd30 <<
047d7404  40002b5      534 ...ependencyProperty  0   shared   static ContentProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5bd44 <<
03d50f28  40005aa       40       System.Boolean  1 instance        1 _isLoaded
03d50f28  40005ab       41       System.Boolean  1 instance        1 _isMouseCaptured
03d50f28  40005ac       42       System.Boolean  1 instance        0 _isSpaceKeyDown
03d50f28  40005ad       43       System.Boolean  1 instance        0 _isMouseLeftButtonDown
04852208  40005ae       48 System.Windows.Point  1 instance 04f5b990 _mousePosition
048b5f98  40005af       38 ...mation.Storyboard  0 instance 00000000 _currentState
03d50f28  40005b0       44       System.Boolean  1 instance        0 _suspendStateChanges
0481fae0  40005b1       3c ...outedEventHandler  0 instance 04f5ca18 Click
047d7404  40005a6      7e0 ...ependencyProperty  0   shared   static ClickModeProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5ba7c <<
047d7404  40005a7      7e4 ...ependencyProperty  0   shared   static IsFocusedProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5bb38 <<
047d7404  40005a8      7e8 ...ependencyProperty  0   shared   static IsMouseOverProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5bbd8 <<
047d7404  40005a9      7ec ...ependencyProperty  0   shared   static IsPressedProperty
>> Domain:Value  0433c738:NotInit  06f529d8:04f5bc40 <<

// dump button.Click field (9 lines above)
0:005> !do 04f5ca18
Name:        System.Windows.RoutedEventHandler
MethodTable: 0481fae0
EEClass:     0482c99c
Size:        32(0x20) bytes
File:        c:\Program Files\Microsoft Silverlight\2.0.31005.0\System.Windows.dll
Fields:
MT    Field   Offset                 Type VT     Attr    Value Name
03cf44e8  40001e0        4        System.Object  0 instance 04f59c78 _target
04663c58  40001e1        8 ...ection.MethodBase  0 instance 00000000 _methodBase
03d50a90  40001e2        c        System.IntPtr  1 instance 463c08c _methodPtr
03d50a90  40001e3       10        System.IntPtr  1 instance        0 _methodPtrAux
03cf44e8  40001e4       14        System.Object  0 instance 00000000 _invocationList
03d50a90  40001e5       18        System.IntPtr  1 instance        0 _invocationCount

0:005> !do -nofields 04f59c78 // verify _target is page
Name:        SilverlightApplication1.Page
MethodTable: 04633a6c
EEClass:     0463196c
Size:        68(0x44) bytes
File:        SilverlightApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

// verify _methodPtr points to Button_Click
// see how they are all linked together
0:005> ln 463c08c
(0463c08c)   SilverlightApplication1.Page.Button_Click(System.Object, System.Windows.RoutedEventArgs)
0:005> u 463c08c // jit-ed method stub
SilverlightApplication1.Page.Button_Click(System.Object, System.Windows.RoutedEventArgs):
0463c08c b8303a6304      mov     eax,4633A30h
0463c091 89ed            mov     ebp,ebp
0463c093 e900431c00      jmp     SilverlightApplication1!Button_Click ( 04800398 )
0463c098 0000            add     byte ptr [eax],al
0463c09a 0000            add     byte ptr [eax],al
0463c09c 0000            add     byte ptr [eax],al
0463c09e 0000            add     byte ptr [eax],al
0463c0a0 0000            add     byte ptr [eax],al
0:005> u eip // jit-ed native code
SilverlightApplication1!Button_Click:
04800398 55              push    ebp
04800399 8bec            mov     ebp,esp
0480039b 83ec08          sub     esp,8
0480039e 894dfc          mov     dword ptr [ebp-4],ecx
048003a1 8955f8          mov     dword ptr [ebp-8],edx
048003a4 833d7435630400  cmp     dword ptr ds:[4633574h],0
048003ab 7405            je      SilverlightApplication1!Button_Click+0x1a (048003b2)
048003ad e8862a895f      call    coreclr!JIT_DbgIsJustMyCode (64092e38)
0:005> !ip2md 04800398
MethodDesc: 04633a30
Method Name: SilverlightApplication1.Page.Button_Click(System.Object, System.Windows.RoutedEventArgs)
Class:       0463196c
MethodTable: 04633a6c
mdToken:     06000008
Module:      046333b4
IsJitted:    yes
CodeAddr: 04800398
0:005> !dumpil 04633a30
ilAddr = 047e03fe
IL_0000: nop
IL_0001: ret

When I have time, I may write a blog post on CLR internals, to demonstrate how objects are laid out in memory, how method calls are dispatched etc.

结论

This is a long post, but still it barely constitute an overview of WinDbg and SOS. Good understanding of CLR is important for coding and debugging, WinDbg with SOS is the best tool to explore CLR and do advanced debugging. Hope this short yet long post will help you get started in exploring CLR and Silverlight. 谢谢!

Technorati Tags: , , , ,

分享和欣赏:

  • Print
  • email
  • RSS
  • Twitter
  • TwitThis
  • del.icio.us
  • LinkedIn
  • Technorati
  • Facebook
  • Google Bookmarks
  • Live
  • MySpace
  • QQ书签
Categories: Debug , Silverlight Tags: , , ,