Ejemplo n.º 1
0
BOOL CreateBigInfoFile(PEXCEPTION_POINTERS pException, CHAR* szBigFile, UINT dwLastError)
{
	if (!pException) return FALSE;


	TCHAR szTempFile[MAX_PATH] = {0};
	strcpy( szTempFile, "./Server_Dump.txt");

	FILE* fp = _tfopen(szTempFile, _T("w"));
	if(!fp) return FALSE;

	Get_Exception_Info(pException, fp, dwLastError);

	fclose(fp); fp = NULL;

	::GetShortPathName(szTempFile, szBigFile, MAX_PATH);
	if(szBigFile[0] == 0) return FALSE;

	return TRUE;
}
Ejemplo n.º 2
0
bool CreateBigInfoFile(PEXCEPTION_POINTERS pException, PTCHAR szBigFile, DWORD dwLastError)
{
	if (!pException) return false;

	TCHAR szTempDir[MAX_PATH] = {0};
	::GetTempPath(MAX_PATH, szTempDir);

	TCHAR szTempFile[MAX_PATH] = {0};
	::GetTempFileName(szTempDir, _T("dtl"), MAX_PATH, szTempFile);

	FILE* fp = _tfopen(szTempFile, _T("w"));
	if(!fp) return false;

	Get_Exception_Info(pException, fp, dwLastError);

	fclose(fp); fp = NULL;

	::GetShortPathName(szTempFile, szBigFile, MAX_PATH);
	if(szBigFile[0] == 0) return false;

	return true;
}
Ejemplo n.º 3
0
// static
void LLWinDebug::generateCrashStacks(struct _EXCEPTION_POINTERS *exception_infop)
{
	// *NOTE:Mani - This method is no longer the exception handler.
	// Its called from viewer_windows_exception_handler() and other places.

	// 
	// Let go of a bunch of reserved memory to give library calls etc
	// a chance to execute normally in the case that we ran out of
	// memory.
	//
	LLSD info;
	std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,
												"PhoenixViewerException");
	std::string log_path = dump_path + ".log";

	if (exception_infop)
	{
		// Since there is exception info... Release the hounds.
		gEmergencyMemoryReserve.release();

		if(gSavedSettings.getControl("SaveMinidump").notNull() && gSavedSettings.getBOOL("SaveMinidump"))
		{
			_MINIDUMP_EXCEPTION_INFORMATION ExInfo;

			ExInfo.ThreadId = ::GetCurrentThreadId();
			ExInfo.ExceptionPointers = exception_infop;
			ExInfo.ClientPointers = NULL;

			writeDumpToFile(MiniDumpNormal, &ExInfo, "PhoenixViewer.dmp");
			writeDumpToFile((MINIDUMP_TYPE)(MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory), &ExInfo, "PhoenixViewerPlus.dmp");
		}

		info = Get_Exception_Info(exception_infop);
	}

	LLSD threads;
    std::vector<DWORD> thread_ids;
    GetProcessThreadIDs(GetCurrentProcessId(), thread_ids);

    for(std::vector<DWORD>::iterator th_itr = thread_ids.begin(); 
                th_itr != thread_ids.end();
                ++th_itr)
    {
        LLSD thread_info;
        if(*th_itr != GetCurrentThreadId())
        {
            GetThreadCallStack(*th_itr, thread_info);
        }

        if(thread_info)
        {
            threads[llformat("ID %d", *th_itr)] = thread_info;
        }
    }

    info["Threads"] = threads;

	llofstream out_file(log_path);
	LLSDSerialize::toPrettyXML(info, out_file);
	out_file.close();
}