diff options
Diffstat (limited to 'linden/indra/newview/llappviewerlinux.cpp')
-rw-r--r-- | linden/indra/newview/llappviewerlinux.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/linden/indra/newview/llappviewerlinux.cpp b/linden/indra/newview/llappviewerlinux.cpp index 5537687..0a4a9cf 100644 --- a/linden/indra/newview/llappviewerlinux.cpp +++ b/linden/indra/newview/llappviewerlinux.cpp | |||
@@ -45,14 +45,7 @@ | |||
45 | 45 | ||
46 | #if LL_LINUX | 46 | #if LL_LINUX |
47 | # include <dlfcn.h> // RTLD_LAZY | 47 | # include <dlfcn.h> // RTLD_LAZY |
48 | # include <execinfo.h> // backtrace - glibc only | 48 | # include <execinfo.h> // backtrace - glibc only |
49 | # ifndef LL_ELFBIN | ||
50 | # define LL_ELFBIN 1 | ||
51 | # endif // LL_ELFBIN | ||
52 | # if LL_ELFBIN | ||
53 | # include <cxxabi.h> // for symbol demangling | ||
54 | # include "ELFIO.h" // for better backtraces | ||
55 | # endif // LL_ELFBIN | ||
56 | #elif LL_SOLARIS | 49 | #elif LL_SOLARIS |
57 | # include <sys/types.h> | 50 | # include <sys/types.h> |
58 | # include <unistd.h> | 51 | # include <unistd.h> |
@@ -60,6 +53,13 @@ | |||
60 | # include <ucontext.h> | 53 | # include <ucontext.h> |
61 | #endif | 54 | #endif |
62 | 55 | ||
56 | #ifdef LL_ELFBIN | ||
57 | # ifdef __GNUC__ | ||
58 | # include <cxxabi.h> // for symbol demangling | ||
59 | # endif | ||
60 | # include "ELFIO/ELFIO.h" // for better backtraces | ||
61 | #endif | ||
62 | |||
63 | namespace | 63 | namespace |
64 | { | 64 | { |
65 | int gArgC = 0; | 65 | int gArgC = 0; |
@@ -131,7 +131,7 @@ static inline BOOL do_basic_glibc_backtrace() | |||
131 | 131 | ||
132 | std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); | 132 | std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); |
133 | llinfos << "Opening stack trace file " << strace_filename << llendl; | 133 | llinfos << "Opening stack trace file " << strace_filename << llendl; |
134 | LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); | 134 | LLFILE* StraceFile = LLFile::fopen(strace_filename, "w"); |
135 | if (!StraceFile) | 135 | if (!StraceFile) |
136 | { | 136 | { |
137 | llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; | 137 | llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; |
@@ -162,7 +162,7 @@ static inline BOOL do_basic_glibc_backtrace() | |||
162 | 162 | ||
163 | std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); | 163 | std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); |
164 | llinfos << "Opening stack trace file " << strace_filename << llendl; | 164 | llinfos << "Opening stack trace file " << strace_filename << llendl; |
165 | LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); // Flawfinder: ignore | 165 | LLFILE* StraceFile = LLFile::fopen(strace_filename, "w"); // Flawfinder: ignore |
166 | if (!StraceFile) | 166 | if (!StraceFile) |
167 | { | 167 | { |
168 | llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; | 168 | llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; |
@@ -200,7 +200,7 @@ static inline BOOL do_elfio_glibc_backtrace() | |||
200 | 200 | ||
201 | std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); | 201 | std::string strace_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); |
202 | llinfos << "Opening stack trace file " << strace_filename << llendl; | 202 | llinfos << "Opening stack trace file " << strace_filename << llendl; |
203 | LLFILE* StraceFile = LLFile::fopen(strace_filename.c_str(), "w"); // Flawfinder: ignore | 203 | LLFILE* StraceFile = LLFile::fopen(strace_filename, "w"); // Flawfinder: ignore |
204 | if (!StraceFile) | 204 | if (!StraceFile) |
205 | { | 205 | { |
206 | llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; | 206 | llinfos << "Opening stack trace file " << strace_filename << " failed. Using stderr." << llendl; |
@@ -340,25 +340,25 @@ void LLAppViewerLinux::handleCrashReporting() | |||
340 | if (CRASH_BEHAVIOR_NEVER_SEND != cb) | 340 | if (CRASH_BEHAVIOR_NEVER_SEND != cb) |
341 | { | 341 | { |
342 | // launch the actual crash logger | 342 | // launch the actual crash logger |
343 | char* ask_dialog = "-dialog"; | 343 | const char* ask_dialog = "-dialog"; |
344 | if (CRASH_BEHAVIOR_ASK != cb) | 344 | if (CRASH_BEHAVIOR_ASK != cb) |
345 | ask_dialog = ""; // omit '-dialog' option | 345 | ask_dialog = ""; // omit '-dialog' option |
346 | std::string cmd =gDirUtilp->getAppRODataDir(); | 346 | std::string cmd =gDirUtilp->getAppRODataDir(); |
347 | cmd += gDirUtilp->getDirDelimiter(); | 347 | cmd += gDirUtilp->getDirDelimiter(); |
348 | cmd += "linux-crash-logger.bin"; | 348 | cmd += "linux-crash-logger.bin"; |
349 | char* const cmdargv[] = | 349 | const char * cmdargv[] = |
350 | {(char*)cmd.c_str(), | 350 | {cmd.c_str(), |
351 | ask_dialog, | 351 | ask_dialog, |
352 | (char*)"-user", | 352 | "-user", |
353 | (char*)LLViewerLogin::getInstance()->getGridLabel().c_str(), | 353 | (char*)LLViewerLogin::getInstance()->getGridLabel().c_str(), |
354 | (char*)"-name", | 354 | "-name", |
355 | (char*)LLAppViewer::instance()->getSecondLifeTitle().c_str(), | 355 | LLAppViewer::instance()->getSecondLifeTitle().c_str(), |
356 | NULL}; | 356 | NULL}; |
357 | fflush(NULL); | 357 | fflush(NULL); |
358 | pid_t pid = fork(); | 358 | pid_t pid = fork(); |
359 | if (pid == 0) | 359 | if (pid == 0) |
360 | { // child | 360 | { // child |
361 | execv(cmd.c_str(), cmdargv); /* Flawfinder: ignore */ | 361 | execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */ |
362 | llwarns << "execv failure when trying to start " << cmd << llendl; | 362 | llwarns << "execv failure when trying to start " << cmd << llendl; |
363 | _exit(1); // avoid atexit() | 363 | _exit(1); // avoid atexit() |
364 | } | 364 | } |
@@ -429,7 +429,7 @@ bool LLAppViewerLinux::initLogging() | |||
429 | // Remove the last stack trace, if any | 429 | // Remove the last stack trace, if any |
430 | std::string old_stack_file = | 430 | std::string old_stack_file = |
431 | gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); | 431 | gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); |
432 | LLFile::remove(old_stack_file.c_str()); | 432 | LLFile::remove(old_stack_file); |
433 | 433 | ||
434 | return LLAppViewer::initLogging(); | 434 | return LLAppViewer::initLogging(); |
435 | } | 435 | } |
@@ -448,14 +448,18 @@ bool LLAppViewerLinux::initParseCommandLine(LLCommandLineParser& clp) | |||
448 | { | 448 | { |
449 | if (success >= 2 && locale->lang) // confident! | 449 | if (success >= 2 && locale->lang) // confident! |
450 | { | 450 | { |
451 | LL_INFOS("AppInit") << "Language " << ll_safe_string(locale->lang) << LL_ENDL; | ||
452 | LL_INFOS("AppInit") << "Location " << ll_safe_string(locale->country) << LL_ENDL; | ||
453 | LL_INFOS("AppInit") << "Variant " << ll_safe_string(locale->variant) << LL_ENDL; | ||
454 | |||
451 | LLControlVariable* c = gSavedSettings.getControl("SystemLanguage"); | 455 | LLControlVariable* c = gSavedSettings.getControl("SystemLanguage"); |
452 | if(c) | 456 | if(c) |
453 | { | 457 | { |
454 | c->setValue(std::string(locale->lang), false); | 458 | c->setValue(std::string(locale->lang), false); |
455 | } | 459 | } |
456 | } | 460 | } |
457 | FL_FreeLocale(&locale); | ||
458 | } | 461 | } |
462 | FL_FreeLocale(&locale); | ||
459 | 463 | ||
460 | return true; | 464 | return true; |
461 | } | 465 | } |