WinDbg Preview 1.0.1812.12001 and new extensibility interfaces


Hi everyone and happy holidays!

We've got a more extension focused release this time around, with a new C++ header, a new data model extension focusing around enabling easier JavaScript extensions, and a bunch of new samples!

Feel free to leave any questions or comments below or reach out to me on Twitter @aluhrs13. If you have feedback on our samples feel free to open a GitHub issue, or a PR if you want to contribute a fix or change.

Debugger data model C++ header

Last month we released a C++ header, DbgModel.h, as part of the Windows SDK for extending the debugger data model via C++. You can find more information in our official docs - https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/data-model-cpp-overview

The main page includes a great overview of how the debugger data model works and how extensions built on the new C++ header, JavaScript, NatVis, and the 'dx' command all inter-op and is work a read for anyone interested on ther internals of the debugger.

New Data Model API Extension

This release includes a new extension that adds some more "API style" features to the debugger data model that can be accessed through the 'dx' command, JavaScript, and the new DbgModel.h header. This extension extensions the data model to include knowledge about assembly and code execution through the Debugger.Utility.Code namespace, and the local file system through the Debugger.Utility.FileSystem namespace.

You can find the full docs for these new namespaces and the objects associated with them at:

Code

File System

The main goal of this extension is to improve the API surface available to JavaScript extensions, but all the functionality can be used via 'dx' and LINQ queries, for example:

0:000> dx Debugger.Utility.FileSystem.FileExists("C:\\Users\\aluhrs\\Desktop\\HelloWorld.txt")
Debugger.Utility.FileSystem.FileExists("C:\\Users\\aluhrs\\Desktop\\HelloWorld.txt") : false

Or

0:000> dx Debugger.Utility.FileSystem.TempDirectory.Files.Count(),d
Debugger.Utility.FileSystem.TempDirectory.Files.Count(),d : 110

This can be useful when writing scripts to quickly validate what a method might return in a REPL-like fashion. These extensions are also available in WinDbg and our command-line client in the latest Windows Insider SDK Preview - https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewSDK

Known issues

There are a couple known issues in this release that will be fixed in our next release:

  • Many of the iterable objects returned from properties on the disassembler can only safely be iterated once. It is perfectly fine to, in JavaScript, do: `var operandCount = instr.Operands.Count(); for (var operand of instr.Operands) { … }`. The following will have undefined results: `var operands = instr.Operands; var operandCount = operands.Count(); for (var operand of operands) { … }`.
  • There can be an incorrect flow graph produced from DisassembleFunction for some functions (overlapping basic blocks with incorrect flow links).

Synthetic types extension

With this new API extension, we have a new sample up on our GitHub repo here - https://github.com/Microsoft/WinDbg-Samples/tree/master/SyntheticTypes.

This JavaScript extension reads basic C header files and defines synthetic type information for the structures and unions defined in the header. Through the dx command, memory can then be viewed structured as if you had a PDB with type information for those types.

Other change and bug fixes

    • WinDbg Preview will now more intelligently handle bringing source windows or the disassembly window to the foreground when stepping.
    • Re-arranged WinDbgNext's window title to have more important information at the start when kernel debugging.
    • The alternating background contrast in the command window should be slightly more noticeable.

 


Comments (2)
  1. Bendono says:

    Any update on plans for the traditional WinDbg? I’d love to see a future post about it.
    It is great to see continued improvements to WinDbg Preview. Unfortunately, though, being a Windows Store app excludes this from Windows 7 machines, which is still 80%+ of what I need to debug. And even for the other roughly 20% I still need to be able to xcopy to customer production servers, so again Preview is quite impractical.

    1. Andy Luhrs says:

      Most of the features here are what we call “platform” functionality that work in traditional WinDbg, WinDbg Preview, and our command-line clients. So everything in this post (outside the other changes that are obviously WinDbg Preview specific) is usable from traditional WinDbg in the Insider SDK – https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewSDK. I’ve added a note to the post to clarify that.

      With regards to WinDbg Preview supporting Windows 7, unfortunately it isn’t a high priority for us right now to add a different ship vehicle and the associated support costs. We’re still planning on adding it to the SDK eventually, but not immediately.

Comments are closed.

Skip to main content