MAINT-2740 make use of OsOutputDebugString _DEBUG only to avoid interactions between Win 32-bit SEH and boost coroutine fiber stack handling

master
Graham Madarasz 2013-06-04 09:05:23 -07:00
parent dcfb18373e
commit 97a2171ea8
5 changed files with 28 additions and 13 deletions

View File

@ -201,10 +201,7 @@ namespace {
virtual void recordMessage(LLError::ELevel level,
const std::string& message)
{
llutf16string utf16str =
wstring_to_utf16str(utf8str_to_wstring(message));
utf16str += '\n';
OutputDebugString(utf16str.c_str());
LL_WINDOWS_OUTPUT_DEBUG(wstring_to_utf16str(utf8str_to_wstring(message)));
}
};
#endif

View File

@ -283,6 +283,20 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
#define LL_ENDL llendl
#define LL_CONT (*_out)
// Short story: We don't want to enable this in release builds.
//
// Long story: ...because this call generates C++ exceptions
// which are handled and fine under the debugger, but instant death should they occur from
// within a coroutine's stackframe due to inherent limitations of Windows 32-bit SEH
// interacting with the fiber-based coroutine support used by boost.
//
// gmad BUG-2707/MAINT-2740
#if LL_WINDOWS && defined(_DEBUG)
#define LL_WINDOWS_OUTPUT_DEBUG(a) OutputDebugString(utf8str_to_utf16str(a).c_str()), OutputDebugString("\n")
#else
#define LL_WINDOWS_OUTPUT_DEBUG(a)
#endif
/*
Use this construct if you need to do computation in the middle of a
message:

View File

@ -1385,7 +1385,7 @@ public:
return false;
}
// Congratulations, we've hit a new low. :-P
#if _DEBUG
LL_INFOS("FrameWatcher") << ' ';
if (! prevSize)
{
@ -1398,6 +1398,9 @@ public:
}
LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n'
<< LLMemoryInfo() << LL_ENDL;
#else
(void)prevSize;
#endif
return false;
}

View File

@ -1311,8 +1311,7 @@ void LLXUIParser::parserWarning(const std::string& message)
#ifdef LL_WINDOWS
// use Visual Studo friendly formatting of output message for easy access to originating xml
llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str());
utf16str += '\n';
OutputDebugString(utf16str.c_str());
LL_WINDOWS_OUTPUT_DEBUG(utf16str);
#else
Parser::parserWarning(message);
#endif
@ -1322,8 +1321,7 @@ void LLXUIParser::parserError(const std::string& message)
{
#ifdef LL_WINDOWS
llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()).c_str());
utf16str += '\n';
OutputDebugString(utf16str.c_str());
LL_WINDOWS_OUTPUT_DEBUG(utf16str);
#else
Parser::parserError(message);
#endif
@ -1642,8 +1640,7 @@ void LLSimpleXUIParser::parserWarning(const std::string& message)
#ifdef LL_WINDOWS
// use Visual Studo friendly formatting of output message for easy access to originating xml
llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str());
utf16str += '\n';
OutputDebugString(utf16str.c_str());
LL_WINDOWS_OUTPUT_DEBUG(utf16str);
#else
Parser::parserWarning(message);
#endif
@ -1653,8 +1650,7 @@ void LLSimpleXUIParser::parserError(const std::string& message)
{
#ifdef LL_WINDOWS
llutf16string utf16str = utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()).c_str());
utf16str += '\n';
OutputDebugString(utf16str.c_str());
LL_WINDOWS_OUTPUT_DEBUG(utf16str);
#else
Parser::parserError(message);
#endif

View File

@ -61,13 +61,18 @@ void ll_winmm_shim_initialize(){
{ // we have a dll, let's get out pointers!
initialized = true;
init_function_pointers(winmm_handle);
#if defined(_DEBUG)
::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n");
#endif
}
#if defined(_DEBUG)
else
{
// failed to initialize real winmm.dll
::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n");
}
#endif
}
LeaveCriticalSection(&sCriticalSection);
}