[PowerShell Script] PowerDbg v5.3—Using PowerShell to Control WinDbg

This version has a fix in Parse-PowerDbgDSO. Thanks to Igor Dvorkin that found the bug and suggested the fix.     DOWNLOAD POWERDBG   Download PowerDbg   POWERDBG FILES   WinDbg.PSM1  ß Starting with this version this is the only file.   INSTALLATION   WinDbg.PSM1   Goes to %\WindowsPowerShell\Modules\WinDbg   Note: PowerDbg assumes the folder…


Special Command—Unassembling code with u, ub and uf

When debugging sooner or later you will need to disassemble code to get a better understanding of that code. By disassembling the code, you get the mnemonics translated from the 0s and 1s that constitute the binary code. It is a low level view of the code, but a higher level than seeing just numbers….


Special Command—Using # to Find Patterns of Assembly Instructions

  Sometimes you need to look for patterns of disassembled code. You can browse the disassembled code and manually look for a specific pattern, or you can use a command to automate it.  The # command does that.   # [Pattern] [Address [L Size ]]   Parameters:   Pattern – Specifies the pattern to search…


Special Command—Tracing Applications Using wt

wt [WatchOptions] [= StartAddress] [EndAddress]   Transcribing the WinDbg documentation, this command runs through the whole function and then displays statistics when executed at the beginning of a function call. Thus, this command can be used just when doing live debugging, not post mortem debugging (dump analysis). Think about Watch and Trace.   The WinDbg help file describes…


Special Command—Saving Modules Using .writemem

This command enables you to save memory into a disk file. The cool thing about it is that you can save modules too; however, it is just the raw memory. The parameters are:   .writemem <filename> <range>   Here is an example:   0:026> lm start    end        module name 00400000 00427000   mtgdi      (deferred)             5a700000 5acaf000  …


Special Command—Using .dump/.dumpcab to Get Dumps and Symbols from Production Servers

Using WinDbg you can create a dump file from an application running, for instance, in a production server. After collecting the dump file, you can load it in another machine and debug it. However, to be more effective during your debugging session you need symbols. Thus, thinking about it, here’s the trick to get both dump…


Special Command—Using !chksym/!itoldyouso to Check PDB Files Against Modules

These are two debugger extensions that are used to see the PDB file that matches a specific module. Note that !itoldyouso is not documented. The output of both commands is identical.   Usage:   0:025> !chksym ntdll   ntdll.dll     Timestamp: 49EEA706   SizeOfImage: 180000           pdb: wntdll.pdb       pdb sig: E06BEA15-5E97-48BE-A818-E2D0DD2FED95           age: 2…


Special Command—Displaying Information From Modules/DLLs with !dlls

!dlls extension displays the table entries of all loaded modules. You can also use it to display all modules that a specified thread or process is using. The WinDbg help file describes all parameters. Here we are going to show the most common usage.   Displays file headers and section headers:   !dlls –a  …


Special Command—Using !for_each_frame to Run Commands

!for_each_frame is a favorite among debuggers. It’s a very flexible and powerful command that enables you to run commands for each frame of the call stack. You can use basically any command.  For instance, let’s say you want to see all local variables from each frame of a specific stack. Of course, to see local variables…


Special Command—Displaying More PE Header Information with !dh

The !dh extension displays the PE header information from a specified module.   Usage:   !dh [options] <addressOfModule>   Options can be:   -f Displays file headers. -s Displays section headers. -a Displays all header information.   Example:   0:532> lm   start    end        module name 00400000 00427000   mtgdi      (deferred)             5a700000 5acaf000   mfc90d     (deferred)             692e0000…