Application Dump

For debug and analysis purposes, getting a complete memory dump of an application is sometimes useful, especially at the time of a crash. COM+ 1.5 allows you to configure a dump of a static memory image of the process hosting your COM+ application. You can use a utility such as WinDbg to view and analyze this image. Every COM+ 1.5 application (including library applications) has a new tab on its properties page called Dump (see Figure B-10). You can specify a location for the image dump and how many images to store there. When the maximum number of images is reached, a new dump image overwrites the oldest one. The maximum number of images you can have COM+ 1.5 store for you is 200. You can generate a dump file in several ways. The first (and most useful) way is to instruct COM+ to dump a memory image on application fault (at the bottom of the Dump tab—see Figure B-10). In this context, an application’s fault is when an exception is thrown.

COM+ 1.5 application Dump tab

Figure B-10. COM+ 1.5 application Dump tab

The second way to generate a dump file is to select Dump from a running application context menu (see Figure B-6). Finally, you can also request a dump explicitly by using the DumpProcess( ) method of the ICOMAdminCatalog2 interface, defined as:

[id(0x1f)] HRESULT DumpProcess([in] BSTR bstrApplInstanceId, 
                               [in] BSTR bstrDirectory, 
                               [in] long lMaxImages, 
                               [out,retval] BSTR* pbstrDumpFile);

When you use the DumpProcess( ) method, you have to provide the dump directory and filename and you cannot rely on the configured values. Requesting a dump (either by calling DumpProcess( ) or selecting Dump from the context menu) on a running application is nonintrusive—the process can continue to run and is only frozen temporarily for the duration of the dump.

When COM+ generates a dumped file, it uses the following naming convention as a filename:

{<
App-ID>}_year_month_day_hour_minute_second.dmp

This convention lets you easily associate a dump file with a reported system failure. For example, here is a typical dump filename:

{02d4b3f1-fd88-11d1-960d-00805fc79235}_2001_06_14_13_28_51.dmp

To avoid calling DumpProcess( ) needlessly, ICOMAdminCatalog2 has a helper method called IsProcessDumpSupported( ) , used to find out whether image dump is enabled on the machine:

[id(0x20)]HRESULT IsProcessDumpSupported([out,retval]VARIANT_BOOL* pbSupported);

You can set the various dump properties programmatically as well, using named properties of the application catalog object. The DumpEnabled property lets you enable or disable image dump for the application, DumpOnException lets you request a dump on exceptions, MaxDumpCount lets you configure the maximum number of dumped files, and DumpPath lets you specify where to save the dumped image files.

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

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