April 3rd, 2024

Windows debugger trick: Breaking when a specific debugger message is printed

In the Windows debugging engine, the sx command configures many of the conditions under which the debugger will break. To enable a break condition, you say sxecond, and the corresponding sxd to disable it. For example, a common command is to ask for the debugger to break when a specific DLL is loaded by saying sxeld contoso.dll.

To break when a specific string is printed to the debugger, you can say sxe out:str. For example, sxe out:*assertion failure* will break whenever any message contains the phrase “assertion failure”. Here’s the wildcard syntax.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • Shawn Van Ness

    Did you mean sxd not sdx? (muscle-memory / habit? 🙂

    More windbg / kdb advanced tips and tricks please .. it could be a whole series.

    There are some “windbg cheatsheets” but not much else out there, that I can find.