From fd96fe41a67ce245134fe26bb8d1d1bb20df6c24 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 1 Mar 2013 11:41:33 -0500 Subject: remove use of system llbase module in integration tests; always use the one from this tree --- indra/llcommon/tests/llleap_test.cpp | 9 +++------ indra/llcommon/tests/llsdserialize_test.cpp | 5 +---- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 9b755e9ca5..29060d4ef5 100644 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -122,13 +122,10 @@ namespace tut // finding indra/lib/python. Use our __FILE__, with // raw-string syntax to deal with Windows pathnames. "mydir = os.path.dirname(r'" << __FILE__ << "')\n" - "try:\n" - " from llbase import llsd\n" - "except ImportError:\n" // We expect mydir to be .../indra/llcommon/tests. - " sys.path.insert(0,\n" - " os.path.join(mydir, os.pardir, os.pardir, 'lib', 'python'))\n" - " from indra.base import llsd\n" + "sys.path.insert(0,\n" + " os.path.join(mydir, os.pardir, os.pardir, 'lib', 'python'))\n" + "from indra.base import llsd\n" "\n" "class ProtocolError(Exception):\n" " def __init__(self, msg, data):\n" diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index e625545763..4d436e8897 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1523,10 +1523,7 @@ namespace tut "sys.path.insert(0,\n" " os.path.join(os.path.dirname(r'" __FILE__ "'),\n" " os.pardir, os.pardir, 'lib', 'python'))\n" - "try:\n" - " from llbase import llsd\n" - "except ImportError:\n" - " from indra.base import llsd\n") + "from indra.base import llsd\n") {} ~TestPythonCompatible() {} -- cgit v1.2.3 From a83289f01f5d037f779991d732de9bf15ed3bda1 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 27 Mar 2013 05:50:55 -0700 Subject: Fix API diffs with new breakpad and point at private breakpad packages to test --- indra/llcommon/CMakeLists.txt | 1 + indra/llcommon/llapp.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 5cce8ff2c4..3e57280067 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -17,6 +17,7 @@ include_directories( ${EXPAT_INCLUDE_DIRS} ${LLCOMMON_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} + ${BREAKPAD_INCLUDE_DIRECTORIES} ) # add_executable(lltreeiterators lltreeiterators.cpp) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index ca258900c7..b3fee0adec 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -350,7 +350,7 @@ void LLApp::setupErrorHandling() if(installHandler && (mExceptionHandler == 0)) { std::string dumpPath = "/tmp/"; - mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true); + mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true, 0); } #endif -- cgit v1.2.3 From 84d6cdf643c037a0f32a3ce24600e674aae5fdd9 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 27 Mar 2013 08:02:53 -0700 Subject: Fix use of breakpad ExceptionHandler on windows --- indra/llcommon/llapp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index b3fee0adec..899aec1a40 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -299,7 +299,7 @@ void LLApp::setupErrorHandling() { llwarns << "adding breakpad exception handler" << llendl; mExceptionHandler = new google_breakpad::ExceptionHandler( - L"C:\\Temp\\", 0, windows_post_minidump_callback, 0, google_breakpad::ExceptionHandler::HANDLER_ALL); + L"C:\\Temp\\", 0, windows_post_minidump_callback, 0, true, google_breakpad::ExceptionHandler::HANDLER_ALL); } #endif #else @@ -350,7 +350,7 @@ void LLApp::setupErrorHandling() if(installHandler && (mExceptionHandler == 0)) { std::string dumpPath = "/tmp/"; - mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true, 0); + mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true, google_breakpad::ExceptionHandler::HANDLER_ALL); } #endif -- cgit v1.2.3 From caa0eb994ca1d1ec06b9330568a8a585ecd251ac Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Wed, 27 Mar 2013 09:11:34 -0700 Subject: Revert previous change because breakpad's ExceptionHandler class has different API on diff platforms --- indra/llcommon/llapp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 899aec1a40..b3fee0adec 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -299,7 +299,7 @@ void LLApp::setupErrorHandling() { llwarns << "adding breakpad exception handler" << llendl; mExceptionHandler = new google_breakpad::ExceptionHandler( - L"C:\\Temp\\", 0, windows_post_minidump_callback, 0, true, google_breakpad::ExceptionHandler::HANDLER_ALL); + L"C:\\Temp\\", 0, windows_post_minidump_callback, 0, google_breakpad::ExceptionHandler::HANDLER_ALL); } #endif #else @@ -350,7 +350,7 @@ void LLApp::setupErrorHandling() if(installHandler && (mExceptionHandler == 0)) { std::string dumpPath = "/tmp/"; - mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true, google_breakpad::ExceptionHandler::HANDLER_ALL); + mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true, 0); } #endif -- cgit v1.2.3 From 48f433212f0b3f6a215156b3b26d0f43863727cd Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 27 Mar 2013 23:18:14 -0700 Subject: Fix breakpad breakage from linux API diffs --- indra/llcommon/llapp.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++--- indra/llcommon/llapp.h | 2 +- 2 files changed, 57 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index b3fee0adec..67e6705cbf 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -69,10 +69,16 @@ bool windows_post_minidump_callback(const wchar_t* dump_path, void setup_signals(); void default_unix_signal_handler(int signum, siginfo_t *info, void *); +#if LL_LINUX +#include "google_breakpad/minidump_descriptor.h" +bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, void* context, bool succeeded); +#else // Called by breakpad exception handler after the minidump has been generated. bool unix_post_minidump_callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded); +#endif + # if LL_DARWIN /* OSX doesn't support SIGRT* */ S32 LL_SMACKDOWN_SIGNAL = SIGUSR1; @@ -313,7 +319,7 @@ void LLApp::setupErrorHandling() // Add google breakpad exception handler configured for Darwin/Linux. bool installHandler = true; -#ifdef LL_DARWIN +#if LL_DARWIN // For the special case of Darwin, we do not want to install the handler if // the process is being debugged as the app will exit with value ABRT (6) if // we do. Unfortunately, the code below which performs that test relies on @@ -322,7 +328,7 @@ void LLApp::setupErrorHandling() // future releases of Darwin. This test is really only needed for developers // starting the app from a debugger anyway. #ifndef LL_RELEASE_FOR_DOWNLOAD - int mib[4]; + int mib[4]; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PID; @@ -346,14 +352,21 @@ void LLApp::setupErrorHandling() installHandler = true; } #endif -#endif + if(installHandler && (mExceptionHandler == 0)) { std::string dumpPath = "/tmp/"; mExceptionHandler = new google_breakpad::ExceptionHandler(dumpPath, 0, &unix_post_minidump_callback, 0, true, 0); } +#elif LL_LINUX + if(installHandler && (mExceptionHandler == 0)) + { + google_breakpad::MinidumpDescriptor desc("/tmp"); + new google_breakpad::ExceptionHandler(desc, 0, &unix_minidump_callback, 0, true, 0); + } #endif +#endif startErrorThread(); } @@ -410,6 +423,9 @@ void LLApp::setMiniDumpDir(const std::string &path) wchar_t buffer[MAX_MINDUMP_PATH_LENGTH]; mbstowcs(buffer, path.c_str(), MAX_MINDUMP_PATH_LENGTH); mExceptionHandler->set_dump_path(std::wstring(buffer)); +#elif LL_LINUX + google_breakpad::MinidumpDescriptor desc(path); + mExceptionHandler->set_minidump_descriptor(desc); #else mExceptionHandler->set_dump_path(path); #endif @@ -857,6 +873,43 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) } } +#if LL_LINUX +bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, void* context, bool succeeded) +{ + // Copy minidump file path into fixed buffer in the app instance to avoid + // heap allocations in a crash handler. + + // path format: /.dmp + int dirPathLength = strlen(minidump_desc.path()); + + // The path must not be truncated. + llassert((dirPathLength + 5) <= LLApp::MAX_MINDUMP_PATH_LENGTH); + + char * path = LLApp::instance()->getMiniDumpFilename(); + S32 remaining = LLApp::MAX_MINDUMP_PATH_LENGTH; + strncpy(path, minidump_desc.path(), remaining); + remaining -= dirPathLength; + path += dirPathLength; + if (remaining > 0 && dirPathLength > 0 && path[-1] != '/') + { + *path++ = '/'; + --remaining; + } + + llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + LLApp::runErrorHandler(); + +#ifndef LL_RELEASE_FOR_DOWNLOAD + clear_signals(); + return false; +#else + return true; +#endif + +} +#endif + + bool unix_post_minidump_callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded) diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index a536a06ea5..afa06df23e 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -38,7 +38,7 @@ typedef LLAtomic32 LLAtomicU32; class LLErrorThread; class LLLiveFile; #if LL_LINUX -typedef struct siginfo siginfo_t; +#include #endif typedef void (*LLAppErrorHandler)(); -- cgit v1.2.3 From 2d713a2815d1c8dc86e62eb29fbd9aacbcefa186 Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham Linden)" Date: Fri, 29 Mar 2013 13:22:29 -0700 Subject: Google Breakpad Fix. Code reviewed by DaveP --- indra/llcommon/llapp.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 67e6705cbf..e6f2325653 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -910,6 +910,43 @@ bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_ #endif +#if LL_LINUX +bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, void* context, bool succeeded) +{ + // Copy minidump file path into fixed buffer in the app instance to avoid + // heap allocations in a crash handler. + + // path format: /.dmp + int dirPathLength = strlen(minidump_desc.path()); + + // The path must not be truncated. + llassert((dirPathLength + 5) <= LLApp::MAX_MINDUMP_PATH_LENGTH); + + char * path = LLApp::instance()->getMiniDumpFilename(); + S32 remaining = LLApp::MAX_MINDUMP_PATH_LENGTH; + strncpy(path, minidump_desc.path(), remaining); + remaining -= dirPathLength; + path += dirPathLength; + if (remaining > 0 && dirPathLength > 0 && path[-1] != '/') + { + *path++ = '/'; + --remaining; + } + + llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + LLApp::runErrorHandler(); + +#ifndef LL_RELEASE_FOR_DOWNLOAD + clear_signals(); + return false; +#else + return true; +#endif + +} +#endif + + bool unix_post_minidump_callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded) -- cgit v1.2.3 From c7da38eb68249e8178fab645041a450c63a18b28 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 30 Mar 2013 17:08:52 -0500 Subject: Fix for linux build? --- indra/llcommon/llapp.cpp | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index e6f2325653..67e6705cbf 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -910,43 +910,6 @@ bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_ #endif -#if LL_LINUX -bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, void* context, bool succeeded) -{ - // Copy minidump file path into fixed buffer in the app instance to avoid - // heap allocations in a crash handler. - - // path format: /.dmp - int dirPathLength = strlen(minidump_desc.path()); - - // The path must not be truncated. - llassert((dirPathLength + 5) <= LLApp::MAX_MINDUMP_PATH_LENGTH); - - char * path = LLApp::instance()->getMiniDumpFilename(); - S32 remaining = LLApp::MAX_MINDUMP_PATH_LENGTH; - strncpy(path, minidump_desc.path(), remaining); - remaining -= dirPathLength; - path += dirPathLength; - if (remaining > 0 && dirPathLength > 0 && path[-1] != '/') - { - *path++ = '/'; - --remaining; - } - - llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; - LLApp::runErrorHandler(); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - clear_signals(); - return false; -#else - return true; -#endif - -} -#endif - - bool unix_post_minidump_callback(const char *dump_dir, const char *minidump_id, void *context, bool succeeded) -- cgit v1.2.3 From 8fe17529c672602845cf06cc15d4e776f0b6114a Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 9 Apr 2013 15:57:23 -0400 Subject: fix? race condition that occasionally fails in unit test --- indra/llcommon/tests/llprocess_test.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 6f1e7d46b8..f188865eb0 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -969,10 +969,7 @@ namespace tut childout.getline(), "ok"); // important to get the implicit flush from std::endl py.mPy->getWritePipe().get_ostream() << "go" << std::endl; - for (i = 0; i < timeout && py.mPy->isRunning() && ! childout.contains("\n"); ++i) - { - yield(); - } + waitfor(*py.mPy); ensure("script never replied", childout.contains("\n")); ensure_equals("child didn't ack", childout.getline(), "ack"); ensure_equals("bad child termination", py.mPy->getStatus().mState, LLProcess::EXITED); -- cgit v1.2.3 From 806d09b1143894ad66cea2c228f467e8c39a8adf Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 30 Apr 2013 19:50:05 -0700 Subject: Merge 3.5.1 into Materials --- indra/llcommon/imageids.cpp | 3 + indra/llcommon/imageids.h | 1 + indra/llcommon/llavatarname.cpp | 15 + indra/llcommon/llavatarname.h | 5 + indra/llcommon/lldictionary.h | 2 + indra/llcommon/llfasttimer.cpp | 6 + indra/llcommon/llfasttimer.h | 2 + indra/llcommon/llfile.cpp | 712 +++++++++++++++++++++--- indra/llcommon/llfile.h | 419 ++++++++++---- indra/llcommon/llmetricperformancetester.cpp | 2 +- indra/llcommon/llsdserialize.cpp | 4 +- indra/llcommon/llsdserialize.h | 16 +- indra/llcommon/llsdserialize_xml.cpp | 14 +- indra/llcommon/llversionserver.h | 2 +- indra/llcommon/llversionviewer.h | 4 +- indra/llcommon/tests/bitpack_test.cpp | 16 +- indra/llcommon/tests/llinstancetracker_test.cpp | 3 +- 17 files changed, 1018 insertions(+), 208 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/imageids.cpp b/indra/llcommon/imageids.cpp index fe11465221..7d647e5c36 100644 --- a/indra/llcommon/imageids.cpp +++ b/indra/llcommon/imageids.cpp @@ -68,3 +68,6 @@ const LLUUID TERRAIN_MOUNTAIN_DETAIL ("303cd381-8560-7579-23f1-f0a880799740"); / const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER + +const LLUUID IMG_CHECKERBOARD_RGBA ("2585a0f3-4163-6dd1-0f34-ad48cb909e25"); // dataserver + diff --git a/indra/llcommon/imageids.h b/indra/llcommon/imageids.h index e0c2683fdc..18c8ecb074 100644 --- a/indra/llcommon/imageids.h +++ b/indra/llcommon/imageids.h @@ -66,4 +66,5 @@ LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL; LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL; +LL_COMMON_API extern const LLUUID IMG_CHECKERBOARD_RGBA; #endif diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 95ecce509b..642bd82e90 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -178,6 +178,21 @@ std::string LLAvatarName::getCompleteName() const return name; } +std::string LLAvatarName::getLegacyName() const +{ + if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled? + { + return mDisplayName; + } + + std::string name; + name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() ); + name = mLegacyFirstName; + name += " "; + name += mLegacyLastName; + return name; +} + std::string LLAvatarName::getDisplayName() const { if (sUseDisplayNames) diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 4827353018..5d2fccc5ba 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -64,6 +64,11 @@ public: // When display names are disabled returns just "James Linden" std::string getCompleteName() const; + // Returns "James Linden" or "bobsmith123 Resident" for backwards + // compatibility with systems like voice and muting + // *TODO: Eliminate this in favor of username only + std::string getLegacyName() const; + // "José Sanchez" or "James Linden", UTF-8 encoded Unicode // Takes the display name preference into account. This is truly the name that should // be used for all UI where an avatar name has to be used unless we truly want something else (rare) diff --git a/indra/llcommon/lldictionary.h b/indra/llcommon/lldictionary.h index bc3bc3e74a..c752859a36 100644 --- a/indra/llcommon/lldictionary.h +++ b/indra/llcommon/lldictionary.h @@ -30,6 +30,8 @@ #include #include +#include "llerror.h" + struct LL_COMMON_API LLDictionaryEntry { LLDictionaryEntry(const std::string &name); diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 6970c29092..024fdd1b4d 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -561,6 +561,12 @@ std::vector& LLFastTimer::NamedTimer::getChildren() return mChildren; } +//static +LLFastTimer::NamedTimer& LLFastTimer::NamedTimer::getRootNamedTimer() +{ + return *NamedTimerFactory::instance().getRootTimer(); +} + //static void LLFastTimer::nextFrame() { diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index e42e549df5..81c4b78775 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -91,6 +91,8 @@ public: U32 getHistoricalCount(S32 history_index = 0) const; U32 getHistoricalCalls(S32 history_index = 0) const; + static NamedTimer& getRootNamedTimer(); + void setFrameState(FrameState* state) { mFrameState = state; state->setNamedTimer(this); } FrameState& getFrameState() const; diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index c51d042a3d..c3a0f0bfe0 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -56,6 +56,8 @@ std::string strerr(int errn) return buffer; } +typedef std::basic_ios > _Myios; + #else // On Posix we want to call strerror_r(), but alarmingly, there are two // different variants. The one that returns int always populates the passed @@ -324,9 +326,10 @@ const char *LLFile::tmpdir() /***************** Modified file stream created to overcome the incorrect behaviour of posix fopen in windows *******************/ -#if USE_LLFILESTREAMS +#if LL_WINDOWS -LLFILE * LLFile::_Fiopen(const std::string& filename, std::ios::openmode mode,int) // protection currently unused +LLFILE * LLFile::_Fiopen(const std::string& filename, + std::ios::openmode mode) { // open a file static const char *mods[] = { // fopen mode strings corresponding to valid[i] @@ -385,117 +388,690 @@ LLFILE * LLFile::_Fiopen(const std::string& filename, std::ios::openmode mode,in return (0); } -/************** input file stream ********************************/ +#endif /* LL_WINDOWS */ -void llifstream::close() -{ // close the C stream - if (_Filebuffer && _Filebuffer->close() == 0) +/************** llstdio file buffer ********************************/ + + +//llstdio_filebuf* llstdio_filebuf::open(const char *_Filename, +// ios_base::openmode _Mode) +//{ +//#if LL_WINDOWS +// _Filet *_File; +// if (is_open() || (_File = LLFILE::_Fiopen(_Filename, _Mode)) == 0) +// return (0); // open failed +// +// _Init(_File, _Openfl); +// _Initcvt(&_USE(_Mysb::getloc(), _Cvt)); +// return (this); // open succeeded +//#else +// std::filebuf* _file = std::filebuf::open(_Filename, _Mode); +// if (NULL == _file) return NULL; +// return this; +//#endif +//} + + +// *TODO: Seek the underlying c stream for better cross-platform compatibility? +#if !LL_WINDOWS +llstdio_filebuf::int_type llstdio_filebuf::overflow(llstdio_filebuf::int_type __c) +{ + int_type __ret = traits_type::eof(); + const bool __testeof = traits_type::eq_int_type(__c, __ret); + const bool __testout = _M_mode & ios_base::out; + if (__testout && !_M_reading) { - _Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/ + if (this->pbase() < this->pptr()) + { + // If appropriate, append the overflow char. + if (!__testeof) + { + *this->pptr() = traits_type::to_char_type(__c); + this->pbump(1); + } + + // Convert pending sequence to external representation, + // and output. + if (_convert_to_external(this->pbase(), + this->pptr() - this->pbase())) + { + _M_set_buffer(0); + __ret = traits_type::not_eof(__c); + } + } + else if (_M_buf_size > 1) + { + // Overflow in 'uncommitted' mode: set _M_writing, set + // the buffer to the initial 'write' mode, and put __c + // into the buffer. + _M_set_buffer(0); + _M_writing = true; + if (!__testeof) + { + *this->pptr() = traits_type::to_char_type(__c); + this->pbump(1); + } + __ret = traits_type::not_eof(__c); + } + else + { + // Unbuffered. + char_type __conv = traits_type::to_char_type(__c); + if (__testeof || _convert_to_external(&__conv, 1)) + { + _M_writing = true; + __ret = traits_type::not_eof(__c); + } + } } + return __ret; } -void llifstream::open(const std::string& _Filename, /* Flawfinder: ignore */ - ios_base::openmode _Mode, - int _Prot) -{ // open a C stream with specified mode +bool llstdio_filebuf::_convert_to_external(char_type* __ibuf, + std::streamsize __ilen) +{ + // Sizes of external and pending output. + streamsize __elen; + streamsize __plen; + if (__check_facet(_M_codecvt).always_noconv()) + { + //__elen = _M_file.xsputn(reinterpret_cast(__ibuf), __ilen); + __elen = fwrite(reinterpret_cast(__ibuf), 1, + __ilen, _M_file.file()); + __plen = __ilen; + } + else + { + // Worst-case number of external bytes needed. + // XXX Not done encoding() == -1. + streamsize __blen = __ilen * _M_codecvt->max_length(); + char* __buf = static_cast(__builtin_alloca(__blen)); + + char* __bend; + const char_type* __iend; + codecvt_base::result __r; + __r = _M_codecvt->out(_M_state_cur, __ibuf, __ibuf + __ilen, + __iend, __buf, __buf + __blen, __bend); - LLFILE* filep = LLFile::_Fiopen(_Filename,_Mode | ios_base::in, _Prot); - if(filep == NULL) + if (__r == codecvt_base::ok || __r == codecvt_base::partial) + __blen = __bend - __buf; + else if (__r == codecvt_base::noconv) { - _Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/ - return; + // Same as the always_noconv case above. + __buf = reinterpret_cast(__ibuf); + __blen = __ilen; } - llassert(_Filebuffer == NULL); - _Filebuffer = new _Myfb(filep); - _ShouldClose = true; - _Myios::init(_Filebuffer); + else + __throw_ios_failure(__N("llstdio_filebuf::_convert_to_external " + "conversion error")); + + //__elen = _M_file.xsputn(__buf, __blen); + __elen = fwrite(__buf, 1, __blen, _M_file.file()); + __plen = __blen; + + // Try once more for partial conversions. + if (__r == codecvt_base::partial && __elen == __plen) + { + const char_type* __iresume = __iend; + streamsize __rlen = this->pptr() - __iend; + __r = _M_codecvt->out(_M_state_cur, __iresume, + __iresume + __rlen, __iend, __buf, + __buf + __blen, __bend); + if (__r != codecvt_base::error) + { + __rlen = __bend - __buf; + //__elen = _M_file.xsputn(__buf, __rlen); + __elen = fwrite(__buf, 1, __rlen, _M_file.file()); + __plen = __rlen; + } + else + { + __throw_ios_failure(__N("llstdio_filebuf::_convert_to_external " + "conversion error")); + } + } + } + return __elen == __plen; } -bool llifstream::is_open() const -{ // test if C stream has been opened - if(_Filebuffer) - return (_Filebuffer->is_open()); - return false; +llstdio_filebuf::int_type llstdio_filebuf::underflow() +{ + int_type __ret = traits_type::eof(); + const bool __testin = _M_mode & ios_base::in; + if (__testin) + { + if (_M_writing) + { + if (overflow() == traits_type::eof()) + return __ret; + //_M_set_buffer(-1); + //_M_writing = false; + } + // Check for pback madness, and if so switch back to the + // normal buffers and jet outta here before expensive + // fileops happen... + _M_destroy_pback(); + + if (this->gptr() < this->egptr()) + return traits_type::to_int_type(*this->gptr()); + + // Get and convert input sequence. + const size_t __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; + + // Will be set to true if ::fread() returns 0 indicating EOF. + bool __got_eof = false; + // Number of internal characters produced. + streamsize __ilen = 0; + codecvt_base::result __r = codecvt_base::ok; + if (__check_facet(_M_codecvt).always_noconv()) + { + //__ilen = _M_file.xsgetn(reinterpret_cast(this->eback()), + // __buflen); + __ilen = fread(reinterpret_cast(this->eback()), 1, + __buflen, _M_file.file()); + if (__ilen == 0) + __got_eof = true; + } + else + { + // Worst-case number of external bytes. + // XXX Not done encoding() == -1. + const int __enc = _M_codecvt->encoding(); + streamsize __blen; // Minimum buffer size. + streamsize __rlen; // Number of chars to read. + if (__enc > 0) + __blen = __rlen = __buflen * __enc; + else + { + __blen = __buflen + _M_codecvt->max_length() - 1; + __rlen = __buflen; + } + const streamsize __remainder = _M_ext_end - _M_ext_next; + __rlen = __rlen > __remainder ? __rlen - __remainder : 0; + + // An imbue in 'read' mode implies first converting the external + // chars already present. + if (_M_reading && this->egptr() == this->eback() && __remainder) + __rlen = 0; + + // Allocate buffer if necessary and move unconverted + // bytes to front. + if (_M_ext_buf_size < __blen) + { + char* __buf = new char[__blen]; + if (__remainder) + __builtin_memcpy(__buf, _M_ext_next, __remainder); + + delete [] _M_ext_buf; + _M_ext_buf = __buf; + _M_ext_buf_size = __blen; + } + else if (__remainder) + __builtin_memmove(_M_ext_buf, _M_ext_next, __remainder); + + _M_ext_next = _M_ext_buf; + _M_ext_end = _M_ext_buf + __remainder; + _M_state_last = _M_state_cur; + + do + { + if (__rlen > 0) + { + // Sanity check! + // This may fail if the return value of + // codecvt::max_length() is bogus. + if (_M_ext_end - _M_ext_buf + __rlen > _M_ext_buf_size) + { + __throw_ios_failure(__N("llstdio_filebuf::underflow " + "codecvt::max_length() " + "is not valid")); + } + //streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen); + streamsize __elen = fread(_M_ext_end, 1, + __rlen, _M_file.file()); + if (__elen == 0) + __got_eof = true; + else if (__elen == -1) + break; + //_M_ext_end += __elen; + } + + char_type* __iend = this->eback(); + if (_M_ext_next < _M_ext_end) + { + __r = _M_codecvt->in(_M_state_cur, _M_ext_next, + _M_ext_end, _M_ext_next, + this->eback(), + this->eback() + __buflen, __iend); +} + if (__r == codecvt_base::noconv) +{ + size_t __avail = _M_ext_end - _M_ext_buf; + __ilen = std::min(__avail, __buflen); + traits_type::copy(this->eback(), + reinterpret_cast + (_M_ext_buf), __ilen); + _M_ext_next = _M_ext_buf + __ilen; + } + else + __ilen = __iend - this->eback(); + + // _M_codecvt->in may return error while __ilen > 0: this is + // ok, and actually occurs in case of mixed encodings (e.g., + // XML files). + if (__r == codecvt_base::error) + break; + + __rlen = 1; + } while (__ilen == 0 && !__got_eof); + } + + if (__ilen > 0) + { + _M_set_buffer(__ilen); + _M_reading = true; + __ret = traits_type::to_int_type(*this->gptr()); + } + else if (__got_eof) + { + // If the actual end of file is reached, set 'uncommitted' + // mode, thus allowing an immediate write without an + // intervening seek. + _M_set_buffer(-1); + _M_reading = false; + // However, reaching it while looping on partial means that + // the file has got an incomplete character. + if (__r == codecvt_base::partial) + __throw_ios_failure(__N("llstdio_filebuf::underflow " + "incomplete character in file")); + } + else if (__r == codecvt_base::error) + __throw_ios_failure(__N("llstdio_filebuf::underflow " + "invalid byte sequence in file")); + else + __throw_ios_failure(__N("llstdio_filebuf::underflow " + "error reading the file")); + } + return __ret; +} + +std::streamsize llstdio_filebuf::xsgetn(char_type* __s, std::streamsize __n) +{ + // Clear out pback buffer before going on to the real deal... + streamsize __ret = 0; + if (_M_pback_init) + { + if (__n > 0 && this->gptr() == this->eback()) + { + *__s++ = *this->gptr(); + this->gbump(1); + __ret = 1; + --__n; + } + _M_destroy_pback(); + } + + // Optimization in the always_noconv() case, to be generalized in the + // future: when __n > __buflen we read directly instead of using the + // buffer repeatedly. + const bool __testin = _M_mode & ios_base::in; + const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1; + + if (__n > __buflen && __check_facet(_M_codecvt).always_noconv() + && __testin && !_M_writing) + { + // First, copy the chars already present in the buffer. + const streamsize __avail = this->egptr() - this->gptr(); + if (__avail != 0) + { + if (__avail == 1) + *__s = *this->gptr(); + else + traits_type::copy(__s, this->gptr(), __avail); + __s += __avail; + this->gbump(__avail); + __ret += __avail; + __n -= __avail; + } + + // Need to loop in case of short reads (relatively common + // with pipes). + streamsize __len; + for (;;) + { + //__len = _M_file.xsgetn(reinterpret_cast(__s), __n); + __len = fread(reinterpret_cast(__s), 1, + __n, _M_file.file()); + if (__len == -1) + __throw_ios_failure(__N("llstdio_filebuf::xsgetn " + "error reading the file")); + if (__len == 0) + break; + + __n -= __len; + __ret += __len; + if (__n == 0) + break; + + __s += __len; + } + + if (__n == 0) + { + _M_set_buffer(0); + _M_reading = true; + } + else if (__len == 0) + { + // If end of file is reached, set 'uncommitted' + // mode, thus allowing an immediate write without + // an intervening seek. + _M_set_buffer(-1); + _M_reading = false; + } + } + else + __ret += __streambuf_type::xsgetn(__s, __n); + + return __ret; } -llifstream::~llifstream() + +std::streamsize llstdio_filebuf::xsputn(char_type* __s, std::streamsize __n) { - if (_ShouldClose) + // Optimization in the always_noconv() case, to be generalized in the + // future: when __n is sufficiently large we write directly instead of + // using the buffer. + streamsize __ret = 0; + const bool __testout = _M_mode & ios_base::out; + if (__check_facet(_M_codecvt).always_noconv() + && __testout && !_M_reading) + { + // Measurement would reveal the best choice. + const streamsize __chunk = 1ul << 10; + streamsize __bufavail = this->epptr() - this->pptr(); + + // Don't mistake 'uncommitted' mode buffered with unbuffered. + if (!_M_writing && _M_buf_size > 1) + __bufavail = _M_buf_size - 1; + + const streamsize __limit = std::min(__chunk, __bufavail); + if (__n >= __limit) + { + const streamsize __buffill = this->pptr() - this->pbase(); + const char* __buf = reinterpret_cast(this->pbase()); + //__ret = _M_file.xsputn_2(__buf, __buffill, + // reinterpret_cast(__s), __n); + if (__buffill) + { + __ret = fwrite(__buf, 1, __buffill, _M_file.file()); + } + if (__ret == __buffill) { - close(); + __ret += fwrite(reinterpret_cast(__s), 1, + __n, _M_file.file()); + } + if (__ret == __buffill + __n) + { + _M_set_buffer(0); + _M_writing = true; +} + if (__ret > __buffill) + __ret -= __buffill; + else + __ret = 0; + } + else + __ret = __streambuf_type::xsputn(__s, __n); } - delete _Filebuffer; + else + __ret = __streambuf_type::xsputn(__s, __n); + return __ret; +} + +int llstdio_filebuf::sync() +{ + return (_M_file.sync() == 0 ? 0 : -1); } +#endif + +/************** input file stream ********************************/ + +llifstream::llifstream() : _M_filebuf(), +#if LL_WINDOWS + std::istream(&_M_filebuf) {} +#else + std::istream() +{ + this->init(&_M_filebuf); +} +#endif + +// explicit llifstream::llifstream(const std::string& _Filename, - ios_base::openmode _Mode, - int _Prot) - : std::basic_istream< char , std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) + ios_base::openmode _Mode) : _M_filebuf(), +#if LL_WINDOWS + std::istream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} +#else + std::istream() +{ + this->init(&_M_filebuf); + this->open(_Filename.c_str(), _Mode | ios_base::in); +} +#endif -{ // construct with named file and specified mode - open(_Filename, _Mode | ios_base::in, _Prot); /* Flawfinder: ignore */ +// explicit +llifstream::llifstream(const char* _Filename, + ios_base::openmode _Mode) : _M_filebuf(), +#if LL_WINDOWS + std::istream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) + { + _Myios::setstate(ios_base::failbit); +} +} +#else + std::istream() +{ + this->init(&_M_filebuf); + this->open(_Filename, _Mode | ios_base::in); } +#endif -/************** output file stream ********************************/ +// explicit +llifstream::llifstream(_Filet *_File, + ios_base::openmode _Mode, size_t _Size) : + _M_filebuf(_File, _Mode, _Size), +#if LL_WINDOWS + std::istream(&_M_filebuf) {} +#else + std::istream() +{ + this->init(&_M_filebuf); +} +#endif -bool llofstream::is_open() const +#if !LL_WINDOWS +// explicit +llifstream::llifstream(int __fd, + ios_base::openmode _Mode, size_t _Size) : + _M_filebuf(__fd, _Mode, _Size), + std::istream() +{ + this->init(&_M_filebuf); +} +#endif + +bool llifstream::is_open() const { // test if C stream has been opened - if(_Filebuffer) - return (_Filebuffer->is_open()); - return false; + return _M_filebuf.is_open(); } -void llofstream::open(const std::string& _Filename, /* Flawfinder: ignore */ - ios_base::openmode _Mode, - int _Prot) +void llifstream::open(const char* _Filename, ios_base::openmode _Mode) { // open a C stream with specified mode - LLFILE* filep = LLFile::_Fiopen(_Filename,_Mode | ios_base::out, _Prot); - if(filep == NULL) +#if LL_WINDOWS + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::in) == 0) { - _Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/ - return; + _Myios::setstate(ios_base::failbit); } - llassert(_Filebuffer==NULL); - _Filebuffer = new _Myfb(filep); - _ShouldClose = true; - _Myios::init(_Filebuffer); + else + { + _Myios::clear(); + } +#else + if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0) + { + this->setstate(ios_base::failbit); + } + else + { + this->clear(); + } +#endif } -void llofstream::close() +void llifstream::close() { // close the C stream - if(is_open()) + if (_M_filebuf.close() == 0) { - if (_Filebuffer->close() == 0) - { - _Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/ +#if LL_WINDOWS + _Myios::setstate(ios_base::failbit); +#else + this->setstate(ios_base::failbit); +#endif } - delete _Filebuffer; - _Filebuffer = NULL; - _ShouldClose = false; } + + +/************** output file stream ********************************/ + + +llofstream::llofstream() : _M_filebuf(), +#if LL_WINDOWS + std::ostream(&_M_filebuf) {} +#else + std::ostream() +{ + this->init(&_M_filebuf); } +#endif +// explicit llofstream::llofstream(const std::string& _Filename, - std::ios_base::openmode _Mode, - int _Prot) - : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) -{ // construct with named file and specified mode - open(_Filename, _Mode , _Prot); /* Flawfinder: ignore */ + ios_base::openmode _Mode) : _M_filebuf(), +#if LL_WINDOWS + std::ostream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} +#else + std::ostream() +{ + this->init(&_M_filebuf); + this->open(_Filename.c_str(), _Mode | ios_base::out); +} +#endif + +// explicit +llofstream::llofstream(const char* _Filename, + ios_base::openmode _Mode) : _M_filebuf(), +#if LL_WINDOWS + std::ostream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} +#else + std::ostream() +{ + this->init(&_M_filebuf); + this->open(_Filename, _Mode | ios_base::out); +} +#endif + +// explicit +llofstream::llofstream(_Filet *_File, + ios_base::openmode _Mode, size_t _Size) : + _M_filebuf(_File, _Mode, _Size), +#if LL_WINDOWS + std::ostream(&_M_filebuf) {} +#else + std::ostream() +{ + this->init(&_M_filebuf); } +#endif -llofstream::~llofstream() +#if !LL_WINDOWS +// explicit +llofstream::llofstream(int __fd, + ios_base::openmode _Mode, size_t _Size) : + _M_filebuf(__fd, _Mode, _Size), + std::ostream() { - // destroy the object - if (_ShouldClose) + this->init(&_M_filebuf); +} +#endif + +bool llofstream::is_open() const +{ // test if C stream has been opened + return _M_filebuf.is_open(); +} + +void llofstream::open(const char* _Filename, ios_base::openmode _Mode) +{ // open a C stream with specified mode +#if LL_WINDOWS + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) +{ + _Myios::setstate(ios_base::failbit); + } + else { - close(); + _Myios::clear(); } - delete _Filebuffer; +#else + if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0) + { + this->setstate(ios_base::failbit); + } + else + { + this->clear(); + } +#endif } -#endif // #if USE_LLFILESTREAMS +void llofstream::close() +{ // close the C stream + if (_M_filebuf.close() == 0) + { +#if LL_WINDOWS + _Myios::setstate(ios_base::failbit); +#else + this->setstate(ios_base::failbit); +#endif + } +} /************** helper functions ********************************/ diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index dd7d36513a..1e4d966159 100644 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -38,13 +38,6 @@ typedef FILE LLFILE; #include - -#ifdef LL_WINDOWS -#define USE_LLFILESTREAMS 1 -#else -#define USE_LLFILESTREAMS 0 -#endif - #include #if LL_WINDOWS @@ -52,6 +45,8 @@ typedef FILE LLFILE; typedef struct _stat llstat; #else typedef struct stat llstat; +#include +#include #endif #ifndef S_ISREG @@ -83,142 +78,342 @@ public: static int stat(const std::string& filename,llstat* file_status); static bool isdir(const std::string& filename); static bool isfile(const std::string& filename); - static LLFILE * _Fiopen(const std::string& filename, std::ios::openmode mode,int); // protection currently unused + static LLFILE * _Fiopen(const std::string& filename, + std::ios::openmode mode); static const char * tmpdir(); }; +/** + * @brief Provides a layer of compatibility for C/POSIX. + * + * This is taken from both the GNU __gnu_cxx::stdio_filebuf extension and + * VC's basic_filebuf implementation. + * This file buffer provides extensions for working with standard C FILE*'s + * and POSIX file descriptors for platforms that support this. +*/ +namespace +{ +#if LL_WINDOWS +typedef std::filebuf _Myfb; +#else +typedef __gnu_cxx::stdio_filebuf< char > _Myfb; +typedef std::__c_file _Filet; +#endif /* LL_WINDOWS */ +} -#if USE_LLFILESTREAMS - -class LL_COMMON_API llifstream : public std::basic_istream < char , std::char_traits < char > > +class LL_COMMON_API llstdio_filebuf : public _Myfb { - // input stream associated with a C stream public: - typedef std::basic_ifstream > _Myt; - typedef std::basic_filebuf > _Myfb; - typedef std::basic_ios > _Myios; - - llifstream() - : std::basic_istream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) - { // construct unopened - } + /** + * deferred initialization / destruction + */ + llstdio_filebuf() : _Myfb() {} + virtual ~llstdio_filebuf() {} + + /** + * @param f An open @c FILE*. + * @param mode Same meaning as in a standard filebuf. + * @param size Optimal or preferred size of internal buffer, in chars. + * Defaults to system's @c BUFSIZ. + * + * This constructor associates a file stream buffer with an open + * C @c FILE*. The @c FILE* will not be automatically closed when the + * stdio_filebuf is closed/destroyed. + */ + llstdio_filebuf(_Filet* __f, std::ios_base::openmode __mode, + //size_t __size = static_cast(BUFSIZ)) : + size_t __size = static_cast(1)) : +#if LL_WINDOWS + _Myfb(__f) {} +#else + _Myfb(__f, __mode, __size) {} +#endif - explicit llifstream(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in, - int _Prot = (int)ios_base::_Openprot); - - explicit llifstream(_Filet *_File) - : std::basic_istream >(NULL,true), - _Filebuffer(new _Myfb(_File)), - _ShouldClose(false) - { // construct with specified C stream - } - virtual ~llifstream(); - - _Myfb *rdbuf() const - { // return pointer to file buffer - return _Filebuffer; - } - bool is_open() const; - void open(const std::string& _Filename, /* Flawfinder: ignore */ - ios_base::openmode _Mode = ios_base::in, - int _Prot = (int)ios_base::_Openprot); - void close(); + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * @return @c this on success, NULL on failure + * + * If a file is already open, this function immediately fails. + * Otherwise it tries to open the file named @a s using the flags + * given in @a mode. + */ + //llstdio_filebuf* open(const char *_Filename, + // std::ios_base::openmode _Mode); + + /** + * @param fd An open file descriptor. + * @param mode Same meaning as in a standard filebuf. + * @param size Optimal or preferred size of internal buffer, in chars. + * + * This constructor associates a file stream buffer with an open + * POSIX file descriptor. The file descriptor will be automatically + * closed when the stdio_filebuf is closed/destroyed. + */ +#if !LL_WINDOWS + llstdio_filebuf(int __fd, std::ios_base::openmode __mode, + //size_t __size = static_cast(BUFSIZ)) : + size_t __size = static_cast(1)) : + _Myfb(__fd, __mode, __size) {} +#endif -private: - _Myfb* _Filebuffer; // the file buffer - bool _ShouldClose; +// *TODO: Seek the underlying c stream for better cross-platform compatibility? +#if !LL_WINDOWS +protected: + /** underflow() and uflow() functions are called to get the next + * character from the real input source when the buffer is empty. + * Buffered input uses underflow() + */ + /*virtual*/ int_type underflow(); + + /* Convert internal byte sequence to external, char-based + * sequence via codecvt. + */ + bool _convert_to_external(char_type*, std::streamsize); + + /** The overflow() function is called to transfer characters to the + * real output destination when the buffer is full. A call to + * overflow(c) outputs the contents of the buffer plus the + * character c. + * Consume some sequence of the characters in the pending sequence. + */ + /*virtual*/ int_type overflow(int_type __c = traits_type::eof()); + + /** sync() flushes the underlying @c FILE* stream. + */ + /*virtual*/ int sync(); + + std::streamsize xsgetn(char_type*, std::streamsize); + std::streamsize xsputn(char_type*, std::streamsize); +#endif }; -class LL_COMMON_API llofstream : public std::basic_ostream< char , std::char_traits < char > > +/** + * @brief Controlling input for files. + * + * This class supports reading from named files, using the inherited + * functions from std::basic_istream. To control the associated + * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) + * which allows construction using a pre-exisintg file stream buffer. + * We refer to this std::basic_filebuf (or derivative) as @c sb. +*/ +class LL_COMMON_API llifstream : public std::istream { + // input stream associated with a C stream public: - typedef std::basic_ostream< char , std::char_traits < char > > _Myt; - typedef std::basic_filebuf< char , std::char_traits < char > > _Myfb; - typedef std::basic_ios > _Myios; - - llofstream() - : std::basic_ostream >(NULL,true),_Filebuffer(NULL),_ShouldClose(false) - { // construct unopened - } - - explicit llofstream(const std::string& _Filename, - std::ios_base::openmode _Mode = ios_base::out, - int _Prot = (int)std::ios_base::_Openprot); + // Constructors: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + llifstream(); + + /** + * @brief Create an input file stream. + * @param Filename String specifying the filename. + * @param Mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::in is automatically included in @a mode. + */ + explicit llifstream(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::in); + explicit llifstream(const char* _Filename, + ios_base::openmode _Mode = ios_base::in); + /** + * @brief Create a stream using an open c file stream. + * @param File An open @c FILE*. + @param Mode Same meaning as in a standard filebuf. + @param Size Optimal or preferred size of internal buffer, in chars. + Defaults to system's @c BUFSIZ. + */ + explicit llifstream(_Filet *_File, + ios_base::openmode _Mode = ios_base::in, + //size_t _Size = static_cast(BUFSIZ)); + size_t _Size = static_cast(1)); + + /** + * @brief Create a stream using an open file descriptor. + * @param fd An open file descriptor. + @param Mode Same meaning as in a standard filebuf. + @param Size Optimal or preferred size of internal buffer, in chars. + Defaults to system's @c BUFSIZ. + */ +#if !LL_WINDOWS + explicit llifstream(int __fd, + ios_base::openmode _Mode = ios_base::in, + //size_t _Size = static_cast(BUFSIZ)); + size_t _Size = static_cast(1)); +#endif - explicit llofstream(_Filet *_File) - : std::basic_ostream >(NULL,true), - _Filebuffer(new _Myfb(_File)),//_File) - _ShouldClose(false) - { // construct with specified C stream - } - - virtual ~llofstream(); - - _Myfb *rdbuf() const - { // return pointer to file buffer - return _Filebuffer; - } - + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + virtual ~llifstream() {} + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_filebuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + llstdio_filebuf* rdbuf() const + { return const_cast(&_M_filebuf); } + + /** + * @brief Wrapper to test for an open file. + * @return @c rdbuf()->is_open() + */ bool is_open() const; - void open(const std::string& _Filename,ios_base::openmode _Mode = ios_base::out,int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */ - + /** + * @brief Opens an external file. + * @param Filename The name of the file. + * @param Node The open mode flags. + * + * Calls @c llstdio_filebuf::open(s,mode|in). If that function + * fails, @c failbit is set in the stream's error state. + */ + void open(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::in) + { open(_Filename.c_str(), _Mode); } + void open(const char* _Filename, + ios_base::openmode _Mode = ios_base::in); + + /** + * @brief Close the file. + * + * Calls @c llstdio_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ void close(); private: - _Myfb *_Filebuffer; // the file buffer - bool _ShouldClose; -}; - - - -#else -//Use standard file streams on non windows platforms -//#define llifstream std::ifstream -//#define llofstream std::ofstream - -class LL_COMMON_API llifstream : public std::ifstream -{ -public: - llifstream() : std::ifstream() - { - } - - explicit llifstream(const std::string& _Filename, std::_Ios_Openmode _Mode = in) - : std::ifstream(_Filename.c_str(), _Mode) - { - } - void open(const std::string& _Filename, std::_Ios_Openmode _Mode = in) /* Flawfinder: ignore */ - { - std::ifstream::open(_Filename.c_str(), _Mode); - } + llstdio_filebuf _M_filebuf; }; -class LL_COMMON_API llofstream : public std::ofstream +/** + * @brief Controlling output for files. + * + * This class supports writing to named files, using the inherited + * functions from std::basic_ostream. To control the associated + * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) + * which allows construction using a pre-exisintg file stream buffer. + * We refer to this std::basic_filebuf (or derivative) as @c sb. +*/ +class LL_COMMON_API llofstream : public std::ostream { public: - llofstream() : std::ofstream() - { - } + // Constructors: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + llofstream(); + + /** + * @brief Create an output file stream. + * @param Filename String specifying the filename. + * @param Mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::out|ios_base::trunc is automatically included in + * @a mode. + */ + explicit llofstream(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + explicit llofstream(const char* _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + + /** + * @brief Create a stream using an open c file stream. + * @param File An open @c FILE*. + @param Mode Same meaning as in a standard filebuf. + @param Size Optimal or preferred size of internal buffer, in chars. + Defaults to system's @c BUFSIZ. + */ + explicit llofstream(_Filet *_File, + ios_base::openmode _Mode = ios_base::out, + //size_t _Size = static_cast(BUFSIZ)); + size_t _Size = static_cast(1)); + + /** + * @brief Create a stream using an open file descriptor. + * @param fd An open file descriptor. + @param Mode Same meaning as in a standard filebuf. + @param Size Optimal or preferred size of internal buffer, in chars. + Defaults to system's @c BUFSIZ. + */ +#if !LL_WINDOWS + explicit llofstream(int __fd, + ios_base::openmode _Mode = ios_base::out, + //size_t _Size = static_cast(BUFSIZ)); + size_t _Size = static_cast(1)); +#endif - explicit llofstream(const std::string& _Filename, std::_Ios_Openmode _Mode = out) - : std::ofstream(_Filename.c_str(), _Mode) - { - } + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + virtual ~llofstream() {} + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_filebuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + llstdio_filebuf* rdbuf() const + { return const_cast(&_M_filebuf); } + + /** + * @brief Wrapper to test for an open file. + * @return @c rdbuf()->is_open() + */ + bool is_open() const; - void open(const std::string& _Filename, std::_Ios_Openmode _Mode = out) /* Flawfinder: ignore */ - { - std::ofstream::open(_Filename.c_str(), _Mode); - } + /** + * @brief Opens an external file. + * @param Filename The name of the file. + * @param Node The open mode flags. + * + * Calls @c llstdio_filebuf::open(s,mode|out). If that function + * fails, @c failbit is set in the stream's error state. + */ + void open(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc) + { open(_Filename.c_str(), _Mode); } + void open(const char* _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + + /** + * @brief Close the file. + * + * Calls @c llstdio_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ + void close(); +private: + llstdio_filebuf _M_filebuf; }; -#endif /** * @breif filesize helpers. diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 41d3eb0bf3..731e58bd20 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -100,7 +100,7 @@ LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& i LLSD ret; LLSD cur; - while (!is.eof() && LLSDSerialize::fromXML(cur, is)) + while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) { for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) { diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 6b549e4b6f..ad4fce6f35 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -1453,8 +1453,8 @@ S32 LLSDBinaryFormatter::format(const LLSD& data, std::ostream& ostr, U32 option case LLSD::TypeUUID: { ostr.put('u'); - LLSD::UUID value = data.asUUID(); - ostr.write((const char*)(&value.mData), UUID_BYTES); + LLUUID temp = data.asUUID(); + ostr.write((const char*)(&(temp.mData)), UUID_BYTES); break; } diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index 86e3fc864c..e7a5507385 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -300,7 +300,7 @@ public: /** * @brief Constructor */ - LLSDXMLParser(); + LLSDXMLParser(bool emit_errors=true); protected: /** @@ -747,25 +747,25 @@ public: return f->format(sd, str, LLSDFormatter::OPTIONS_PRETTY); } - static S32 fromXMLEmbedded(LLSD& sd, std::istream& str) + static S32 fromXMLEmbedded(LLSD& sd, std::istream& str, bool emit_errors=true) { // no need for max_bytes since xml formatting is not // subvertable by bad sizes. - LLPointer p = new LLSDXMLParser; + LLPointer p = new LLSDXMLParser(emit_errors); return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED); } // Line oriented parser, 30% faster than fromXML(), but can // only be used when you know you have the complete XML // document available in the stream. - static S32 fromXMLDocument(LLSD& sd, std::istream& str) + static S32 fromXMLDocument(LLSD& sd, std::istream& str, bool emit_errors=true) { - LLPointer p = new LLSDXMLParser(); + LLPointer p = new LLSDXMLParser(emit_errors); return p->parseLines(str, sd); } - static S32 fromXML(LLSD& sd, std::istream& str) + static S32 fromXML(LLSD& sd, std::istream& str, bool emit_errors=true) { - return fromXMLEmbedded(sd, str); -// return fromXMLDocument(sd, str); + return fromXMLEmbedded(sd, str, emit_errors); +// return fromXMLDocument(sd, str, emit_errors); } /* diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index 34b3dbb99a..614a2d5636 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -250,7 +250,7 @@ std::string LLSDXMLFormatter::escapeString(const std::string& in) class LLSDXMLParser::Impl { public: - Impl(); + Impl(bool emit_errors); ~Impl(); S32 parse(std::istream& input, LLSD& data); @@ -294,6 +294,7 @@ private: static const XML_Char* findAttribute(const XML_Char* name, const XML_Char** pairs); + bool mEmitErrors; XML_Parser mParser; @@ -315,7 +316,8 @@ private: }; -LLSDXMLParser::Impl::Impl() +LLSDXMLParser::Impl::Impl(bool emit_errors) + : mEmitErrors(emit_errors) { mParser = XML_ParserCreate(NULL); reset(); @@ -402,7 +404,10 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) { ((char*) buffer)[count ? count - 1 : 0] = '\0'; } + if (mEmitErrors) + { llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl; + } data = LLSD(); return LLSDParser::PARSE_FAILURE; } @@ -480,7 +485,10 @@ S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data) if (status == XML_STATUS_ERROR && !mGracefullStop) { + if (mEmitErrors) + { llinfos << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << llendl; + } return LLSDParser::PARSE_FAILURE; } @@ -897,7 +905,7 @@ LLSDXMLParser::Impl::Element LLSDXMLParser::Impl::readElement(const XML_Char* na /** * LLSDXMLParser */ -LLSDXMLParser::LLSDXMLParser() : impl(* new Impl) +LLSDXMLParser::LLSDXMLParser(bool emit_errors /* = true */) : impl(* new Impl(emit_errors)) { } diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h index b19ba3bf74..ef68a0eaf5 100644 --- a/indra/llcommon/llversionserver.h +++ b/indra/llcommon/llversionserver.h @@ -30,7 +30,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 1; const S32 LL_VERSION_PATCH = 0; -const S32 LL_VERSION_BUILD = 13828; +const S32 LL_VERSION_BUILD = 264760; const char * const LL_CHANNEL = "Second Life Server"; diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 0b0c74b3d3..0ea130e86b 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,8 +29,8 @@ const S32 LL_VERSION_MAJOR = 3; const S32 LL_VERSION_MINOR = 5; -const S32 LL_VERSION_PATCH = 1; -const S32 LL_VERSION_BUILD = 0; +const S32 LL_VERSION_PATCH = 2; +const S32 LL_VERSION_BUILD = 264760; const char * const LL_CHANNEL = "Second Life Developer"; diff --git a/indra/llcommon/tests/bitpack_test.cpp b/indra/llcommon/tests/bitpack_test.cpp index 4c3bc674af..afc0c18cd0 100644 --- a/indra/llcommon/tests/bitpack_test.cpp +++ b/indra/llcommon/tests/bitpack_test.cpp @@ -71,7 +71,6 @@ namespace tut U8 packbuffer[255]; U8 unpackbuffer[255]; int pack_bufsize = 0; - int unpack_bufsize = 0; LLBitPack bitpack(packbuffer, 255); @@ -81,21 +80,20 @@ namespace tut pack_bufsize = bitpack.flushBitPack(); LLBitPack bitunpack(packbuffer, pack_bufsize*8); - unpack_bufsize = bitunpack.bitUnpack(&unpackbuffer[0], 8); + bitunpack.bitUnpack(&unpackbuffer[0], 8); ensure("bitPack: individual unpack: 0", unpackbuffer[0] == (U8) str[0]); - unpack_bufsize = bitunpack.bitUnpack(&unpackbuffer[0], 8); + bitunpack.bitUnpack(&unpackbuffer[0], 8); ensure("bitPack: individual unpack: 1", unpackbuffer[0] == (U8) str[1]); - unpack_bufsize = bitunpack.bitUnpack(&unpackbuffer[0], 8); + bitunpack.bitUnpack(&unpackbuffer[0], 8); ensure("bitPack: individual unpack: 2", unpackbuffer[0] == (U8) str[2]); - unpack_bufsize = bitunpack.bitUnpack(&unpackbuffer[0], 8); + bitunpack.bitUnpack(&unpackbuffer[0], 8); ensure("bitPack: individual unpack: 3", unpackbuffer[0] == (U8) str[3]); - unpack_bufsize = bitunpack.bitUnpack(&unpackbuffer[0], 8); + bitunpack.bitUnpack(&unpackbuffer[0], 8); ensure("bitPack: individual unpack: 4", unpackbuffer[0] == (U8) str[4]); - unpack_bufsize = bitunpack.bitUnpack(&unpackbuffer[0], 8); + bitunpack.bitUnpack(&unpackbuffer[0], 8); ensure("bitPack: individual unpack: 5", unpackbuffer[0] == (U8) str[5]); - unpack_bufsize = bitunpack.bitUnpack(unpackbuffer, 8*4); // Life + bitunpack.bitUnpack(unpackbuffer, 8*4); // Life ensure_memory_matches("bitPack: 4 bytes unpack:", unpackbuffer, 4, str+6, 4); - ensure("keep compiler quiet", unpack_bufsize == unpack_bufsize); } // U32 packing diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp index 454695ff9f..e769c3e22c 100644 --- a/indra/llcommon/tests/llinstancetracker_test.cpp +++ b/indra/llcommon/tests/llinstancetracker_test.cpp @@ -267,7 +267,6 @@ namespace tut { existing.insert(&*uki); } - Unkeyed* puk = NULL; try { // We don't expect the assignment to take place because we expect @@ -280,7 +279,7 @@ namespace tut // realize we're testing the C++ implementation more than // Unkeyed's implementation, but this seems an important point to // nail down. - puk = new Unkeyed("throw"); + new Unkeyed("throw"); } catch (const Badness&) { -- cgit v1.2.3 From 186b60457808d5fb280531bc96aba8fc8b67ef12 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 9 May 2013 10:22:10 -0400 Subject: remove duplications and other errors introduced during the merge --- indra/llcommon/llavatarname.h | 5 ----- indra/llcommon/llfasttimer.cpp | 6 ------ 2 files changed, 11 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 87e7d95f32..7542a8dece 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -69,11 +69,6 @@ public: // *TODO: Eliminate this in favor of username only std::string getLegacyName() const; - // Returns "James Linden" or "bobsmith123 Resident" for backwards - // compatibility with systems like voice and muting - // *TODO: Eliminate this in favor of username only - std::string getLegacyName() const; - // "José Sanchez" or "James Linden", UTF-8 encoded Unicode // Takes the display name preference into account. This is truly the name that should // be used for all UI where an avatar name has to be used unless we truly want something else (rare) diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index ec94691cae..9b15804e97 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -567,12 +567,6 @@ LLFastTimer::NamedTimer& LLFastTimer::NamedTimer::getRootNamedTimer() return *NamedTimerFactory::instance().getRootTimer(); } -//static -LLFastTimer::NamedTimer& LLFastTimer::NamedTimer::getRootNamedTimer() -{ - return *NamedTimerFactory::instance().getRootTimer(); -} - //static void LLFastTimer::nextFrame() { -- cgit v1.2.3 From 892f3cdd2c4d1b6aa9ec86547022d9f8194d6b80 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 22 May 2013 06:26:54 -0400 Subject: CHUI-967: fix display of % escapes in chat --- indra/llcommon/llstring.cpp | 17 +++++++++++++++++ indra/llcommon/llstring.h | 1 + indra/llcommon/lluri.cpp | 29 ++++++++++++++++++++++++----- 3 files changed, 42 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 0c32679744..22c8681983 100755 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -52,6 +52,23 @@ std::string ll_safe_string(const char* in, S32 maxlen) return std::string(); } +bool is_char_hex(char hex) +{ + if((hex >= '0') && (hex <= '9')) + { + return true; + } + else if((hex >= 'a') && (hex <='f')) + { + return true; + } + else if((hex >= 'A') && (hex <='F')) + { + return true; + } + return false; // uh - oh, not hex any more... +} + U8 hex_as_nybble(char hex) { if((hex >= '0') && (hex <= '9')) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 119efc7957..f9702868c8 100755 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -470,6 +470,7 @@ inline std::string chop_tail_copy( * @brief This translates a nybble stored as a hex value from 0-f back * to a nybble in the low order bits of the return byte. */ +LL_COMMON_API bool is_char_hex(char hex); LL_COMMON_API U8 hex_as_nybble(char hex); /** diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index 21456a599b..37f5b3d6a3 100755 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -129,11 +129,30 @@ std::string LLURI::unescape(const std::string& str) { ++it; if(it == end) break; - U8 c = hex_as_nybble(*it++); - c = c << 4; - if (it == end) break; - c |= hex_as_nybble(*it); - ostr.put((char)c); + + if(is_char_hex(*it)) + { + U8 c = hex_as_nybble(*it++); + + c = c << 4; + if (it == end) break; + + if(is_char_hex(*it)) + { + c |= hex_as_nybble(*it); + ostr.put((char)c); + } + else + { + ostr.put((char)c); + ostr.put(*it); + } + } + else + { + ostr.put('%'); + ostr.put(*it); + } } else { -- cgit v1.2.3 From 3be79d5371c291264b12ecb3bf8daf0761bf1123 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 23 May 2013 16:28:20 -0400 Subject: MAINT-2724: Make viewer explicitly set coroutine stack size. Introduce LLCoros::setStackSize(), with a compile-time default value we hope we never have to use. Make LLAppViewer call it with the value of the new settings variable CoroutineStackSize as soon as we've read settings files. (While we're at it, notify interested parties that we've read settings files.) Give CoroutineStackSize a default value four times the previous default stack size. Make LLCoros::launch() pass the saved stack size to each new coroutine instance. Re-enable lleventcoro integration test. Use LLSDMap() construct rather than LLSD::insert(), which used to return the modified object but is now void. --- indra/llcommon/CMakeLists.txt | 1 + indra/llcommon/llcoros.cpp | 13 ++++++++++- indra/llcommon/llcoros.h | 6 ++++- indra/llcommon/tests/lleventcoro_test.cpp | 37 ++++++++++++++++++++++--------- 4 files changed, 44 insertions(+), 13 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 95b1d536fe..3a4a8facc2 100755 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -337,6 +337,7 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(reflection "" "${test_libs}") LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}") + LL_ADD_INTEGRATION_TEST(lleventcoro "" "${test_libs};${BOOST_CONTEXT_LIBRARY}") LL_ADD_INTEGRATION_TEST(llprocess "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llleap "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llstreamqueue "" "${test_libs}") diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 9122704306..a629f71d4b 100755 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -39,7 +39,12 @@ #include "llerror.h" #include "stringize.h" -LLCoros::LLCoros() +LLCoros::LLCoros(): + // MAINT-2724: default coroutine stack size too small on Windows. + // Previously we used + // boost::context::guarded_stack_allocator::default_stacksize(); + // empirically this is 64KB on Windows and Linux. Try quadrupling. + mStackSize(256*1024) { // Register our cleanup() method for "mainloop" ticks LLEventPumps::instance().obtain("mainloop").listen( @@ -125,6 +130,12 @@ std::string LLCoros::getNameByID(const void* self_id) const return ""; } +void LLCoros::setStackSize(S32 stacksize) +{ + LL_INFOS("LLCoros") << "Setting coroutine stack size to " << stacksize << LL_ENDL; + mStackSize = stacksize; +} + /***************************************************************************** * MUST BE LAST *****************************************************************************/ diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index 03df406b68..01ee11da1a 100755 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -125,7 +125,7 @@ public: template std::string launch(const std::string& prefix, const CALLABLE& callable) { - return launchImpl(prefix, new coro(callable)); + return launchImpl(prefix, new coro(callable, mStackSize)); } /** @@ -152,6 +152,9 @@ public: /// getName() by self.get_id() std::string getNameByID(const void* self_id) const; + /// for delayed initialization + void setStackSize(S32 stacksize); + private: friend class LLSingleton; LLCoros(); @@ -159,6 +162,7 @@ private: std::string generateDistinctName(const std::string& prefix) const; bool cleanup(const LLSD&); + S32 mStackSize; typedef boost::ptr_map CoroMap; CoroMap mCoros; }; diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index 8d12529613..5ebde1a31d 100755 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -78,6 +78,7 @@ #include "../test/lltut.h" #include "llsd.h" +#include "llsdutil.h" #include "llevents.h" #include "tests/wrapllerrs.h" #include "stringize.h" @@ -108,7 +109,7 @@ match_substring(BidirectionalIterator begin, BidirectionalIterator end, std::string xmatch, BOOST_DEDUCED_TYPENAME coroutine::self& self) { - BidirectionalIterator begin_ = begin; +//BidirectionalIterator begin_ = begin; for(; begin != end; ++begin) if(match(begin, end, xmatch)) { self.yield(begin); @@ -213,7 +214,7 @@ namespace tut BEGIN { result = postAndWait(self, - LLSD().insert("value", 17), // request event + LLSDMap("value", 17), // request event immediateAPI.getPump(), // requestPump "reply1", // replyPump "reply"); // request["reply"] = name @@ -226,7 +227,7 @@ namespace tut BEGIN { LLEventWithID pair = ::postAndWait2(self, - LLSD().insert("value", 18), + LLSDMap("value", 18), immediateAPI.getPump(), "reply2", "error2", @@ -244,7 +245,7 @@ namespace tut BEGIN { LLEventWithID pair = ::postAndWait2(self, - LLSD().insert("value", 18).insert("fail", LLSD()), + LLSDMap("value", 18)("fail", LLSD()), immediateAPI.getPump(), "reply2", "error2", @@ -273,7 +274,7 @@ namespace tut BEGIN { LLCoroEventPump waiter; - result = waiter.postAndWait(self, LLSD().insert("value", 17), + result = waiter.postAndWait(self, LLSDMap("value", 17), immediateAPI.getPump(), "reply"); } END @@ -365,7 +366,7 @@ namespace tut BEGIN { LLCoroEventPumps waiter; - LLEventWithID pair(waiter.postAndWait(self, LLSD().insert("value", 23), + LLEventWithID pair(waiter.postAndWait(self, LLSDMap("value", 23), immediateAPI.getPump(), "reply", "error")); result = pair.first; which = pair.second; @@ -379,7 +380,7 @@ namespace tut { LLCoroEventPumps waiter; LLEventWithID pair( - waiter.postAndWait(self, LLSD().insert("value", 23).insert("fail", LLSD()), + waiter.postAndWait(self, LLSDMap("value", 23)("fail", LLSD()), immediateAPI.getPump(), "reply", "error")); result = pair.first; which = pair.second; @@ -392,7 +393,7 @@ namespace tut BEGIN { LLCoroEventPumps waiter; - result = waiter.postAndWaitWithException(self, LLSD().insert("value", 8), + result = waiter.postAndWaitWithException(self, LLSDMap("value", 8), immediateAPI.getPump(), "reply", "error"); } END @@ -406,7 +407,7 @@ namespace tut try { result = waiter.postAndWaitWithException(self, - LLSD().insert("value", 9).insert("fail", LLSD()), + LLSDMap("value", 9)("fail", LLSD()), immediateAPI.getPump(), "reply", "error"); debug("no exception"); } @@ -424,7 +425,7 @@ namespace tut BEGIN { LLCoroEventPumps waiter; - result = waiter.postAndWaitWithLog(self, LLSD().insert("value", 30), + result = waiter.postAndWaitWithLog(self, LLSDMap("value", 30), immediateAPI.getPump(), "reply", "error"); } END @@ -439,7 +440,7 @@ namespace tut try { result = waiter.postAndWaitWithLog(self, - LLSD().insert("value", 31).insert("fail", LLSD()), + LLSDMap("value", 31)("fail", LLSD()), immediateAPI.getPump(), "reply", "error"); debug("no exception"); } @@ -796,4 +797,18 @@ namespace tut ensure("no result", result.isUndefined()); ensure_contains("got error", threw, "32"); } +} + +/*==========================================================================*| +#include + +namespace tut +{ + template<> template<> + void object::test<23>() + { + set_test_name("stacksize"); + std::cout << "default_stacksize: " << boost::context::guarded_stack_allocator::default_stacksize() << '\n'; + } } // namespace tut +|*==========================================================================*/ -- cgit v1.2.3 From c19200eb000c958bd03645ed616bbd3a1db76735 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Thu, 30 May 2013 17:01:28 -0700 Subject: BUG-2707 add some logging to help narrow down what part of login instance handling is going awry --- indra/llcommon/llapp.cpp | 2 +- indra/llcommon/llerrorthread.cpp | 2 +- indra/llcommon/llsys.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index c6da205815..b66fc82250 100755 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -378,7 +378,7 @@ void LLApp::startErrorThread() // if(!mThreadErrorp) { - llinfos << "Starting error thread" << llendl; +// llinfos << "Starting error thread" << llendl; mThreadErrorp = new LLErrorThread(); mThreadErrorp->setUserData((void *) this); mThreadErrorp->start(); diff --git a/indra/llcommon/llerrorthread.cpp b/indra/llcommon/llerrorthread.cpp index 950fcd6e83..4a0c8ef342 100755 --- a/indra/llcommon/llerrorthread.cpp +++ b/indra/llcommon/llerrorthread.cpp @@ -106,7 +106,7 @@ void LLErrorThread::run() // This thread sits and waits for the sole purpose // of waiting for the signal/exception handlers to flag the // application state as APP_STATUS_ERROR. - llinfos << "thread_error - Waiting for an error" << llendl; + //llinfos << "thread_error - Waiting for an error" << llendl; S32 counter = 0; #if !LL_WINDOWS diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 57a6de9060..b8e8125e68 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1032,9 +1032,9 @@ LLMemoryInfo& LLMemoryInfo::refresh() { mStatsMap = loadStatsMap(); - LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; - LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); - LL_ENDL; +// LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; +// LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); +// LL_ENDL; return *this; } -- cgit v1.2.3 From d21fc254a795ddbb0604fd6a542327dbd92b036d Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 1 Jun 2013 13:43:52 -0700 Subject: BUG-2707 hunt for infos call crashing Kat --- indra/llcommon/llapp.cpp | 15 +++++++-------- indra/llcommon/llcoros.cpp | 7 +++++-- indra/llcommon/llevents.cpp | 8 ++++---- indra/llcommon/llmemory.cpp | 25 +++++++++++++------------ indra/llcommon/llmetrics.cpp | 6 ++++-- 5 files changed, 33 insertions(+), 28 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index b66fc82250..b6581c714c 100755 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -218,8 +218,7 @@ bool LLApp::parseCommandOptions(int argc, char** argv) { if(argv[ii][0] != '-') { - llinfos << "Did not find option identifier while parsing token: " - << argv[ii] << llendl; + lldebugs << "Did not find option identifier while parsing token: "<< argv[ii] << llendl; return false; } int offset = 1; @@ -896,7 +895,7 @@ bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_ --remaining; } - llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + //llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; LLApp::runErrorHandler(); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -942,7 +941,7 @@ bool unix_post_minidump_callback(const char *dump_dir, strncpy(path, ".dmp", remaining); } - llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + //llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; LLApp::runErrorHandler(); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -985,12 +984,12 @@ bool windows_post_minidump_callback(const wchar_t* dump_path, strncpy(path, ".dmp", remaining); } - llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; - // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. + //llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. //OSMessageBox("Attach Debugger Now", "Error", OSMB_OK); - // *TODO: Translate the signals/exceptions into cross-platform stuff + // *TODO: Translate the signals/exceptions into cross-platform stuff // Windows implementation - llinfos << "Entering Windows Exception Handler..." << llendl; + //llinfos << "Entering Windows Exception Handler..." << llendl; if (LLApp::isError()) { diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index a629f71d4b..bde8bcf36a 100755 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -60,7 +60,9 @@ bool LLCoros::cleanup(const LLSD&) // since last tick? if (mi->second->exited()) { - LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; + // BUG-2707? + //LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; + // The erase() call will invalidate its passed iterator value -- // so increment mi FIRST -- but pass its original value to // erase(). This is what postincrement is all about. @@ -94,7 +96,8 @@ std::string LLCoros::generateDistinctName(const std::string& prefix) const { if (mCoros.find(name) == mCoros.end()) { - LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL; + //BUG-2707? + //LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL; return name; } } diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 0855180dcd..4c4553168e 100755 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -570,20 +570,20 @@ void LLReqID::stamp(LLSD& response) const { if (! (response.isUndefined() || response.isMap())) { + // BUG-2707? // If 'response' was previously completely empty, it's okay to // turn it into a map. If it was already a map, then it should be // okay to add a key. But if it was anything else (e.g. a scalar), // assigning a ["reqid"] key will DISCARD the previous value, // replacing it with a map. That would be Bad. - LL_INFOS("LLReqID") << "stamp(" << mReqid << ") leaving non-map response unmodified: " - << response << LL_ENDL; + //LL_INFOS("LLReqID") << "stamp(" << mReqid << ") leaving non-map response unmodified: " << response << LL_ENDL; return; } LLSD oldReqid(response["reqid"]); if (! (oldReqid.isUndefined() || llsd_equals(oldReqid, mReqid))) { - LL_INFOS("LLReqID") << "stamp(" << mReqid << ") preserving existing [\"reqid\"] value " - << oldReqid << " in response: " << response << LL_ENDL; + // BUG-2707? + //LL_INFOS("LLReqID") << "stamp(" << mReqid << ") preserving existing [\"reqid\"] value "<< oldReqid << " in response: " << response << LL_ENDL; return; } response["reqid"] = mReqid; diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 70ad10ad55..33215401c6 100755 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -987,27 +987,27 @@ void LLPrivateMemoryPool::LLMemoryChunk::dump() } #endif #if 0 - llinfos << "---------------------------" << llendl ; - llinfos << "Chunk buffer: " << (U32)getBuffer() << " size: " << getBufferSize() << llendl ; + LL_DEBUGS(LLMemory) << "---------------------------" << llendl ; + LL_DEBUGS(LLMemory) << "Chunk buffer: " << (U32)getBuffer() << " size: " << getBufferSize() << llendl ; - llinfos << "available blocks ... " << llendl ; + LL_DEBUGS(LLMemory) << "available blocks ... " << llendl ; for(S32 i = 0 ; i < mBlockLevels ; i++) { LLMemoryBlock* blk = mAvailBlockList[i] ; while(blk) { - llinfos << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; + LL_DEBUGS(LLMemory) << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; blk = blk->mNext ; } } - llinfos << "free blocks ... " << llendl ; + LL_DEBUGS(LLMemory) << "free blocks ... " << llendl ; for(S32 i = 0 ; i < mPartitionLevels ; i++) { LLMemoryBlock* blk = mFreeSpaceList[i] ; while(blk) { - llinfos << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; + LL_DEBUGS(LLMemory) << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; blk = blk->mNext ; } } @@ -1731,7 +1731,8 @@ void LLPrivateMemoryPool::removeFromHashTable(LLMemoryChunk* chunk) void LLPrivateMemoryPool::rehash() { - llinfos << "new hash factor: " << mHashFactor << llendl ; + //BUG-2707? + //LL_DEBUGS(LLMemory) << "new hash factor: " << mHashFactor << llendl ; mChunkHashList.clear() ; mChunkHashList.resize(mHashFactor) ; @@ -1848,7 +1849,7 @@ LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager() S32 k = 0 ; for(mem_allocation_info_t::iterator iter = sMemAllocationTracker.begin() ; iter != sMemAllocationTracker.end() ; ++iter) { - llinfos << k++ << ", " << (U32)iter->first << " : " << iter->second << llendl ; + LL_DEBUGS(LLMemory) << k++ << ", " << (U32)iter->first << " : " << iter->second << llendl ; } sMemAllocationTracker.clear() ; } @@ -2190,8 +2191,8 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) { LLTimer timer ; - llinfos << " -**********************- " << llendl ; - llinfos << "test size: " << size << " test times: " << times << llendl ; + LL_DEBUGS(LLMemory) << " -**********************- " << llendl ; + LL_DEBUGS(LLMemory) << "test size: " << size << " test times: " << times << llendl ; timer.reset() ; char** p = new char*[times] ; @@ -2212,7 +2213,7 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) FREE_MEM(sPool, p[i]) ; p[i] = NULL ; } - llinfos << "time spent using customized memory pool: " << timer.getElapsedTimeF32() << llendl ; + LL_DEBUGS(LLMemory) << "time spent using customized memory pool: " << timer.getElapsedTimeF32() << llendl ; timer.reset() ; @@ -2232,7 +2233,7 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) ::delete[] p[i] ; p[i] = NULL ; } - llinfos << "time spent using standard allocator/de-allocator: " << timer.getElapsedTimeF32() << llendl ; + LL_DEBUGS(LLMemory) << "time spent using standard allocator/de-allocator: " << timer.getElapsedTimeF32() << llendl ; delete[] p; } diff --git a/indra/llcommon/llmetrics.cpp b/indra/llcommon/llmetrics.cpp index 3078139f43..ac643095b1 100755 --- a/indra/llcommon/llmetrics.cpp +++ b/indra/llcommon/llmetrics.cpp @@ -65,7 +65,8 @@ void LLMetricsImpl::recordEventDetails(const std::string& location, metrics["location"] = location; metrics["stats"] = stats; - llinfos << "LLMETRICS: " << (LLSDNotationStreamer(metrics)) << llendl; + // BUG-2707? + //llinfos << "LLMETRICS: " << (LLSDNotationStreamer(metrics)) << llendl; } // Store this: @@ -128,7 +129,8 @@ void LLMetricsImpl::printTotals(LLSD metadata) out_sd["stats"] = stats; - llinfos << "LLMETRICS: AGGREGATE: " << LLSDOStreamer(out_sd) << llendl; + // BUG-2707? + //llinfos << "LLMETRICS: AGGREGATE: " << LLSDOStreamer(out_sd) << llendl; } LLMetrics::LLMetrics() -- cgit v1.2.3 From cf3d2a06a13528cca1327becfb9e8dcb5ff4614a Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sat, 1 Jun 2013 19:36:38 -0700 Subject: BUG-2707 turn off more LL_DEBUGS to narrow down Kat's crashing cuplrit --- indra/llcommon/llavatarname.cpp | 10 +++++----- indra/llcommon/lleventcoro.h | 34 +++++++++++++++++----------------- indra/llcommon/llprocess.cpp | 23 +++++++++++------------ 3 files changed, 33 insertions(+), 34 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 642bd82e90..aaa7f1212f 100755 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -230,10 +230,10 @@ std::string LLAvatarName::getUserName() const void LLAvatarName::dump() const { - LL_DEBUGS("AvNameCache") << "LLAvatarName: " - << "user '" << mUsername << "' " - << "display '" << mDisplayName << "' " - << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds" - << LL_ENDL; + //LL_DEBUGS("AvNameCache") << "LLAvatarName: " + // << "user '" << mUsername << "' " + // << "display '" << mDisplayName << "' " + // << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds" + // << LL_ENDL; } diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index a42af63b65..f25c313920 100755 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -220,21 +220,21 @@ LLSD postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& req // request event. LLSD modevent(event); LLEventDetail::storeToLLSDPath(modevent, replyPumpNamePath, replyPump.getPump().getName()); - LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - << " posting to " << requestPump.getPump().getName() - << LL_ENDL; + //LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + // << " posting to " << requestPump.getPump().getName() + // << LL_ENDL; // *NOTE:Mani - Removed because modevent could contain user's hashed passwd. // << ": " << modevent << LL_ENDL; requestPump.getPump().post(modevent); } - LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - << " about to wait on LLEventPump " << replyPump.getPump().getName() - << LL_ENDL; + //LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + // << " about to wait on LLEventPump " << replyPump.getPump().getName() + // << LL_ENDL; // trying to dereference ("resolve") the future makes us wait for it LLSD value(*future); - LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - << " resuming with " << value << LL_ENDL; + //LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + // << " resuming with " << value << LL_ENDL; // returning should disconnect the connection return value; } @@ -351,19 +351,19 @@ LLEventWithID postAndWait2(SELF& self, const LLSD& event, replyPump0.getPump().getName()); LLEventDetail::storeToLLSDPath(modevent, replyPump1NamePath, replyPump1.getPump().getName()); - LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name - << " posting to " << requestPump.getPump().getName() - << ": " << modevent << LL_ENDL; + //LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name + // << " posting to " << requestPump.getPump().getName() + // << ": " << modevent << LL_ENDL; requestPump.getPump().post(modevent); } - LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name - << " about to wait on LLEventPumps " << replyPump0.getPump().getName() - << ", " << replyPump1.getPump().getName() << LL_ENDL; + //LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name + // << " about to wait on LLEventPumps " << replyPump0.getPump().getName() + // << ", " << replyPump1.getPump().getName() << LL_ENDL; // trying to dereference ("resolve") the future makes us wait for it LLEventWithID value(*future); - LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << name - << " resuming with (" << value.first << ", " << value.second << ")" - << LL_ENDL; + //LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << name + // << " resuming with (" << value.first << ", " << value.second << ")" + // << LL_ENDL; // returning should disconnect both connections return value; } diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 715df36f39..59298366a3 100755 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -81,7 +81,7 @@ public: // incrementing, listen on "mainloop". if (mCount++ == 0) { - LL_DEBUGS("LLProcess") << "listening on \"mainloop\"" << LL_ENDL; + //LL_DEBUGS("LLProcess") << "listening on \"mainloop\"" << LL_ENDL; mConnection = LLEventPumps::instance().obtain("mainloop") .listen("LLProcessListener", boost::bind(&LLProcessListener::tick, this, _1)); } @@ -93,7 +93,7 @@ public: // stop listening on "mainloop". if (--mCount == 0) { - LL_DEBUGS("LLProcess") << "disconnecting from \"mainloop\"" << LL_ENDL; + //LL_DEBUGS("LLProcess") << "disconnecting from \"mainloop\"" << LL_ENDL; mConnection.disconnect(); } } @@ -118,7 +118,7 @@ private: // centralize such calls, using "mainloop" to ensure it happens once // per frame, and refcounting running LLProcess objects to remain // registered only while needed. - LL_DEBUGS("LLProcess") << "calling apr_proc_other_child_refresh_all()" << LL_ENDL; + //LL_DEBUGS("LLProcess") << "calling apr_proc_other_child_refresh_all()" << LL_ENDL; apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); return false; } @@ -216,13 +216,13 @@ public: remainptr += written; remainlen -= written; - char msgbuf[512]; - LL_DEBUGS("LLProcess") << "wrote " << written << " of " << towrite - << " bytes to " << mDesc - << " (original " << total << ")," - << " code " << err << ": " - << apr_strerror(err, msgbuf, sizeof(msgbuf)) - << LL_ENDL; + //char msgbuf[512]; + //LL_DEBUGS("LLProcess") << "wrote " << written << " of " << towrite + // << " bytes to " << mDesc + // << " (original " << total << ")," + // << " code " << err << ": " + // << apr_strerror(err, msgbuf, sizeof(msgbuf)) + // << LL_ENDL; // The parent end of this pipe is nonblocking. If we weren't able // to write everything we wanted, don't keep banging on it -- that @@ -738,8 +738,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): { mPipes.replace(i, new ReadPipeImpl(desc, pipe, FILESLOT(i))); } - LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name() - << "('" << desc << "')" << LL_ENDL; + LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name() << "('" << desc << "')" << LL_ENDL; } } -- cgit v1.2.3 From a1888e72fa52a5f99a4bb8be86fcd9f36254135f Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sun, 2 Jun 2013 17:08:01 -0700 Subject: BUG-2707 eliminate debug message and memory dump from FrameWatcher, which appears to be going off on login for some --- indra/llcommon/llsys.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index b8e8125e68..10beb00113 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 BUG_2707_A_LOWER_KIND_OF_LOW LL_INFOS("FrameWatcher") << ' '; if (! prevSize) { @@ -1398,6 +1398,7 @@ public: } LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' << LLMemoryInfo() << LL_ENDL; +#endif return false; } -- cgit v1.2.3 From 1f9137ed5f8941d9411757fd70831facc3e5b43c Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sun, 2 Jun 2013 19:52:59 -0700 Subject: BUG-2707 fix unref'd var --- indra/llcommon/llsys.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 10beb00113..1f87c3ae06 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1398,6 +1398,8 @@ public: } LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' << LLMemoryInfo() << LL_ENDL; +#else + (void)prevSize; #endif return false; -- cgit v1.2.3 From 62d3a010d430fadf99268498bee3cff3e16c608f Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 3 Jun 2013 18:11:08 -0700 Subject: BUG-2707 disable sites calling OsOutputDebugString directly to identify which is tossing our errant exception --- indra/llcommon/llerror.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 9b0141eb76..2a037fcad9 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -201,10 +201,12 @@ namespace { virtual void recordMessage(LLError::ELevel level, const std::string& message) { +#if BUG_2707_HUNT llutf16string utf16str = wstring_to_utf16str(utf8str_to_wstring(message)); utf16str += '\n'; OutputDebugString(utf16str.c_str()); +#endif } }; #endif -- cgit v1.2.3 From ea246125619aca35ac6672d6be4b8aa08123666f Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 4 Jun 2013 07:51:27 -0700 Subject: BUG-2707 make use of OsOutputDebugString _DEBUG only on Windows to avoid throwing unhandlable exceptions in coroutines in RelWithDebInfo builds --- indra/llcommon/llcoros.cpp | 6 ++---- indra/llcommon/llerror.cpp | 7 +------ indra/llcommon/llerror.h | 6 ++++++ indra/llcommon/llevents.cpp | 6 ++---- indra/llcommon/llmemory.cpp | 3 +-- indra/llcommon/llmetrics.cpp | 6 ++---- indra/llcommon/llsys.cpp | 2 +- 7 files changed, 15 insertions(+), 21 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index bde8bcf36a..1ccb33b259 100755 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -60,8 +60,7 @@ bool LLCoros::cleanup(const LLSD&) // since last tick? if (mi->second->exited()) { - // BUG-2707? - //LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; + LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; // The erase() call will invalidate its passed iterator value -- // so increment mi FIRST -- but pass its original value to @@ -96,8 +95,7 @@ std::string LLCoros::generateDistinctName(const std::string& prefix) const { if (mCoros.find(name) == mCoros.end()) { - //BUG-2707? - //LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL; + LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL; return name; } } diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 2a037fcad9..5c8e6cca29 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -201,12 +201,7 @@ namespace { virtual void recordMessage(LLError::ELevel level, const std::string& message) { -#if BUG_2707_HUNT - llutf16string utf16str = - wstring_to_utf16str(utf8str_to_wstring(message)); - utf16str += '\n'; - OutputDebugString(utf16str.c_str()); -#endif + 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..a724c0720f 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -283,6 +283,12 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; #define LL_ENDL llendl #define LL_CONT (*_out) +#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/llevents.cpp b/indra/llcommon/llevents.cpp index 4c4553168e..49c8178b42 100755 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -570,20 +570,18 @@ void LLReqID::stamp(LLSD& response) const { if (! (response.isUndefined() || response.isMap())) { - // BUG-2707? // If 'response' was previously completely empty, it's okay to // turn it into a map. If it was already a map, then it should be // okay to add a key. But if it was anything else (e.g. a scalar), // assigning a ["reqid"] key will DISCARD the previous value, // replacing it with a map. That would be Bad. - //LL_INFOS("LLReqID") << "stamp(" << mReqid << ") leaving non-map response unmodified: " << response << LL_ENDL; + LL_INFOS("LLReqID") << "stamp(" << mReqid << ") leaving non-map response unmodified: " << response << LL_ENDL; return; } LLSD oldReqid(response["reqid"]); if (! (oldReqid.isUndefined() || llsd_equals(oldReqid, mReqid))) { - // BUG-2707? - //LL_INFOS("LLReqID") << "stamp(" << mReqid << ") preserving existing [\"reqid\"] value "<< oldReqid << " in response: " << response << LL_ENDL; + LL_INFOS("LLReqID") << "stamp(" << mReqid << ") preserving existing [\"reqid\"] value "<< oldReqid << " in response: " << response << LL_ENDL; return; } response["reqid"] = mReqid; diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 33215401c6..44ba84c160 100755 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -1731,8 +1731,7 @@ void LLPrivateMemoryPool::removeFromHashTable(LLMemoryChunk* chunk) void LLPrivateMemoryPool::rehash() { - //BUG-2707? - //LL_DEBUGS(LLMemory) << "new hash factor: " << mHashFactor << llendl ; + LL_DEBUGS("LLMemory") << "new hash factor: " << mHashFactor << llendl ; mChunkHashList.clear() ; mChunkHashList.resize(mHashFactor) ; diff --git a/indra/llcommon/llmetrics.cpp b/indra/llcommon/llmetrics.cpp index ac643095b1..3078139f43 100755 --- a/indra/llcommon/llmetrics.cpp +++ b/indra/llcommon/llmetrics.cpp @@ -65,8 +65,7 @@ void LLMetricsImpl::recordEventDetails(const std::string& location, metrics["location"] = location; metrics["stats"] = stats; - // BUG-2707? - //llinfos << "LLMETRICS: " << (LLSDNotationStreamer(metrics)) << llendl; + llinfos << "LLMETRICS: " << (LLSDNotationStreamer(metrics)) << llendl; } // Store this: @@ -129,8 +128,7 @@ void LLMetricsImpl::printTotals(LLSD metadata) out_sd["stats"] = stats; - // BUG-2707? - //llinfos << "LLMETRICS: AGGREGATE: " << LLSDOStreamer(out_sd) << llendl; + llinfos << "LLMETRICS: AGGREGATE: " << LLSDOStreamer(out_sd) << llendl; } LLMetrics::LLMetrics() diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 1f87c3ae06..5d3595a66f 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 BUG_2707_A_LOWER_KIND_OF_LOW +#if _DEBUG LL_INFOS("FrameWatcher") << ' '; if (! prevSize) { -- cgit v1.2.3 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 ++++- 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') 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; } -- 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 +---- 3 files changed, 30 insertions(+), 20 deletions(-) (limited to 'indra/llcommon') 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; } -- 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 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') 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 -- 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/llcommon') 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 50689a13baf07bcd68bfb77b111b066da972f076 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 5 Jun 2013 06:14:27 -0700 Subject: BOOG2707 uncomment cleared suspects --- indra/llcommon/llapp.cpp | 13 +++++++------ indra/llcommon/llavatarname.cpp | 10 +++++----- indra/llcommon/llcoros.cpp | 1 - indra/llcommon/llerror.h | 8 ++++++++ indra/llcommon/llerrorthread.cpp | 2 +- indra/llcommon/lleventcoro.h | 34 +++++++++++++++++----------------- indra/llcommon/llevents.cpp | 6 ++++-- indra/llcommon/llmemory.cpp | 24 ++++++++++++------------ indra/llcommon/llprocess.cpp | 23 ++++++++++++----------- indra/llcommon/llsys.cpp | 6 +++--- 10 files changed, 69 insertions(+), 58 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index b6581c714c..67a98d5fb8 100755 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -218,7 +218,8 @@ bool LLApp::parseCommandOptions(int argc, char** argv) { if(argv[ii][0] != '-') { - lldebugs << "Did not find option identifier while parsing token: "<< argv[ii] << llendl; + llinfos << "Did not find option identifier while parsing token: " + << argv[ii] << llendl; return false; } int offset = 1; @@ -377,7 +378,7 @@ void LLApp::startErrorThread() // if(!mThreadErrorp) { -// llinfos << "Starting error thread" << llendl; + llinfos << "Starting error thread" << llendl; mThreadErrorp = new LLErrorThread(); mThreadErrorp->setUserData((void *) this); mThreadErrorp->start(); @@ -895,7 +896,7 @@ bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_ --remaining; } - //llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; LLApp::runErrorHandler(); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -941,7 +942,7 @@ bool unix_post_minidump_callback(const char *dump_dir, strncpy(path, ".dmp", remaining); } - //llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; LLApp::runErrorHandler(); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -984,12 +985,12 @@ bool windows_post_minidump_callback(const wchar_t* dump_path, strncpy(path, ".dmp", remaining); } - //llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. //OSMessageBox("Attach Debugger Now", "Error", OSMB_OK); // *TODO: Translate the signals/exceptions into cross-platform stuff // Windows implementation - //llinfos << "Entering Windows Exception Handler..." << llendl; + llinfos << "Entering Windows Exception Handler..." << llendl; if (LLApp::isError()) { diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index aaa7f1212f..642bd82e90 100755 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -230,10 +230,10 @@ std::string LLAvatarName::getUserName() const void LLAvatarName::dump() const { - //LL_DEBUGS("AvNameCache") << "LLAvatarName: " - // << "user '" << mUsername << "' " - // << "display '" << mDisplayName << "' " - // << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds" - // << LL_ENDL; + LL_DEBUGS("AvNameCache") << "LLAvatarName: " + << "user '" << mUsername << "' " + << "display '" << mDisplayName << "' " + << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds" + << LL_ENDL; } diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 1ccb33b259..baaddcaed1 100755 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -61,7 +61,6 @@ bool LLCoros::cleanup(const LLSD&) if (mi->second->exited()) { LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; - // The erase() call will invalidate its passed iterator value -- // so increment mi FIRST -- but pass its original value to // erase(). This is what postincrement is all about. diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index a724c0720f..08a5cd26df 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -283,6 +283,14 @@ 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 diff --git a/indra/llcommon/llerrorthread.cpp b/indra/llcommon/llerrorthread.cpp index 4a0c8ef342..950fcd6e83 100755 --- a/indra/llcommon/llerrorthread.cpp +++ b/indra/llcommon/llerrorthread.cpp @@ -106,7 +106,7 @@ void LLErrorThread::run() // This thread sits and waits for the sole purpose // of waiting for the signal/exception handlers to flag the // application state as APP_STATUS_ERROR. - //llinfos << "thread_error - Waiting for an error" << llendl; + llinfos << "thread_error - Waiting for an error" << llendl; S32 counter = 0; #if !LL_WINDOWS diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index f25c313920..a42af63b65 100755 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -220,21 +220,21 @@ LLSD postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& req // request event. LLSD modevent(event); LLEventDetail::storeToLLSDPath(modevent, replyPumpNamePath, replyPump.getPump().getName()); - //LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - // << " posting to " << requestPump.getPump().getName() - // << LL_ENDL; + LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + << " posting to " << requestPump.getPump().getName() + << LL_ENDL; // *NOTE:Mani - Removed because modevent could contain user's hashed passwd. // << ": " << modevent << LL_ENDL; requestPump.getPump().post(modevent); } - //LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - // << " about to wait on LLEventPump " << replyPump.getPump().getName() - // << LL_ENDL; + LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + << " about to wait on LLEventPump " << replyPump.getPump().getName() + << LL_ENDL; // trying to dereference ("resolve") the future makes us wait for it LLSD value(*future); - //LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - // << " resuming with " << value << LL_ENDL; + LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + << " resuming with " << value << LL_ENDL; // returning should disconnect the connection return value; } @@ -351,19 +351,19 @@ LLEventWithID postAndWait2(SELF& self, const LLSD& event, replyPump0.getPump().getName()); LLEventDetail::storeToLLSDPath(modevent, replyPump1NamePath, replyPump1.getPump().getName()); - //LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name - // << " posting to " << requestPump.getPump().getName() - // << ": " << modevent << LL_ENDL; + LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name + << " posting to " << requestPump.getPump().getName() + << ": " << modevent << LL_ENDL; requestPump.getPump().post(modevent); } - //LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name - // << " about to wait on LLEventPumps " << replyPump0.getPump().getName() - // << ", " << replyPump1.getPump().getName() << LL_ENDL; + LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name + << " about to wait on LLEventPumps " << replyPump0.getPump().getName() + << ", " << replyPump1.getPump().getName() << LL_ENDL; // trying to dereference ("resolve") the future makes us wait for it LLEventWithID value(*future); - //LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << name - // << " resuming with (" << value.first << ", " << value.second << ")" - // << LL_ENDL; + LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << name + << " resuming with (" << value.first << ", " << value.second << ")" + << LL_ENDL; // returning should disconnect both connections return value; } diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 49c8178b42..0855180dcd 100755 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -575,13 +575,15 @@ void LLReqID::stamp(LLSD& response) const // okay to add a key. But if it was anything else (e.g. a scalar), // assigning a ["reqid"] key will DISCARD the previous value, // replacing it with a map. That would be Bad. - LL_INFOS("LLReqID") << "stamp(" << mReqid << ") leaving non-map response unmodified: " << response << LL_ENDL; + LL_INFOS("LLReqID") << "stamp(" << mReqid << ") leaving non-map response unmodified: " + << response << LL_ENDL; return; } LLSD oldReqid(response["reqid"]); if (! (oldReqid.isUndefined() || llsd_equals(oldReqid, mReqid))) { - LL_INFOS("LLReqID") << "stamp(" << mReqid << ") preserving existing [\"reqid\"] value "<< oldReqid << " in response: " << response << LL_ENDL; + LL_INFOS("LLReqID") << "stamp(" << mReqid << ") preserving existing [\"reqid\"] value " + << oldReqid << " in response: " << response << LL_ENDL; return; } response["reqid"] = mReqid; diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 44ba84c160..70ad10ad55 100755 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -987,27 +987,27 @@ void LLPrivateMemoryPool::LLMemoryChunk::dump() } #endif #if 0 - LL_DEBUGS(LLMemory) << "---------------------------" << llendl ; - LL_DEBUGS(LLMemory) << "Chunk buffer: " << (U32)getBuffer() << " size: " << getBufferSize() << llendl ; + llinfos << "---------------------------" << llendl ; + llinfos << "Chunk buffer: " << (U32)getBuffer() << " size: " << getBufferSize() << llendl ; - LL_DEBUGS(LLMemory) << "available blocks ... " << llendl ; + llinfos << "available blocks ... " << llendl ; for(S32 i = 0 ; i < mBlockLevels ; i++) { LLMemoryBlock* blk = mAvailBlockList[i] ; while(blk) { - LL_DEBUGS(LLMemory) << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; + llinfos << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; blk = blk->mNext ; } } - LL_DEBUGS(LLMemory) << "free blocks ... " << llendl ; + llinfos << "free blocks ... " << llendl ; for(S32 i = 0 ; i < mPartitionLevels ; i++) { LLMemoryBlock* blk = mFreeSpaceList[i] ; while(blk) { - LL_DEBUGS(LLMemory) << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; + llinfos << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; blk = blk->mNext ; } } @@ -1731,7 +1731,7 @@ void LLPrivateMemoryPool::removeFromHashTable(LLMemoryChunk* chunk) void LLPrivateMemoryPool::rehash() { - LL_DEBUGS("LLMemory") << "new hash factor: " << mHashFactor << llendl ; + llinfos << "new hash factor: " << mHashFactor << llendl ; mChunkHashList.clear() ; mChunkHashList.resize(mHashFactor) ; @@ -1848,7 +1848,7 @@ LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager() S32 k = 0 ; for(mem_allocation_info_t::iterator iter = sMemAllocationTracker.begin() ; iter != sMemAllocationTracker.end() ; ++iter) { - LL_DEBUGS(LLMemory) << k++ << ", " << (U32)iter->first << " : " << iter->second << llendl ; + llinfos << k++ << ", " << (U32)iter->first << " : " << iter->second << llendl ; } sMemAllocationTracker.clear() ; } @@ -2190,8 +2190,8 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) { LLTimer timer ; - LL_DEBUGS(LLMemory) << " -**********************- " << llendl ; - LL_DEBUGS(LLMemory) << "test size: " << size << " test times: " << times << llendl ; + llinfos << " -**********************- " << llendl ; + llinfos << "test size: " << size << " test times: " << times << llendl ; timer.reset() ; char** p = new char*[times] ; @@ -2212,7 +2212,7 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) FREE_MEM(sPool, p[i]) ; p[i] = NULL ; } - LL_DEBUGS(LLMemory) << "time spent using customized memory pool: " << timer.getElapsedTimeF32() << llendl ; + llinfos << "time spent using customized memory pool: " << timer.getElapsedTimeF32() << llendl ; timer.reset() ; @@ -2232,7 +2232,7 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) ::delete[] p[i] ; p[i] = NULL ; } - LL_DEBUGS(LLMemory) << "time spent using standard allocator/de-allocator: " << timer.getElapsedTimeF32() << llendl ; + llinfos << "time spent using standard allocator/de-allocator: " << timer.getElapsedTimeF32() << llendl ; delete[] p; } diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 59298366a3..715df36f39 100755 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -81,7 +81,7 @@ public: // incrementing, listen on "mainloop". if (mCount++ == 0) { - //LL_DEBUGS("LLProcess") << "listening on \"mainloop\"" << LL_ENDL; + LL_DEBUGS("LLProcess") << "listening on \"mainloop\"" << LL_ENDL; mConnection = LLEventPumps::instance().obtain("mainloop") .listen("LLProcessListener", boost::bind(&LLProcessListener::tick, this, _1)); } @@ -93,7 +93,7 @@ public: // stop listening on "mainloop". if (--mCount == 0) { - //LL_DEBUGS("LLProcess") << "disconnecting from \"mainloop\"" << LL_ENDL; + LL_DEBUGS("LLProcess") << "disconnecting from \"mainloop\"" << LL_ENDL; mConnection.disconnect(); } } @@ -118,7 +118,7 @@ private: // centralize such calls, using "mainloop" to ensure it happens once // per frame, and refcounting running LLProcess objects to remain // registered only while needed. - //LL_DEBUGS("LLProcess") << "calling apr_proc_other_child_refresh_all()" << LL_ENDL; + LL_DEBUGS("LLProcess") << "calling apr_proc_other_child_refresh_all()" << LL_ENDL; apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); return false; } @@ -216,13 +216,13 @@ public: remainptr += written; remainlen -= written; - //char msgbuf[512]; - //LL_DEBUGS("LLProcess") << "wrote " << written << " of " << towrite - // << " bytes to " << mDesc - // << " (original " << total << ")," - // << " code " << err << ": " - // << apr_strerror(err, msgbuf, sizeof(msgbuf)) - // << LL_ENDL; + char msgbuf[512]; + LL_DEBUGS("LLProcess") << "wrote " << written << " of " << towrite + << " bytes to " << mDesc + << " (original " << total << ")," + << " code " << err << ": " + << apr_strerror(err, msgbuf, sizeof(msgbuf)) + << LL_ENDL; // The parent end of this pipe is nonblocking. If we weren't able // to write everything we wanted, don't keep banging on it -- that @@ -738,7 +738,8 @@ LLProcess::LLProcess(const LLSDOrParams& params): { mPipes.replace(i, new ReadPipeImpl(desc, pipe, FILESLOT(i))); } - LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name() << "('" << desc << "')" << LL_ENDL; + LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name() + << "('" << desc << "')" << LL_ENDL; } } diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 5d3595a66f..418c5763f8 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -1032,9 +1032,9 @@ LLMemoryInfo& LLMemoryInfo::refresh() { mStatsMap = loadStatsMap(); -// LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; -// LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); -// LL_ENDL; + LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; + LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); + LL_ENDL; return *this; } -- 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 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') 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 -- 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/llcommon') 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 From c38204f5e0a9130f0d4d4bfc997da107fd1017ce Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Wed, 5 Jun 2013 14:26:27 -0700 Subject: Unwind cruft from hunting for 2707 they won't end up in vwr-dev-mat --- indra/llcommon/llerror.cpp | 5 ++++- indra/llcommon/llerror.h | 14 -------------- indra/llcommon/llsys.cpp | 5 +---- 3 files changed, 5 insertions(+), 19 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 5c8e6cca29..9b0141eb76 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -201,7 +201,10 @@ namespace { virtual void recordMessage(LLError::ELevel level, const std::string& message) { - LL_WINDOWS_OUTPUT_DEBUG(wstring_to_utf16str(utf8str_to_wstring(message))); + llutf16string utf16str = + wstring_to_utf16str(utf8str_to_wstring(message)); + utf16str += '\n'; + OutputDebugString(utf16str.c_str()); } }; #endif diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 08a5cd26df..b65b410153 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -283,20 +283,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; } -- cgit v1.2.3 From 6b2a22e11cf0dcd8bf775dff357efacc8704714c Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 10 Jun 2013 16:55:05 -0700 Subject: MAINT-2777 work-around for APR assert_always causing random crash in materials build --- indra/llcommon/llapr.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index d1c44c9403..a0802c6adf 100755 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -226,9 +226,7 @@ void LLVolatileAPRPool::clearVolatileAPRPool() llassert_always(mNumActiveRef > 0) ; } - //paranoia check if the pool is jammed. - //will remove the check before going to release. - llassert_always(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ; + llassert(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ; } BOOL LLVolatileAPRPool::isFull() -- cgit v1.2.3 From cb5289e02a4003ca7057a392d41127b36614658c Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 18 Jun 2013 12:31:54 -0400 Subject: remove files incorrectly brought back from the past by merges --- indra/llcommon/llversionviewer.h | 41 ---------------------------------------- 1 file changed, 41 deletions(-) delete mode 100755 indra/llcommon/llversionviewer.h (limited to 'indra/llcommon') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h deleted file mode 100755 index 0ea130e86b..0000000000 --- a/indra/llcommon/llversionviewer.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file llversionviewer.h - * @brief - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLVERSIONVIEWER_H -#define LL_LLVERSIONVIEWER_H - -const S32 LL_VERSION_MAJOR = 3; -const S32 LL_VERSION_MINOR = 5; -const S32 LL_VERSION_PATCH = 2; -const S32 LL_VERSION_BUILD = 264760; - -const char * const LL_CHANNEL = "Second Life Developer"; - -#if LL_DARWIN -const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.indra.viewer"; -#endif - -#endif -- cgit v1.2.3