Debugger commands (gu) that make my life easier


It’s a quick one today. One of the great features about windbg is that it has a return to caller button . I tend to like to keep my hands on the keyboard even when I am using windbg and Shift+F11 is still too cumbersome (long live the home row!). In the past when I wanted to return to the caller, especially in kd, I would do something like this:

kd> k
ChildEBP RetAddr
f233baac f1dc4d34 wdffeatured!ToasterEvtIoRead
f233bac8 f1dc9fe1 Wdf01000!FxFileObjectFileCreate::Invoke+0x34
[…]

kd> g f1dc4d34

kd> k
ChildEBP RetAddr
f233bac8 f1dc9fe1 Wdf01000!FxFileObjectFileCreate::Invoke+0x34
[…]


That involves either mousing over the RetAddr value to select+copy or manually typing in a pointer value. Like I already stated, moving the mouse is not something I want to do and typing in the address is error prone to say the least (and even worse on a 64 bit system!). My life became much easier when I found out about the go up ‘gu’ command. I am sure it has been there for years, I just didn’t know about it until a few months ago though. Since I didn’t know it was there (and nearly all of my coworkers didn’t know either), I thought I would let all of you know about it. Enjoy

d

Comments (3)

  1. joshwil says:

    That’s cool, i’ve always used "g @$ra" which uses the return address virtual register, however "gu" is even better!

  2. I always forget i need the ‘@’ when evaluating registers, so ‘gu’ is good for that as well…less errors on my part ;).  Fewer typos which means that i don’t have windbg searching symbols trying to resolve $ra/eax/etc.

  3. Pavel Lebedinsky says:

    > Fewer typos which means that i don’t have windbg searching symbols trying to resolve $ra/eax/etc.

    This automatic symbol load has to be the single most annoying feature of windbg. Luckily, you can turn it off by enabling SYMOPT_NO_UNQUALIFIED_LOADS option (this can be done using .symopt+ 100, -snul or some UI checkbox in windbg).

    In my team we did this for all debugger sessions in the lab, and it works great.