Success with WinDBG Extensions

A couple questions have come to me recently around the use of WinDBG extensions.

1) Why do I receive an error when trying to load or execute commands with my WinDBG extension?

2) Why do I have to prefix my commands with the name of the extension (ex. !sos.help vs. !help)?

If you run the .extpath command in WinDBG it will show you the extension search path. If you extension is not found in the path it will require a fully qualified name to load it.

To set the extension search path you can use the same command followed by the new search path such as:

 

.extpath “c:\myextensions;.\somesubdirectory”

 

If you just want to add a directory to the existing search path execute the command with a ‘+’ and now spaces around it (or it will overwrite your search path).

 

.extpath+”c:\myextensions”

 

Ensuring your extension is contained within your search path should help address question number 1.

If you are like me I do not enjoy constantly executing a command every time I open WinDBG, so the way I avoid calling .extpath is through the use of the _NT_DEBUGGER_EXTENSION_PATH environment variable. Put your search path in this and it will be reflected in WinDBG when you run the .extpath command. Through the use of relative paths instead of absolute my search path can be the same in both 32 bit and 64 bit versions of WinDBG

 

As for question 2 it is a matter of setting the default WinDBG extension. You can set the default extension through the use of the .setdll command.

 

.setdll sos.dll

 

I hope this helps clear up some issues that arise through the use of WinDBG extensions.