Previous command completion in WinDBG

One of the features I like about kd is that since you are using a console
window, you get a lot of the console functionality for free. The 2 features that
I really like are tab (err, F8) completion and the listing of command history
(F7). On the other hand, windbg has a lot going for it (ignoring the inflamatory
topic of docking windows 😛 ) like source browsing and easier stack frame
navigation, but the one thing I miss the most in windbg is command completion.
Sure you have command history like kd, but who likes to scroll through 10s of
command to get the command you executed 5 minutes ago?

Well, windbg does have command completion! The problem is that it's
hidden. The only reason I know about it is I read every line of the release
notes for the debugger drop one week. As a lark, I tried searching debugger.chm
for the phrace "command completion" and got 114 hits. Needless to say I didn't
have patience to search all 114 to see if one of them actually documented this
feature or not, so I leave it up to you to see if you can find a topic about
this functionality in the help. Windbg's equivalent of kd's
F8 is

The functionality between kd's
(really cmd.exe's) and windbg is nearly the same. They differ when there is
no match for what has been typed. With kd, nothing occurs. On the other hand,
with windbg, the text in the command window is selected. Furthermore, once you have
reached the end of the history, windbg will not wrap back to the beginning (where kd
will wrap). I have found the differences only matter when you are not paying
attention to what you are typing :).

Here's a demo of the command at work. Please note that the output of
!wdfrequest and !wdfmemory is from a new version of wdfkd (which will be in the WDK). Let's say I run these 3 commands:

kd> !WDFREQUEST 0x7df89888
!IRP 0x82b6af20
!WDFQUEUE 0x7e8fdb40
State: Pending, Allocated by WDF for incoming IRP
System Buffer 0x817011a8, Length 0x24, !WDFMEMORY 0x7df89821
IOCTL Output Buffer 0x817011a8, Length 0x10, !WDFMEMORY 0x7df89819

kd> !WDFMEMORY 0x7df89821
WDFMEMORY 0x7df89821: Buffer 0x817011a8, Length 0x24 (36) bytes

kd> !WDFMEMORY 0x7df89819
WDFMEMORY 0x7df89819: Buffer 0x817011a8, Length 0x10 (16) bytes

Now at this point at the prompt kd>, I type "!WDFR", so we have
kd> !WDFR

and if I know hold down the SHIFT key and then press the up arrow key once,
the prompt will look like
kd> !WDFREQUEST 0x7df89888

Comments (3)

  1. hanzhu says:

    I have the feeling that windbg team has a lot to do to improve the UI experience for the programmer, such as adding more key shortcut!

  2. If you would like to see improvements, send email to  

Skip to main content