summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llapp.cpp59
-rw-r--r--indra/llcommon/llapp.h2
2 files changed, 57 insertions, 4 deletions
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index ca258900c7..c6da205815 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
@@ -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);
+ 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: <dump_dir>/<minidump_id>.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<U32> LLAtomicU32;
class LLErrorThread;
class LLLiveFile;
#if LL_LINUX
-typedef struct siginfo siginfo_t;
+#include <signal.h>
#endif
typedef void (*LLAppErrorHandler)();