long123king / dk

dk is a WinDbg extenion for dumping memory data in meaningful and organized ways, it is an enhancement of my previous tokenext project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dk WinDbg extension

Summary

dk is the enhanced refactored version of tokenext. The goal is to improve the readability and extensibility, as well as to leverage the powerful Debugger Data Model and Time Travel Debugging. SVG document will be generated for an intuitive visualization in certain circumstances.

Run !dk help for supported command list.

Check page_2_svg demos:

  1. Initial version
  2. Add pointers to local buffer(in green), pointers to symbols(in red)
  3. Add pointers to heap allocations(in blue)
  4. Add heap allocation changing history, blue rects are clickable

Run following commands to generate callstack forest visualization in svg format(small projects only!), demos for helloworld project can be found here. (Click interaction on svg is blocked by browsers, try it locally)

0:001> !dk ldttd
0:001> !dk dump_ttd_events d:\helloworld_viz

Reference

  1. TTD.hpp from Bindings for Microsoft WinDBG TTD

How to start a new WinDbg C++ extension?

1. Add Windows Kits related folder to Visual Studio project setting:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    ......
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <IncludePath>C:\Program Files (x86)\Windows Kits\10\Debuggers\inc;$(IncludePath)</IncludePath>
    <LibraryPath>C:\Program Files (x86)\Windows Kits\10\Debuggers\lib\x64;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <IncludePath>C:\Program Files (x86)\Windows Kits\10\Debuggers\inc;$(IncludePath)</IncludePath>
    <LibraryPath>C:\Program Files (x86)\Windows Kits\10\Debuggers\lib\x64;$(LibraryPath)</LibraryPath>
  </PropertyGroup>
    ......
</Project>

2. Include engextcpp.cpp from C:\Program Files (x86)\Windows Kits\10\Debuggers\inc to Visual Studio project, and make the following changes:

diff -r C:\Program Files (x86)\Windows Kits\10\Debuggers\inc\engextcpp.cpp C:\Users\dk\source\repos\dk\engextcpp.cpp
248c248
<     m_OptionChars = "/-";
---
>     m_OptionChars = const_cast<PSTR>("/-");
286c286
<     PSTR Value = "";
---
>     PSTR Value = const_cast<PSTR>("");
2673c2673
<              BufferChars > 0)
---
>              *BufferChars > 0)

3. Define exported symbols in dk.def file, and don't forget the 4 default exports:

DebugExtensionInitialize
DebugExtensionUninitialize
DebugExtensionNotify
help

About

dk is a WinDbg extenion for dumping memory data in meaningful and organized ways, it is an enhancement of my previous tokenext project.

License:MIT License


Languages

Language:C++ 98.8%Language:C 1.2%