ExtCS -C# extension to access DebugEngine

Purpose

This extension allows you to write C# scripts against windbg(or other debugging tools like cdb.exe ntsd.exe etc). With the help of this extension, Now you can write windbg scripts in C# utilizing the vast array of .net libraries available

Why do I need this?

If you want to automate the debugger but dislike the WinDbg built-in script ,now you can use C# language and all the framework librarires. Even if you don't want to create your own script, maybe some existing scripts will be of interest to you?

Supported Features

  • Supports all the windows debugging tools (cdb.exe, ntsd.exe , windbg.exe etc.)
  • Visual Studio Editor support –Write your scripts in VS with intellisense goodness
  • Complete debugging support. Just give break point in the C# script and attach VS to windbg to do debugging.
  • Support for kernel mode debugging(still in early beta )
  • REPL support –You can use your debugger to execute C# statements write on the command window
support for 32bit and 64 bit .Scripts require very minimal change or no change at all to run on 32 or 64 bit dumps

Quick start


Here’s another simple example of what this extension does:

!execute –file c:\scripts\heapstat.csx


//contents of heapstat.csx
#r "C:\Program Files\Debugging Tools for Windows (x64)\ExtCS.Debugger.dll"
#r "System.Data"
#r "System.Xml"
using System;
using ExtCS.Debugger;

var d = Debugger.Current;
//load the sos.dll
var sos=new Extension("sos.dll");
//call the command on sos.dll and get tehe output to variable heapstat
var heapstat=sos.Call("!dumpheap -stat");
//output heapstat to debugger
d.Output(heapstat);

Please refer documentation for more details

Script Samples

Last edited Jul 8, 2013 at 1:14 AM by rohithkrajan, version 9