aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:19 -0500
committerJacek Antonelli2008-08-15 23:45:19 -0500
commitb235c59d60472f818a9142c0886b95a0ff4191d7 (patch)
treed323c55587584b19cc43a03f58a178823f12d3cd /linden/indra/linux_crash_logger/llcrashloggerlinux.cpp
parentSecond Life viewer sources 1.18.5.3 (diff)
downloadmeta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.zip
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.gz
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.bz2
meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.xz
Second Life viewer sources 1.18.6.0-RC
Diffstat (limited to 'linden/indra/linux_crash_logger/llcrashloggerlinux.cpp')
-rw-r--r--linden/indra/linux_crash_logger/llcrashloggerlinux.cpp140
1 files changed, 140 insertions, 0 deletions
diff --git a/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp b/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp
new file mode 100644
index 0000000..26a8f0c
--- /dev/null
+++ b/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp
@@ -0,0 +1,140 @@
1/**
2 * @file llcrashloggerlinux.cpp
3 * @brief Linux crash logger implementation
4 *
5 * $LicenseInfo:firstyear=2003&license=viewergpl$
6 *
7 * Copyright (c) 2003-2007, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
30 */
31
32#include "llcrashloggerlinux.h"
33
34#include <iostream>
35
36#include "linden_common.h"
37
38#include "boost/tokenizer.hpp"
39
40#include "indra_constants.h" // CRASH_BEHAVIOR_ASK, CRASH_SETTING_NAME
41#include "llerror.h"
42#include "llfile.h"
43#include "lltimer.h"
44#include "llstring.h"
45#include "lldir.h"
46#include "llsdserialize.h"
47
48#if LL_GTK
49# include "gtk/gtk.h"
50#endif // LL_GTK
51
52#define MAX_LOADSTRING 100
53
54// These need to be localized.
55static const char dialog_text[] =
56"Second Life appears to have crashed or frozen last time it ran.\n"
57"This crash reporter collects information about your computer's hardware, operating system, and some Second Life logs, all of which are used for debugging purposes only.\n"
58"In the space below, please briefly describe what you were doing or trying to do just prior to the crash. Thank you for your help!\n"
59"This report is NOT read by Customer Support. If you have billing or other questions, contact support by visiting http://www.secondlife.com/support\n"
60"\n"
61"Send crash report?";
62
63static const char dialog_title[] =
64"Second Life Crash Logger";
65
66#if LL_GTK
67static void response_callback (GtkDialog *dialog,
68 gint arg1,
69 gpointer user_data)
70{
71 gint *response = (gint*)user_data;
72 *response = arg1;
73 gtk_widget_destroy(GTK_WIDGET(dialog));
74 gtk_main_quit();
75}
76#endif // LL_GTK
77
78static BOOL do_ask_dialog(void)
79{
80#if LL_GTK
81 gtk_disable_setlocale();
82 if (!gtk_init_check(NULL, NULL)) {
83 llinfos << "Could not initialize GTK for 'ask to send crash report' dialog; not sending report." << llendl;
84 return FALSE;
85 }
86
87 GtkWidget *win = NULL;
88 GtkDialogFlags flags = GTK_DIALOG_MODAL;
89 GtkMessageType messagetype = GTK_MESSAGE_QUESTION;
90 GtkButtonsType buttons = GTK_BUTTONS_YES_NO;
91 gint response = GTK_RESPONSE_NONE;
92
93 win = gtk_message_dialog_new(NULL,
94 flags, messagetype, buttons,
95 dialog_text);
96 gtk_window_set_type_hint(GTK_WINDOW(win),
97 GDK_WINDOW_TYPE_HINT_DIALOG);
98 gtk_window_set_title(GTK_WINDOW(win), dialog_title);
99 g_signal_connect (win,
100 "response",
101 G_CALLBACK (response_callback),
102 &response);
103 gtk_widget_show_all (win);
104 gtk_main();
105
106 return (GTK_RESPONSE_OK == response ||
107 GTK_RESPONSE_YES == response ||
108 GTK_RESPONSE_APPLY == response);
109#else
110 return FALSE;
111#endif // LL_GTK
112}
113
114LLCrashLoggerLinux::LLCrashLoggerLinux(void)
115{
116}
117
118LLCrashLoggerLinux::~LLCrashLoggerLinux(void)
119{
120}
121
122void LLCrashLoggerLinux::gatherPlatformSpecificFiles()
123{
124 mFileMap["CrashLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log").c_str();
125}
126
127bool LLCrashLoggerLinux::mainLoop()
128{
129 if(!do_ask_dialog())
130 {
131 return true;
132 }
133 sendCrashLogs();
134 return true;
135}
136
137void LLCrashLoggerLinux::updateApplication(LLString message)
138{
139 LLCrashLogger::updateApplication(message);
140}