summaryrefslogtreecommitdiff
path: root/indra/newview/llwindebug.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-04-03 19:21:14 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-04-03 19:21:14 +0000
commitb5936a4b1d8780b5b8cd425998eacd2c64ffa693 (patch)
treec1581bcf34e96a897c6e1d9a4aed95f353713baa /indra/newview/llwindebug.cpp
parent55c25229b79b1755c989e5996c8e8d118f369721 (diff)
1.19.1 Viewer merge: QAR_367, QAR-374, QAR-408, QAR-426
QAR_367 (RC1) - merge Branch_1-19-1-Viewer -r 81609 : 81993 -> release QAR-374 (RC2) - merge Branch_1-19-1-Viewer -r 81993 : 82589 -> release QAR-408 (RC3) - merge Branch_1-19-1-Viewer -r 82589 : 83128 -> release QAR-426 (rc4) - merge Branch_1-19-1-Viewer -r 83125 : 83719 -> release (Actual merge: release@83793 Branch_1-19-1-Viewer-merge@83953 -> release)
Diffstat (limited to 'indra/newview/llwindebug.cpp')
-rw-r--r--indra/newview/llwindebug.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/indra/newview/llwindebug.cpp b/indra/newview/llwindebug.cpp
index 42f8a12e4c..7a90be50b8 100644
--- a/indra/newview/llwindebug.cpp
+++ b/indra/newview/llwindebug.cpp
@@ -633,6 +633,44 @@ BOOL LLWinDebug::setupExceptionHandler()
// Internal builds don't mess with exception handling.
//return TRUE;
}
+
+void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const char *filename)
+{
+ if(f_mdwp == NULL || gDirUtilp == NULL)
+ {
+ return;
+ //write_debug("No way to generate a minidump, no MiniDumpWriteDump function!\n");
+ }
+ else
+ {
+ std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
+ filename);
+
+ HANDLE hFile = CreateFileA(dump_path.c_str(),
+ GENERIC_WRITE,
+ FILE_SHARE_WRITE,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ // Write the dump, ignoring the return value
+ f_mdwp(GetCurrentProcess(),
+ GetCurrentProcessId(),
+ hFile,
+ type,
+ ExInfop,
+ NULL,
+ NULL);
+
+ CloseHandle(hFile);
+ }
+
+ }
+}
+
// static
LONG LLWinDebug::handleException(struct _EXCEPTION_POINTERS *exception_infop)
{
@@ -648,6 +686,18 @@ LONG LLWinDebug::handleException(struct _EXCEPTION_POINTERS *exception_infop)
if (exception_infop)
{
+ if(gSavedSettings.getControl("SaveMinidump") != NULL && gSavedSettings.getBOOL("SaveMinidump"))
+ {
+ _MINIDUMP_EXCEPTION_INFORMATION ExInfo;
+
+ ExInfo.ThreadId = ::GetCurrentThreadId();
+ ExInfo.ExceptionPointers = exception_infop;
+ ExInfo.ClientPointers = NULL;
+
+ writeDumpToFile(MiniDumpNormal, &ExInfo, "SecondLife.dmp");
+ writeDumpToFile((MINIDUMP_TYPE)(MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory), &ExInfo, "SecondLifePlus.dmp");
+ }
+
std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
"SecondLifeException");