]> git.saurik.com Git - wxWidgets.git/commitdiff
added GenerateNow()
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 17 Jan 2005 02:04:06 +0000 (02:04 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 17 Jan 2005 02:04:06 +0000 (02:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31422 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/crashrpt.h
src/msw/crashrpt.cpp

index 8f602e9b2dcee5494b25eae4c7bd0ebc29f28187..6e7b725512f9e4fd65e10386c53b62d78b852f18 100644 (file)
@@ -48,7 +48,10 @@ enum
     //
     // this creates a much larger mini dump than just wxCRASH_REPORT_STACK but
     // still much smaller than wxCRASH_REPORT_LOCALS one
-    wxCRASH_REPORT_GLOBALS = 4
+    wxCRASH_REPORT_GLOBALS = 4,
+
+    // default is to create the smallest possible crash report
+    wxCRASH_REPORT_DEFAULT = wxCRASH_REPORT_LOCATION | wxCRASH_REPORT_STACK
 };
 
 // ----------------------------------------------------------------------------
@@ -101,10 +104,14 @@ struct WXDLLIMPEXP_BASE wxCrashReport
     //
     // if ep pointer is NULL, the global exception info which is valid only
     // inside wxApp::OnFatalException() is used
-    static bool Generate(int flags = wxCRASH_REPORT_LOCATION |
-                                     wxCRASH_REPORT_STACK,
+    static bool Generate(int flags = wxCRASH_REPORT_DEFAULT,
                          _EXCEPTION_POINTERS *ep = NULL);
 
+
+    // generate a crash report from outside of wxApp::OnFatalException(), this
+    // can be used to take "snapshots" of the program in wxApp::OnAssert() for
+    // example
+    static bool GenerateNow(int flags = wxCRASH_REPORT_DEFAULT);
 };
 
 #endif // wxUSE_CRASHREPORT
index 9edcd4524d061eeff26c7f044997319c82b6764a..7662ab077999224d901b068853e7f12a1da67789 100644 (file)
@@ -255,6 +255,24 @@ bool wxCrashReport::Generate(int flags, EXCEPTION_POINTERS *ep)
     return impl.Generate(flags, ep);
 }
 
+/* static */
+bool wxCrashReport::GenerateNow(int flags)
+{
+    bool rc = false;
+
+    __try
+    {
+        RaiseException(0x1976, 0, 0, NULL);
+    }
+    __except( rc = Generate(flags, (EXCEPTION_POINTERS *)GetExceptionInformation()),
+              EXCEPTION_CONTINUE_EXECUTION )
+    {
+        // never executed because of EXCEPTION_CONTINUE_EXECUTION above
+    }
+
+    return rc;
+}
+
 // ----------------------------------------------------------------------------
 // wxCrashContext
 // ----------------------------------------------------------------------------