摘要:源代码如下: using System; using System.Threading; namespace Advanced.NET.Debugging.Chapter6 { class Abort { public void WorkerThread() { try { ...
阅读全文
摘要:源代码如下: using System; using System.Text; using System.Threading; namespace Advanced.NET.Debugging.Chapter6 { internal class DBWrapper1 { private string connectionString; public ...
阅读全文
摘要:程序代码如下: using System; using System.Text; using System.Threading; namespace Advanced.NET.Debugging.Chapter6 { internal class DBWrapper1 { private string connectionString; public...
阅读全文
摘要:程序如下: using System; using System.Text; using System.Threading; namespace Advanced.NET.Debugging.Chapter6 { class Simple { static void Main(string[] args) { Simple s...
阅读全文
摘要:程序如下: using System; using System.Text; using System.Runtime.InteropServices; namespace Advanced.NET.Debugging.Chapter5 { class Fragment { static void Main(string[] args) { ...
阅读全文
摘要:源程序如下: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
阅读全文
摘要:代码如下: using System; using System.Text; using System.Runtime.InteropServices; namespace Advanced.NET.Debugging.Chapter5 { class LOH { static void Main(string[] args) { ...
阅读全文
摘要:程序如下: using System; using System.Text; using System.Runtime.InteropServices; namespace Advanced.NET.Debugging.Chapter5 { class NativeEvent { private IntPtr nativeHandle; public...
阅读全文
摘要:源代码如下: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 =
阅读全文
摘要:代码如下: using System; using System.Text; using System.Runtime.Remoting; namespace Advanced.NET.Debugging.Chapter5 { class Name { private string first; private string last; ...
阅读全文
摘要:程序如下: using System; using System.Text; using System.Runtime.Remoting; namespace Advanced.NET.Debugging.Chapter5 { class Name { private string first; private string last; ...
阅读全文
摘要:程序在执行RunInDedicated()方法时会失败,原因在于执行h.Unwrap()时需要读取EntityUtil定义的程序集,但是CreateDomain()方法创建domain的时候指定的ApplicationBase为C:\\Windows\\system32。 1. 在WinDbg里载入AppDomain.exe. 2. 揿2执行RunInDedicated()方法时,出错。 3....
阅读全文
摘要:将程序的04assembly.dll改为04assembly.old,这个时候程序将找不到该dll。 1. 在WinDbg里载入04TypeCast.exe 2. 执行 sxe 0xe0434f4d 3. 执行 g 4. 在程序发生异常停下来之后,执行 .loadby sos.dll mscorwks 5. 执行 kb ,打印出托管和非托管的call stack的内容。 6. 可见,在...
阅读全文
摘要:03simple.exe的源代码如下: 在执行到ReadKey()的时候,Ctrl+C,执行!clrstack -a以后得到如下的结果: 分析如下: 1. Clr的Stack里出来的方法的顺序和源程序是反的,因而应该从下往上看。 2. !clrstack 紧紧列出调用的方法,!clrstack –l 还附带列出本地的变量的指针, !clrstack –p 还附带列出参数,而-a是-p和-l的效...
阅读全文
摘要:针对的程序为03ObjTypes.cs,其部分代码如下,试图让程序在断点处,得到其中ObjTypes中的coordinate对象,intArray对象,strArray对象和本地的point对象的具体值。 1. 在WinDbg下载入03ObjTypes.exe。 2. 连续执行两次 g, 到程序要求按任意键继续处。 3. 执行 Ctrl + C。 4. 执行 .loadby sos.dll ...
阅读全文
摘要:为托管代码设置断点的一个难点是,在IL被解释之前,不知道machine code会放在哪里。这是可以借助!bpmd –md md address来对相应的托管代码的方法进行断点设置 1. 在WinDbg下载入03breakpoint.exe 2. 在命令行内当程序要求输入任意键继续是,执行ctrl + C 3. 执行 .loadby sos.dll mscorwks 4. 执行 !nam...
阅读全文
摘要:1. 首先在 WinDbg下载入notepad.exe 2. 设定symbol path .sympath c:\symbols 3. 使用X命令查找有哪些Save函数: 结果是找到其中一个想要的命令 notepad 函数 notepad!SaveFile 4. 设置断点 bp notepad!SaveFile 5 使用 g 继续执行,打开记事本,运行Save命令,断点击中。
阅读全文
摘要:1. 在WinDbg下载入01MDASample.exe 2. 执行 sxe ld mscorwks.dll 该命令的作用是在进程载入mscorwks之后停下来 3. 执行 g 可见程序在载入mscorwks.dll 之后停下来了 4. 执行 .loadby sos.dll mscorwks
阅读全文
摘要:针对如下的程序,要为其静态方法AddAndPrint加上Breakpoint: 1. 在WinDbg下载入breakpoin.exe 2. 执行 .sympath c:\symbols 指定symbol的路径 3. 执行 g 4. 此时命令提示行内程序会提示按仍意键继续,输入任意键 5. 程序会进行第二次的按任意键继续,此时在命令提示行界面下按Ctrl+C 6. 在WinDbg里面执行 ...
阅读全文
摘要:1. 执行tlist得到该程序的PID 2. 在debugger目录下执行 ntsd –p pid
阅读全文