From 97a2171ea88fe52060e1dfe3fb09d2c320e1bb10 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 4 Jun 2013 09:05:23 -0700 Subject: MAINT-2740 make use of OsOutputDebugString _DEBUG only to avoid interactions between Win 32-bit SEH and boost coroutine fiber stack handling --- indra/llcommon/llerror.cpp | 5 +---- indra/llcommon/llerror.h | 14 ++++++++++++++ indra/llcommon/llsys.cpp | 5 ++++- indra/llui/llxuiparser.cpp | 12 ++++-------- indra/media_plugins/winmmshim/winmm_shim.cpp | 5 +++++ 5 files changed, 28 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 9b0141eb76..5c8e6cca29 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -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 diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index b65b410153..08a5cd26df 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -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: diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 57a6de9060..418c5763f8 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -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; } diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 3ad5ad7d42..4f3a2e0623 100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -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 diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp index 47a1e5c018..9e2e7ad3aa 100755 --- a/indra/media_plugins/winmmshim/winmm_shim.cpp +++ b/indra/media_plugins/winmmshim/winmm_shim.cpp @@ -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); } -- cgit v1.2.3 From 2750e86beb8220baa62f978c7ccb391654eb955b Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 4 Jun 2013 12:57:03 -0700 Subject: MAINT-2740 and MAINT-2672 rework after code review for 2740 fix and include 2672 fix needed for doing local integ tests --- indra/llcommon/llerror.cpp | 16 +++++++++++++++- indra/llcommon/llerror.h | 29 ++++++++++++++--------------- indra/llcommon/llsys.cpp | 5 +---- indra/llui/llxuiparser.cpp | 12 ++++-------- indra/lscript/lscript_compile/indra.l | 8 +++----- indra/lscript/lscript_compile/indra.y | 7 ------- 6 files changed, 37 insertions(+), 40 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 5c8e6cca29..10b8b3105b 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -201,7 +201,7 @@ namespace { virtual void recordMessage(LLError::ELevel level, const std::string& message) { - LL_WINDOWS_OUTPUT_DEBUG(wstring_to_utf16str(utf8str_to_wstring(message))); + LL_WINDOWS_OUTPUT_DEBUG(wstring_to_utf16str(utf8str_to_wstring(message)).c_str()); } }; #endif @@ -1398,5 +1398,19 @@ namespace LLError { sIndex = 0 ; } + +#if LL_WINDOWS && !defined(LL_RELEASE_FOR_DOWNLOAD) + void LLOutputDebugUTF16(const unsigned short* s) + { + // Be careful not to enable this in non-debug builds as there are bad interactions between the + // exceptions thrown by this function and the handling of stacks in coroutine fibers. BUG-2707 + // + #if defined(_DEBUG) + OutputDebugString(s); + OutputDebugString(TEXT("\n")); + #endif + } +#endif + } diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 08a5cd26df..1bc93b4def 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -34,7 +34,6 @@ #include "llerrorlegacy.h" #include "stdtypes.h" - /** Error Logging Facility Information for most users: @@ -199,8 +198,22 @@ namespace LLError static void clear() ; static void end(std::ostringstream* _out) ; }; + +#if LL_WINDOWS && !defined(LL_RELEASE_FOR_DOWNLOAD) + void LLOutputDebugUTF16(const unsigned short* s); +#endif + } +#if LL_WINDOWS && !defined(LL_RELEASE_FOR_DOWNLOAD) + // Macro accepting a wchar_t* for display in windows debugging console in debug builds only + // (wchar_t flavor chosen for maximal utility with unicode text debugging) + // + #define LL_WINDOWS_OUTPUT_DEBUG(a) LLError::LLOutputDebugUTF16((a)) +#else + #define LL_WINDOWS_OUTPUT_DEBUG(a) +#endif + //this is cheaper than llcallstacks if no need to output other variables to call stacks. #define llpushcallstacks LLError::LLCallStacks::push(__FUNCTION__, __LINE__) #define llcallstacks \ @@ -283,20 +296,6 @@ 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: diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 418c5763f8..57a6de9060 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1385,7 +1385,7 @@ public: return false; } // Congratulations, we've hit a new low. :-P -#if _DEBUG + LL_INFOS("FrameWatcher") << ' '; if (! prevSize) { @@ -1398,9 +1398,6 @@ public: } LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' << LLMemoryInfo() << LL_ENDL; -#else - (void)prevSize; -#endif return false; } diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 4f3a2e0623..a92ec7a3c1 100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -1310,8 +1310,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()); - LL_WINDOWS_OUTPUT_DEBUG(utf16str); + LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()))); #else Parser::parserWarning(message); #endif @@ -1320,8 +1319,7 @@ void LLXUIParser::parserWarning(const std::string& message) 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()); - LL_WINDOWS_OUTPUT_DEBUG(utf16str); + LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()))); #else Parser::parserError(message); #endif @@ -1639,8 +1637,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()); - LL_WINDOWS_OUTPUT_DEBUG(utf16str); + LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()))); #else Parser::parserWarning(message); #endif @@ -1649,8 +1646,7 @@ void LLSimpleXUIParser::parserWarning(const std::string& message) 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()); - LL_WINDOWS_OUTPUT_DEBUG(utf16str); + LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()))); #else Parser::parserError(message); #endif diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index b2c49083cb..1bb38bbf65 100755 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -79,11 +79,9 @@ void parse_string(); #define yyfree indra_free -#if defined(__cplusplus) -extern "C" { int yylex( void ); } -extern "C" { int yyparse( void ); } -extern "C" { int yyerror(const char *fmt, ...); } -#endif +int yylex( void ); +int yyparse( void ); +int yyerror(const char *fmt, ...); %} diff --git a/indra/lscript/lscript_compile/indra.y b/indra/lscript/lscript_compile/indra.y index e4b10ffdd9..a0a034d21c 100755 --- a/indra/lscript/lscript_compile/indra.y +++ b/indra/lscript/lscript_compile/indra.y @@ -2,10 +2,6 @@ #include "linden_common.h" #include "lscript_tree.h" - #ifdef __cplusplus - extern "C" { - #endif - int yylex(void); int yyparse( void ); int yyerror(const char *fmt, ...); @@ -20,9 +16,6 @@ #pragma warning( disable : 4065 ) // warning: switch statement contains 'default' but no 'case' labels #endif - #ifdef __cplusplus - } - #endif %} %union -- cgit v1.2.3 From 0638f847c7c74f7981aea7181e4a0e6b23a2052d Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 4 Jun 2013 13:24:35 -0700 Subject: MAINT-2740 fix XUI callsites in debug mode --- indra/llui/llxuiparser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index a92ec7a3c1..2859904302 100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -1310,7 +1310,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 - LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()))); + LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())).c_str()); #else Parser::parserWarning(message); #endif @@ -1319,7 +1319,7 @@ void LLXUIParser::parserWarning(const std::string& message) void LLXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS - LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()))); + LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())).c_str()); #else Parser::parserError(message); #endif @@ -1637,7 +1637,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 - LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()))); + LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())).c_str()); #else Parser::parserWarning(message); #endif @@ -1646,7 +1646,7 @@ void LLSimpleXUIParser::parserWarning(const std::string& message) void LLSimpleXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS - LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()))); + LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())).c_str()); #else Parser::parserError(message); #endif -- cgit v1.2.3 From 0ce3d2e1cc9ae70bc7f6146ce38c5dcc1af4a3c6 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 4 Jun 2013 14:17:34 -0700 Subject: MAINT-2740 convert to std::string based API for OutputDebug wrapper cleanliness after sage counsel (slight refrain) --- indra/llcommon/llerror.cpp | 8 +++++--- indra/llcommon/llerror.h | 4 ++-- indra/llui/llxuiparser.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 10b8b3105b..c2daa6902f 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -201,7 +201,7 @@ namespace { virtual void recordMessage(LLError::ELevel level, const std::string& message) { - LL_WINDOWS_OUTPUT_DEBUG(wstring_to_utf16str(utf8str_to_wstring(message)).c_str()); + LL_WINDOWS_OUTPUT_DEBUG(message); } }; #endif @@ -1400,13 +1400,15 @@ namespace LLError } #if LL_WINDOWS && !defined(LL_RELEASE_FOR_DOWNLOAD) - void LLOutputDebugUTF16(const unsigned short* s) + void LLOutputDebugUTF8(const std::string& s) { // Be careful not to enable this in non-debug builds as there are bad interactions between the // exceptions thrown by this function and the handling of stacks in coroutine fibers. BUG-2707 // #if defined(_DEBUG) - OutputDebugString(s); + // Need UTF16 for Unicode OutputDebugString + // + OutputDebugString(utf8str_to_utf16str(s).c_str()); OutputDebugString(TEXT("\n")); #endif } diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 1bc93b4def..bf8f488aba 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -200,7 +200,7 @@ namespace LLError }; #if LL_WINDOWS && !defined(LL_RELEASE_FOR_DOWNLOAD) - void LLOutputDebugUTF16(const unsigned short* s); + void LLOutputDebugUTF8(const std::string& s); #endif } @@ -209,7 +209,7 @@ namespace LLError // Macro accepting a wchar_t* for display in windows debugging console in debug builds only // (wchar_t flavor chosen for maximal utility with unicode text debugging) // - #define LL_WINDOWS_OUTPUT_DEBUG(a) LLError::LLOutputDebugUTF16((a)) + #define LL_WINDOWS_OUTPUT_DEBUG(a) LLError::LLOutputDebugUTF8((a)) #else #define LL_WINDOWS_OUTPUT_DEBUG(a) #endif diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 2859904302..ee570ce51f 100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -1310,7 +1310,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 - LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())).c_str()); + LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())); #else Parser::parserWarning(message); #endif @@ -1319,7 +1319,7 @@ void LLXUIParser::parserWarning(const std::string& message) void LLXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS - LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())).c_str()); + LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())); #else Parser::parserError(message); #endif @@ -1637,7 +1637,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 - LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())).c_str()); + LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())); #else Parser::parserWarning(message); #endif @@ -1646,7 +1646,7 @@ void LLSimpleXUIParser::parserWarning(const std::string& message) void LLSimpleXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS - LL_WINDOWS_OUTPUT_DEBUG(utf8str_to_utf16str(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())).c_str()); + LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())); #else Parser::parserError(message); #endif -- cgit v1.2.3 From a45860fd662f4b0f6c10bf102ebf6c0aac5127f3 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 4 Jun 2013 17:12:46 -0700 Subject: MAINT-2740 put debug output back with guard of debugger presence per Nat review suggestion --- indra/llcommon/llerror.cpp | 7 ++++--- indra/llcommon/llerror.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index c2daa6902f..37ba097832 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1399,18 +1399,19 @@ namespace LLError sIndex = 0 ; } -#if LL_WINDOWS && !defined(LL_RELEASE_FOR_DOWNLOAD) +#if LL_WINDOWS void LLOutputDebugUTF8(const std::string& s) { // Be careful not to enable this in non-debug builds as there are bad interactions between the // exceptions thrown by this function and the handling of stacks in coroutine fibers. BUG-2707 // - #if defined(_DEBUG) + if (IsDebuggerPresent()) + { // Need UTF16 for Unicode OutputDebugString // OutputDebugString(utf8str_to_utf16str(s).c_str()); OutputDebugString(TEXT("\n")); - #endif + } } #endif diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index bf8f488aba..a2a6993330 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -199,13 +199,13 @@ namespace LLError static void end(std::ostringstream* _out) ; }; -#if LL_WINDOWS && !defined(LL_RELEASE_FOR_DOWNLOAD) +#if LL_WINDOWS void LLOutputDebugUTF8(const std::string& s); #endif } -#if LL_WINDOWS && !defined(LL_RELEASE_FOR_DOWNLOAD) +#if LL_WINDOWS // Macro accepting a wchar_t* for display in windows debugging console in debug builds only // (wchar_t flavor chosen for maximal utility with unicode text debugging) // -- cgit v1.2.3 From 1fcf54094a915bbc7ec1d74a877699212714ae93 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 5 Jun 2013 07:24:31 -0700 Subject: BUG-2707 fix comment typos, remove unnecessary winmm_shim changes, and revert 2672 fix included only for local integ test --- indra/llcommon/llerror.h | 6 ++---- indra/llui/lltextbase.cpp | 4 ++-- indra/llui/llxuiparser.cpp | 6 ++++-- indra/lscript/lscript_compile/indra.l | 8 +++++--- indra/lscript/lscript_compile/indra.y | 7 +++++++ indra/media_plugins/winmmshim/winmm_shim.cpp | 5 ----- 6 files changed, 20 insertions(+), 16 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index a2a6993330..cc9bfba818 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -206,10 +206,8 @@ namespace LLError } #if LL_WINDOWS - // Macro accepting a wchar_t* for display in windows debugging console in debug builds only - // (wchar_t flavor chosen for maximal utility with unicode text debugging) - // - #define LL_WINDOWS_OUTPUT_DEBUG(a) LLError::LLOutputDebugUTF8((a)) + // Macro accepting a const std::string& for display in windows debugging console in debug builds only + #define LL_WINDOWS_OUTPUT_DEBUG(a) LLError::LLOutputDebugUTF8(a) #else #define LL_WINDOWS_OUTPUT_DEBUG(a) #endif diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index a45c4ced2e..588f8dfc34 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -3207,13 +3207,13 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin if(getLength() < segment_offset + mStart) { - llinfos << "getLength() < segment_offset + mStart\t getLength()\t" << getLength() << "\tsegment_offset:\t" + llerrs << "getLength() < segment_offset + mStart\t getLength()\t" << getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << "\tmax_chars\t" << max_chars << llendl; } if(offsetString.length() + 1 < max_chars) { - llinfos << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetString.length():\t" << offsetString.length() << " getLength() : " + llerrs << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetString.length():\t" << offsetString.length() << getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << llendl; } diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index ee570ce51f..6322da9123 100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -1309,7 +1309,7 @@ bool LLXUIParser::writeSDValue(Parser& parser, const void* val_ptr, name_stack_t void LLXUIParser::parserWarning(const std::string& message) { #ifdef LL_WINDOWS - // use Visual Studo friendly formatting of output message for easy access to originating xml + // use Visual Studio friendly formatting of output message for easy access to originating xml LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())); #else Parser::parserWarning(message); @@ -1319,6 +1319,7 @@ void LLXUIParser::parserWarning(const std::string& message) void LLXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS + // use Visual Studio friendly formatting of output message for easy access to originating xml LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())); #else Parser::parserError(message); @@ -1636,7 +1637,7 @@ bool LLSimpleXUIParser::processText() void LLSimpleXUIParser::parserWarning(const std::string& message) { #ifdef LL_WINDOWS - // use Visual Studo friendly formatting of output message for easy access to originating xml + // use Visual Studio friendly formatting of output message for easy access to originating xml LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())); #else Parser::parserWarning(message); @@ -1646,6 +1647,7 @@ void LLSimpleXUIParser::parserWarning(const std::string& message) void LLSimpleXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS + // use Visual Studio friendly formatting of output message for easy access to originating xml LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())); #else Parser::parserError(message); diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 1bb38bbf65..b2c49083cb 100755 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -79,9 +79,11 @@ void parse_string(); #define yyfree indra_free -int yylex( void ); -int yyparse( void ); -int yyerror(const char *fmt, ...); +#if defined(__cplusplus) +extern "C" { int yylex( void ); } +extern "C" { int yyparse( void ); } +extern "C" { int yyerror(const char *fmt, ...); } +#endif %} diff --git a/indra/lscript/lscript_compile/indra.y b/indra/lscript/lscript_compile/indra.y index a0a034d21c..e4b10ffdd9 100755 --- a/indra/lscript/lscript_compile/indra.y +++ b/indra/lscript/lscript_compile/indra.y @@ -2,6 +2,10 @@ #include "linden_common.h" #include "lscript_tree.h" + #ifdef __cplusplus + extern "C" { + #endif + int yylex(void); int yyparse( void ); int yyerror(const char *fmt, ...); @@ -16,6 +20,9 @@ #pragma warning( disable : 4065 ) // warning: switch statement contains 'default' but no 'case' labels #endif + #ifdef __cplusplus + } + #endif %} %union diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp index 9e2e7ad3aa..47a1e5c018 100755 --- a/indra/media_plugins/winmmshim/winmm_shim.cpp +++ b/indra/media_plugins/winmmshim/winmm_shim.cpp @@ -61,18 +61,13 @@ 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); } -- cgit v1.2.3 From bc6070bd197159dd81750d1e2e8af493864be818 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 5 Jun 2013 07:38:54 -0700 Subject: MAINT-2740 more comment grooming and NULL string guard --- indra/llcommon/llerror.cpp | 13 +++++++++---- indra/llcommon/llerror.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 37ba097832..d2af004cde 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1402,15 +1402,20 @@ namespace LLError #if LL_WINDOWS void LLOutputDebugUTF8(const std::string& s) { - // Be careful not to enable this in non-debug builds as there are bad interactions between the - // exceptions thrown by this function and the handling of stacks in coroutine fibers. BUG-2707 + // Be careful when calling OutputDebugString as it throws DBG_PRINTEXCEPTION_C + // which works just fine under the windows debugger, but can cause users who + // have enabled SEHOP exception chain validation to crash due to interactions + // between the Win 32-bit exception handling and boost coroutine fiber stacks. BUG-2707 // if (IsDebuggerPresent()) { // Need UTF16 for Unicode OutputDebugString // - OutputDebugString(utf8str_to_utf16str(s).c_str()); - OutputDebugString(TEXT("\n")); + if (s.size()) + { + OutputDebugString(utf8str_to_utf16str(s).c_str()); + OutputDebugString(TEXT("\n")); + } } } #endif diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index cc9bfba818..0b723aeb5d 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -206,7 +206,7 @@ namespace LLError } #if LL_WINDOWS - // Macro accepting a const std::string& for display in windows debugging console in debug builds only + // Macro accepting a std::string for display in windows debugging console #define LL_WINDOWS_OUTPUT_DEBUG(a) LLError::LLOutputDebugUTF8(a) #else #define LL_WINDOWS_OUTPUT_DEBUG(a) -- cgit v1.2.3