November 13, 2003

DevCon:WinDbg Advanced Debugging

Without a debugger, you are nothing. Ok, maybe not... but it sure makes your life easier.

I have always found gdb a great tool when on Unix (or even cygwin), but think Visual Studio's debugger is way easier to work with on Windows. It's one of the few saving graces for Visual Studio. However, its useless for kernelmode development.

That is what WinDbg is for. And in this session, I am learning what it can really do!

First off, if anyone from Microsoft is listening... make WINDBG work in Visual Studio! (Just my opinion of course) You have a really good app level debugger, why not do the same for kernelmode developers like me?

Just learned something interesting about COM port debugging. You need to disable legacy USB support in the BIOS of the target machine if it doesn't connect right. Maybe this is the problem I am having in my VMWare sessions. I will have to check that out when I get back.

You can use Microsoft's new symstore tool to build you own symbol server. It can easily be scripted, and can run as part of the build process. This is really useful when you need to manage all the different updates for a given kernel.

Looks like Longhorn has a new native assertion failure. Instead of an asm int 3; you will now trigger a __asm int 0x2c; which gives you more control and handling of the software interrupt.

Some interesting Windbg commands:

  • .formats: Converts numbers to timetamps
  • bu: Use to save breakpoints
  • Pseudo registers: $threat - current thread, $ped - current ped (user mode), $ra - return address
  • lm: Detailed info about loaded images
  • .enable_unicode: Show ushorts as chars
  • .enable_long_status: Show signed int as hex
  • .frame: Switch the current frame on a stack
  • .kdfiles: Allows debugger to transfer updates versions of drivers over serial port, to replace the current version installed on the target. DOesn't work for boot drivers. In that case, you need to use the special boot loader with debugger enabled
  • .pcmd: Allows additional debugger info to be shown at each prompt

Lots of neat tips here. I really need to read the updated docs.

Posted by SilverStr at November 13, 2003 02:23 PM | TrackBack