Every once in a while you run across an undocumented trick that totally and completely makes your day. A great example of that is the ability to debug MSBuild scripts in Visual Studio. Today I ran across another amazingly useful feature in WinDBG and SOS for .NET 4.0 that will save you countless hours of typing when analyzing minidumps. If you thought using .cmdtree to click your way to SOS happiness was amazing, you’re going to love this one.
The next time you start a WinDBG debugging session with SOS 4.0, issue the following undocumented command before you run any SOS commands:
.prefer_dml 1
If you’ve been using WinDBG for a while, you might have heard of DML (Debugger Mark Up Language). It’s a feature of WinDBG where you can get hyperlinks in specific command output, such as LM (Loaded Modules) where you can click on a module to get more information about that module. To see DML in action, execute the lm /D command and you’ll see the hyperlinks in the Command window like the following:
Clicking on one of the links will execute the lmDvm<module> command which not only shows the version, but allows you to dump all the native symbols using the X command.
So what does DML have to do with SOS? It turns out everything! Once you’ve issued the .prefer_dml 1 command some serious magic happens. For example, here’s the output of the !dso (Dump Stack Objects) command:
You’ve never seen !dso look so sexy, have you? If you click on one of those object addresses, that will issue the !dumpobj /d <address> command for that address:
With SOS 4.0 Microsoft has implemented DML in most of the commands! If you want the clickable output on an SOS command, add the /d command line option. Here’s an example with !threads /d:
Even the most useful command, !dumpheap, supports the /d option:
Get in the habit of adding /d to SOS 4.0 commands so you can debug faster by clicking your way to happiness. As I mentioned, not all commands support /d, but most do. Note that I’m using the latest WinDBG, 6.12.002.633, from the Windows SDK. I haven’t checked if the SOS DML works in previous versions of the debugger but suspect it will.
A huge part of the joy of our business is discovering new features even if they haven’t been fully supported that make your life easier. It’s like the developers were anticipating your needs and thinking about what would make your life better. The SOS 4.0 developers deserve a ton of credit for bringing a huge smile to my face and everyone who needs to debug those tough to solve problems!
Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…
Cloud management is difficult to do manually, especially if you work with multiple cloud…
Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…
https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…
FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…
Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…
View Comments
See the corrected entry with pictures https://training.atmosera.com/CS/blogs/jrobbins/archive/2010/07/14/a-cool-windbg-sos-hidden-feature.aspx
Thanks for the cool tip, John. It didn't "made my day", but it helps a lot! ;)
I've set up the Explorer shell to open .dmp files with this:
"C:Program FilesDebugging Tools for Windows (x86)windbg.exe" -c ".prefer_dml 1" -z "%1"
Debug A Cool WinDBG/SOS Hidden Feature (blog de John Robbins) John nous livre une information que les
Web Replacing text in the DOM… it’s not that simple! Object-Oriented PHP for Beginners -
OT: there's something wrong with one of my favorite articles...
When I try to go to:
https://training.atmosera.com/CS/blogs/jrobbins/archive/2010/06/17/how-to-capture-a-minidump-let-me-count-the-ways.aspx
I am redirected to a "Oops something went wrong" page:
https://training.atmosera.com/CS/error.htm?aspxerrorpath=/CS/blogs/post.aspx
:(((
Paco,
Thanks for the notice. We've had an issue with CS and should have everything fixed now.
- John Robbins
Now it works! Thanks a lot!
And keep up the good work!
"The next time you start a WinDBG debugging session with SOS 4.0"
By the way, what does SOS mean? Yes, I know, "Son of Strike", but what does "Son of Strike" mean ?
A reference to the Son of Sam?
A reference to another program named Strike?
A reference to some idiom that only an native English speaker can get?
Just random words that compose the famous distress signal SOS ?
An ABBA song? (remember your article: http://msdn.microsoft.com/en-us/magazine/cc164138.aspx )
Or was the extension written after a strike action? :)
Paco,
Strike was the code name for the extension and it just kind of stuck. Some of the code names used for pieces of the original .NET runtime were Thunder, Lighting, Fusion, etc. Like SOS, Fusion is still used as the name of the "Fusion Log Viewer" tool to see your assembly bindings at load time.
Just code names gone wild. :)
- John Robbins