4. Memory dump options for Windows XP
USER-MODE (APPLICATION) MEMORY DUMPS
For applications that hang or crash, the Debugging Tools for Windows are the easiest way to obtain a memory dump to analyze:
Debugging Tools for Windows - Overview
http://www.microsoft.com/whdc/devtools/deb...ng/default.mspx
1. Open a command prompt and change the working directory to where you installed the Debugging Tools for Windows
Commands to switch to the default folders depending on the version of Windows installed:
32-bit:
cd "\Program Files\Debugging Tools for Windows (x86)"
64-bit:
cd "\Program Files\Debugging Tools for Windows (x64)"
Determine first if the application is crashing ("this program has encountered a problem and will be shut down") or hanging ("not responding"):
For
CRASHING applications:
2. Enter the following command to attach to the
running process MYAPP.EXE (replace as appropriate) which will crash:
adplus -crash -ctcf -pn MYAPP.EXE -quiet -o C:\AppDumps
> Whilst waiting for the process to crash you will see a minimized cdb.exe process
3. Wait for the application MYAPP.EXE to crash (or reproduce the crash if possible)
> A unique folder will be created in C:\AppDumps with the dump file and some .TXT files containing process & thread information
> The minimized cdb.exe window will close when it is done
For
HANGING applications:
2. Enter the following command to attach to the
hung process MYAPP.EXE (replace as appropriate):
adplus -hang -ctcf -pn MYAPP.EXE -quiet -o C:\AppDumps
> A unique folder will be created in C:\AppDumps with the dump file and some .TXT files containing process & thread information
> The minimized cdb.exe window will close when it is done
> The MYAPP.EXE process is
not terminated
VISTA / SERVER 2008 NOTE:
On Windows versions later than Server 2003, the method for getting a dump of a hung process is much easier and does not require the Debugging Tools to be installed - simply start Task Manager, switch to the Processes tab, right-click the process that is hung and select Create Dump File from the context menu. Once the dump process is completed you are informed as to where the file was created.
KERNEL-MODE MEMORY DUMPS
By default, Windows XP only creates "minidumps" a bugcheck (bluescreen) occurs - this is 64KB and contains almost no information to help with a good analysis.
The OS needs to be prepared to produce the right level of detail when bugchecks occur - "kernel" or "complete" dumps.
Kernel dumps will be smaller, but do not hold any information from user-mode space.
Complete dumps contain kernel and user-mode memory and can be considerably larger.
Most of the time kernel dumps are enough to perform good analysis of a problem, and as they are smaller they are quicker to produce and to upload/download.
A memory dump from the OS is created in PAGEFILE.SYS on the boot volume (typically C:) during the time the STOP screen is displayed, along with "beginning dump of physical memory".
Windows then restarts and the dump is copied from C:\PAGEFILE.SYS into a separate file, defaulting to C:\WINDOWS\MEMORY.DMP.
Because the page file
on the boot volume is required, it must exist and have its
initial size large enough to guarantee a successful dump:
KERNEL (32-bit): physical RAM plus 50MB
up to a maximum of 2098MB
KERNEL (64-bit): physical RAM plus 50MB
COMPLETE (32-bit and 64-bit Windows): physical RAM plus 50MB
Additionally you need at least the same amount of free disk space on the boot volume to guarantee that MEMORY.DMP is created.
Quote
e.g. If there is 4GB (4096MB) of RAM installed:
32-bit kernel dump requires: C:\PAGEFILE.SYS 2098MB + at least 2098MB of free disk space on C:
64-bit kernel dump requires: C:\PAGEFILE.SYS 5046MB + at least 5046MB of free disk space on C:
complete dump requires: C:\PAGEFILE.SYS 5046MB + at least 5046MB of free disk space on C:
To check the page file settings:
- Click the
Settings button under
Performance
- Click the
Advanced tab
- Click the
Change button
- Check the page file on the boot volume is large enough, as per the paragraph above
To prepare the system to create a useful memory dump the next time it bugchecks:
- Right-click
My Computer, click
Properties
- Click the
Advanced tab
- Click the
Settings button under
Startup and Recovery
- Under
Write debugging information, select
Kernel memory dump or
Complete memory dump as required
Quote
NOTE:
If the Complete memory dump option is needed and not available (can occur when there is >=2GB RAM present), you need to modify the following registry value manually via RegEdit:
Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl
Name: CrashDumpEnabled
Type: REG_DWORD
Data: 1
For situations where Windows is hanging (rather than crashing), if you have a
PS/2 keyboard connected then you can configure the system to bugcheck on demand by creating the following registry value via RegEdit (then reboot afterwards):
Quote
Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters
Name: CrashOnCtrlScroll
Type: REG_DWORD
Data: 1
To bugcheck the system, hold down the
right-hand CTRL key and press SCROLL LOCK twice.
VISTA / SERVER 2008 NOTE:
On Windows versions later than Server 2003, the dump options are configured in the same place, but to get there you right-click Computer on the Start menu rather than My Computer on the desktop, and click Advanced System Settings in the left pane.
Quote
NOTE:
Due to file / folder permission restrictions, before compressing or attempting to open dump files it is best to make copies of the files to work with - on the desktop or a TEMP folder is advisable - otherwise "access denied" errors can be generated.
NEED SOMEWHERE TO UPLOAD A DUMP FILE FOR ANALYSIS?
SkyDrive is a free Live service providing 5GB of online storage.
It is also recommended to compress the dumps first, using something like
7-zip.