Sunday, June 20, 2010

HOW TO CAPTURE A MINIDUMP: LET ME COUNT THE WAYS

As I was waiting for a minidump I was grabbing on a very large and busy server application to finish writing, my mind wandered and I realized there were quite a few ways to grab a minidump today. Back in the old Windows days, when we had to program up hill in the snow both ways, there was only WinDBG. Now it seems like an application isn't complete unless it produced a minidump. I thought I'd throw out all the ways I know off the top of my head. Of course, I'm sure there are other ways so please add them in the comments!

Note: I'm only using Windows 7 and Server 2008 R2 these days so some of these might not work on legacy Windows operating systems.

ADPlus/WinDBG's .dump Command

The original heavy duty way to create a minidump. To create a full memory minidump, which you'll need in order to work with .NET's SOS/SOSEX/PSSCOR2 extensions or for native code to follow all memory like linked lists, use the /ma option.

Visual Studio

With Visual Studio 2010, the wonderful "Save Dump As…" menu option now appears on the Debug menu for both native and managed debugging. Any time you need a minidump while debugging, just grab one. Add in the fact that Visual Studio 2010 has the awesome minidump reading capabilities, especially for .NET code, we can now spend way less time in WinDBG.

TaskManager

Many people don't realize that TaskManager knows all about minidumps. When you're either in the Applications or the Processes tabs, right click on the process and select Create Dump File.

Process Explorer

TaskManager is fine, but real developers use Process Explorer to fulfill our task management needs. Right clicking on a process lets you choose a minidump or a full memory minidump.

MiniDumpWriteDump

As I am trying to create a complete list I do need to include the Windows API that actually creates the minidumps themselves: MiniDumpWriteDump. There's nothing stopping you from writing your own program that creates minidumps.

ProcDump

The sweet SysInternals ProcDump tool is designed to get you a minidump when specific nasty issues happen to your processes. It's great for snagging dumps when you have intermittent CPU spikes or memory usage. I find that I'm using this tool constantly on production servers to get minidumps of those hard to reproduce problems. Everyone using computers needs to know about this tool, even your grandmother!

Read more: JOHN ROBBINS' BLOG

Posted via email from .NET Info