microsoft / WinDbg-Samples

Sample extensions, scripts, and API uses for WinDbg.
MIT License
707 stars 117 forks source link

Add new TargetComposition sample to support a new "text dump" file format #54

Closed wmessmer-msft closed 2 years ago

wmessmer-msft commented 2 years ago

This change adds a sample for the "target composition" model APIs available via NuGET (https://www.nuget.org/packages/Microsoft.Debugging.TargetModel.SDK/). The sample requires the usage of the WinDbg Preview released to the Microsoft Store on 5/23/2022 (1.2205.18001.0) or later.

The "target composition" APIs allow a plug-in (extension) to "teach" the debugger about new capabilities that are not built-into the debugger. This includes:

It is important to note that these APIs are the same APIs used by various debugger components to support debugging Linux core dumps, DWARF symbols within ELF/MachO, understanding ELF/MachO/etc... binaries and more.

This particular sample is an example of the first style of plug-in. It supports a new "post-mortem" file format called a "text dump". This format is mostly a cut and paste of the output of debugger commands. The plug-in takes a text file with this format and turns it back into a post-mortem target that can be actively debugged. A detailed readme.txt is provided with the sample which walks through the format and how the various files in the plug-in provide services to the debugger. The sample is also thoroughly commented such as to act as an introduction to this API surface.