Dump Files

Visual Studio can open dump files created from managed, native, or mixed-mode applications. A dump is a snapshot of an application’s memory that lets a developer debug an application postmortem. Dumps are particularly beneficial for debugging production applications. You can create a dump on a production machine and debug elsewhere without interfering with the production application. Several tools are available for creating a dump, including Windbg, Dr. Watson, Autodump+ (ADPlus), and Visual Studio. Visual Studio creates dumps for native applications, such as Microsoft Visual C++ applications, but not for managed applications. Dump files and other advanced debugging topics are discussed in Chapter 16.

In Visual Studio, dump files are opened as projects. Choose Solution/Project from the Open submenu of the File menu. Dump files usually have the .dmp extension. After opening the file, start a debugging session to examine the dump file. Remember that the Debug Start command on the Debug menu (which also can be invoked by pressing the F5 key) starts a debug session. You then can debug and diagnose the dump using the various debug windows. Figure 15-45 and Figure 15-46 show the Call Stack and Modules debug windows, which provide different views of the dump.

The Call Stack window for a dump

Figure 15-45. The Call Stack window for a dump

The Modules window for a dump

Figure 15-46. The Modules window for a dump

Load the Son of Strike debugger extension (SOS.DLL) for a managed perspective of a dump. Load Son of Strike with the .load sos command in the Immediate window. You can then issue various Son of Strike commands, which are prefixed with an exclamation point (!). In Figure 15-47, Son of Strike is loaded. The DumpHeap command is invoked and the output is shown in the Immediate window.

Son of Strike in the Immediate window

Figure 15-47. Son of Strike in the Immediate window

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.77.153