随笔分类 -  Advanced .NET Debugging

Advanced .NET Debugging 读书笔记
《Advanced .NET Debugging》 读书笔记 Listing 6-8: Orphaned lock的示例
摘要:源代码如下: using System; using System.Threading; namespace Advanced.NET.Debugging.Chapter6 {     class Abort     {         public void WorkerThread()         {             try             {               ... 阅读全文

posted @ 2011-01-09 20:37 李志鹏 阅读(238) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 6-6: Orphaned locks的简单示例
摘要:源代码如下: using System; using System.Text; using System.Threading; namespace Advanced.NET.Debugging.Chapter6 {     internal class DBWrapper1     {         private string connectionString;         public ... 阅读全文

posted @ 2011-01-09 19:37 李志鹏 阅读(245) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 6-4: Deadlock的简单示例
摘要:程序代码如下: using System; using System.Text; using System.Threading; namespace Advanced.NET.Debugging.Chapter6 {     internal class DBWrapper1     {         private string connectionString;         public... 阅读全文

posted @ 2011-01-09 18:39 李志鹏 阅读(239) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 6-3: 取得Lock的简单示例
摘要:程序如下: using System; using System.Text; using System.Threading; namespace Advanced.NET.Debugging.Chapter6 {     class Simple     {         static void Main(string[] args)         {             Simple s... 阅读全文

posted @ 2011-01-09 16:03 李志鹏 阅读(174) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 5-8: Fragmentation的简单示例
摘要:程序如下: using System; using System.Text; using System.Runtime.InteropServices; namespace Advanced.NET.Debugging.Chapter5 {     class Fragment     {         static void Main(string[] args)         {     ... 阅读全文

posted @ 2011-01-08 13:19 李志鹏 阅读(208) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 5-6: Pining的简单示例
摘要:源程序如下:using System; using System.Text; using System.Runtime.InteropServices;namespace Advanced.NET.Debugging.Chapter5 { class Pinning { static void Main(string[] args) { Pinning p = new Pinning(); p.Run(); } public void Run() { SByte[] b1 = null; SByte[] b2 = null; SByte[] b3 = null; Con 阅读全文

posted @ 2011-01-06 22:58 李志鹏 阅读(241) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 5-5: LOH的简单示例
摘要:代码如下: using System; using System.Text; using System.Runtime.InteropServices; namespace Advanced.NET.Debugging.Chapter5 {      class LOH     {         static void Main(string[] args)         {         ... 阅读全文

posted @ 2011-01-06 22:35 李志鹏 阅读(203) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 5-4: 具有Finalize方法的简单对象
摘要:程序如下: using System; using System.Text; using System.Runtime.InteropServices; namespace Advanced.NET.Debugging.Chapter5 {     class NativeEvent     {         private IntPtr nativeHandle;         public... 阅读全文

posted @ 2011-01-06 00:28 李志鹏 阅读(197) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 5-3: Object的Roots的示例
摘要:源代码如下:using System; using System.Text; using System.Threading;namespace Advanced.NET.Debugging.Chapter5 { class Name { private string first; private string last; public string First { get { return first; } } public string Last { get { return last; } } public Name(string f, string l) { first = 阅读全文

posted @ 2011-01-04 22:46 李志鹏 阅读(218) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 5-2: GC代龄的示例
摘要:代码如下: using System; using System.Text; using System.Runtime.Remoting; namespace Advanced.NET.Debugging.Chapter5 {     class Name     {         private string first;         private string last;       ... 阅读全文

posted @ 2010-12-31 00:53 李志鹏 阅读(226) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 5-1: 简单的内存分配
摘要:程序如下: using System; using System.Text; using System.Runtime.Remoting; namespace Advanced.NET.Debugging.Chapter5 {     class Name     {         private string first;         private string last;       ... 阅读全文

posted @ 2010-12-30 21:33 李志鹏 阅读(236) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 4-4: 调试Assembly加载失败的程序
摘要:程序在执行RunInDedicated()方法时会失败,原因在于执行h.Unwrap()时需要读取EntityUtil定义的程序集,但是CreateDomain()方法创建domain的时候指定的ApplicationBase为C:\\Windows\\system32。 1. 在WinDbg里载入AppDomain.exe. 2. 揿2执行RunInDedicated()方法时,出错。 3.... 阅读全文

posted @ 2010-12-29 23:19 李志鹏 阅读(287) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 4-1/2/3: 调试 FileNotFoundException
摘要:将程序的04assembly.dll改为04assembly.old,这个时候程序将找不到该dll。 1. 在WinDbg里载入04TypeCast.exe 2. 执行 sxe 0xe0434f4d 3. 执行 g 4. 在程序发生异常停下来之后,执行 .loadby sos.dll mscorwks 5. 执行 kb ,打印出托管和非托管的call stack的内容。 6. 可见,在... 阅读全文

posted @ 2010-12-27 23:00 李志鹏 阅读(234) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 3-16: 显示托管代码的Call Stack
摘要:03simple.exe的源代码如下: 在执行到ReadKey()的时候,Ctrl+C,执行!clrstack -a以后得到如下的结果: 分析如下: 1. Clr的Stack里出来的方法的顺序和源程序是反的,因而应该从下往上看。 2. !clrstack 紧紧列出调用的方法,!clrstack –l 还附带列出本地的变量的指针, !clrstack –p 还附带列出参数,而-a是-p和-l的效... 阅读全文

posted @ 2010-12-26 22:01 李志鹏 阅读(247) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 3-10到3-14: 得到程序中各对象的内容
摘要:针对的程序为03ObjTypes.cs,其部分代码如下,试图让程序在断点处,得到其中ObjTypes中的coordinate对象,intArray对象,strArray对象和本地的point对象的具体值。 1. 在WinDbg下载入03ObjTypes.exe。 2. 连续执行两次 g, 到程序要求按任意键继续处。 3. 执行 Ctrl + C。 4. 执行 .loadby sos.dll ... 阅读全文

posted @ 2010-12-26 19:33 李志鹏 阅读(254) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 3-8/3-9: 为托管代码设置断点的过程
摘要:为托管代码设置断点的一个难点是,在IL被解释之前,不知道machine code会放在哪里。这是可以借助!bpmd –md md address来对相应的托管代码的方法进行断点设置 1. 在WinDbg下载入03breakpoint.exe 2. 在命令行内当程序要求输入任意键继续是,执行ctrl + C 3. 执行 .loadby sos.dll mscorwks 4. 执行 !nam... 阅读全文

posted @ 2010-12-25 23:40 李志鹏 阅读(240) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 3-7: 为notepad设置断点的过程
摘要:1. 首先在 WinDbg下载入notepad.exe 2. 设定symbol path .sympath c:\symbols 3. 使用X命令查找有哪些Save函数: 结果是找到其中一个想要的命令 notepad 函数 notepad!SaveFile 4. 设置断点  bp notepad!SaveFile 5 使用 g 继续执行,打开记事本,运行Save命令,断点击中。 阅读全文

posted @ 2010-12-25 23:07 李志鹏 阅读(1631) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 3-6: 使用sxe在程序载入mscorwks之后停下来载入sos
摘要:1. 在WinDbg下载入01MDASample.exe 2. 执行 sxe ld mscorwks.dll 该命令的作用是在进程载入mscorwks之后停下来 3. 执行 g  可见程序在载入mscorwks.dll 之后停下来了 4. 执行 .loadby sos.dll mscorwks 阅读全文

posted @ 2010-12-25 22:25 李志鹏 阅读(240) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 3-4/3-5: 为breakpoint.exe程序的AddAndPrint方法加上breakpoint
摘要:针对如下的程序,要为其静态方法AddAndPrint加上Breakpoint: 1. 在WinDbg下载入breakpoin.exe 2. 执行 .sympath c:\symbols 指定symbol的路径 3. 执行 g 4. 此时命令提示行内程序会提示按仍意键继续,输入任意键 5. 程序会进行第二次的按任意键继续,此时在命令提示行界面下按Ctrl+C 6. 在WinDbg里面执行 ... 阅读全文

posted @ 2010-12-25 21:36 李志鹏 阅读(228) 评论(0) 推荐(0)

《Advanced .NET Debugging》 读书笔记 Listing 3-3: 使用debugger调试一个已经在运行的程序
摘要:1. 执行tlist得到该程序的PID 2. 在debugger目录下执行 ntsd –p pid 阅读全文

posted @ 2010-12-25 16:46 李志鹏 阅读(188) 评论(0) 推荐(0)

导航