From 1cd299ec8b2eebcf9845b36ab256a4ff82597434 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 17 Jun 2010 12:44:23 -0500 Subject: Fix fast timer view showing incorrect units. --- indra/llcommon/llfasttimer_class.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index 20727dd76e..dfbae09864 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -238,7 +238,8 @@ U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer #else // windows or x86-mac or x86-linux or x86-solaris U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer { - static U64 sCPUClockFrequency = U64(LLProcessorInfo().getCPUFrequency()); + //getCPUFrequency returns MHz and sCPUClockFrequency wants to be in Hz + static U64 sCPUClockFrequency = U64(LLProcessorInfo().getCPUFrequency()*1000000.0); // we drop the low-order byte in our timers, so report a lower frequency return sCPUClockFrequency >> 8; -- cgit v1.2.3 From 9a57dc0cf3a1b3bc55d380a3ed0bf4eab02a87cf Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 17 Jun 2010 17:21:38 -0700 Subject: Block installation of exception handler when app is being debugged (Darwin only). Fixes issues with debugging Darwin SL. --- indra/llcommon/llapp.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index eedec0b24e..0447ca93f5 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -32,6 +32,12 @@ #include +#ifdef LL_DARWIN +#include +#include +#include +#endif + #include "linden_common.h" #include "llapp.h" @@ -306,7 +312,42 @@ void LLApp::setupErrorHandling() setup_signals(); // Add google breakpad exception handler configured for Darwin/Linux. - if(mExceptionHandler == 0) + bool installHandler = true; +#ifdef 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 + // the structure kinfo_proc which has been tagged by apple as an unstable + // API. We disable this test for shipping versions to avoid conflicts with + // 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]; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); + + struct kinfo_proc info; + memset(&info, 0, sizeof(info)); + + size_t size = sizeof(info); + int result = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0); + if((result == 0) || (errno == ENOMEM)) + { + // P_TRACED flag is set, so this process is being debugged; do not install + // the handler + if(info.kp_proc.p_flag & P_TRACED) installHandler = false; + } + else + { + // Failed to discover if the process is being debugged; default to + // installing the handler. + 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); @@ -364,7 +405,7 @@ void LLApp::setError() void LLApp::setMiniDumpDir(const std::string &path) { - llassert(mExceptionHandler); + if(mExceptionHandler == 0) return; #ifdef LL_WINDOWS wchar_t buffer[MAX_MINDUMP_PATH_LENGTH]; mbstowcs(buffer, path.c_str(), MAX_MINDUMP_PATH_LENGTH); @@ -376,7 +417,7 @@ void LLApp::setMiniDumpDir(const std::string &path) void LLApp::writeMiniDump() { - llassert(mExceptionHandler); + if(mExceptionHandler == 0) return; mExceptionHandler->WriteMinidump(); } -- cgit v1.2.3