aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llwindebug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llwindebug.cpp')
-rw-r--r--linden/indra/newview/llwindebug.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/linden/indra/newview/llwindebug.cpp b/linden/indra/newview/llwindebug.cpp
index e6c11d8..1b52a14 100644
--- a/linden/indra/newview/llwindebug.cpp
+++ b/linden/indra/newview/llwindebug.cpp
@@ -633,6 +633,44 @@ BOOL LLWinDebug::setupExceptionHandler()
633 // Internal builds don't mess with exception handling. 633 // Internal builds don't mess with exception handling.
634 //return TRUE; 634 //return TRUE;
635} 635}
636
637void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const char *filename)
638{
639 if(f_mdwp == NULL || gDirUtilp == NULL)
640 {
641 return;
642 //write_debug("No way to generate a minidump, no MiniDumpWriteDump function!\n");
643 }
644 else
645 {
646 std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
647 filename);
648
649 HANDLE hFile = CreateFileA(dump_path.c_str(),
650 GENERIC_WRITE,
651 FILE_SHARE_WRITE,
652 NULL,
653 CREATE_ALWAYS,
654 FILE_ATTRIBUTE_NORMAL,
655 NULL);
656
657 if (hFile != INVALID_HANDLE_VALUE)
658 {
659 // Write the dump, ignoring the return value
660 f_mdwp(GetCurrentProcess(),
661 GetCurrentProcessId(),
662 hFile,
663 type,
664 ExInfop,
665 NULL,
666 NULL);
667
668 CloseHandle(hFile);
669 }
670
671 }
672}
673
636// static 674// static
637LONG LLWinDebug::handleException(struct _EXCEPTION_POINTERS *exception_infop) 675LONG LLWinDebug::handleException(struct _EXCEPTION_POINTERS *exception_infop)
638{ 676{
@@ -648,6 +686,18 @@ LONG LLWinDebug::handleException(struct _EXCEPTION_POINTERS *exception_infop)
648 686
649 if (exception_infop) 687 if (exception_infop)
650 { 688 {
689 if(gSavedSettings.getControl("SaveMinidump") != NULL && gSavedSettings.getBOOL("SaveMinidump"))
690 {
691 _MINIDUMP_EXCEPTION_INFORMATION ExInfo;
692
693 ExInfo.ThreadId = ::GetCurrentThreadId();
694 ExInfo.ExceptionPointers = exception_infop;
695 ExInfo.ClientPointers = NULL;
696
697 writeDumpToFile(MiniDumpNormal, &ExInfo, "SecondLife.dmp");
698 writeDumpToFile((MINIDUMP_TYPE)(MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory), &ExInfo, "SecondLifePlus.dmp");
699 }
700
651 701
652 std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, 702 std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
653 "SecondLifeException"); 703 "SecondLifeException");