bug-buddy r2691 - in trunk: . gnome-breakpad google-breakpad google-breakpad/src/client/linux/handler
- From: cosimoc svn gnome org
- To: svn-commits-list gnome org
- Subject: bug-buddy r2691 - in trunk: . gnome-breakpad google-breakpad google-breakpad/src/client/linux/handler
- Date: Sun, 14 Sep 2008 23:59:23 +0000 (UTC)
Author: cosimoc
Date: Sun Sep 14 23:59:23 2008
New Revision: 2691
URL: http://svn.gnome.org/viewvc/bug-buddy?rev=2691&view=rev
Log:
2008-09-15 Cosimo Cecchi <cosimoc gnome org>
* gnome-breakpad/gnome-breakpad.cc:
Simplify the code and do not use google-breakpad to connect the
exception handler, as for some reason that doesn't seem to work
when we load the gnomebreakpad module with XSettings.
Modified:
trunk/ChangeLog
trunk/gnome-breakpad/gnome-breakpad.cc
trunk/google-breakpad/ChangeLog
trunk/google-breakpad/src/client/linux/handler/exception_handler.cc
Modified: trunk/gnome-breakpad/gnome-breakpad.cc
==============================================================================
--- trunk/gnome-breakpad/gnome-breakpad.cc (original)
+++ trunk/gnome-breakpad/gnome-breakpad.cc Sun Sep 14 23:59:23 2008
@@ -34,12 +34,13 @@
extern "C" int gtk_module_init (int *argc, char** argv[]);
static bool run_bug_buddy (const gchar *appname, pid_t pid, const gchar *minidump_path);
-static bool check_if_gdb (void *callback_context);
-
+static void check_if_gdb ();
static gchar *bugbuddy;
#ifdef ENABLE_GOOGLE_BREAKPAD
+static ExceptionHandler * handler;
+
// Callback when minidump written.
static bool MinidumpCallback(const char *dump_path,
const char *minidump_id,
@@ -58,7 +59,8 @@
g_free (minidump_file);
_exit(0);
}
-#else
+#endif
+
static void
bugbuddy_segv_handle(int signum)
{
@@ -78,15 +80,18 @@
_exit(1);
}
- check_if_gdb (NULL);
+ check_if_gdb ();
- /* If we are here is because gdb couldn't be run.
- * FIXME: Show some error? */
-
- _exit(1);
-}
+#ifdef ENABLE_GOOGLE_BREAKPAD
+ /* If we are here is because there are no debug symbols or gdb couldn't be run.
+ * Write the minidump anyway.
+ */
+
+ handler->WriteMinidump ("/tmp", MinidumpCallback, NULL);
#endif
+ _exit(1);
+}
#define N_TRIES 3
@@ -251,8 +256,8 @@
return true;
}
-static bool
-check_if_gdb (void *callback_context)
+static void
+check_if_gdb ()
{
char mypath[255];
gchar *gdb;
@@ -282,15 +287,12 @@
readlink ("/proc/self/exe", mypath, sizeof(mypath));
has_debug_symbols = elf_has_debug_symbols (mypath);
-
if (bugbuddy && gdb && has_debug_symbols) {
res = run_bug_buddy (appname, pid, NULL);
if (!res)
_exit (1);
_exit(0);
}
-
- return true;
}
int
@@ -300,31 +302,11 @@
if (bugbuddy && !g_getenv ("GNOME_DISABLE_CRASH_DIALOG")) {
#ifdef ENABLE_GOOGLE_BREAKPAD
- static struct sigaction old_action;
-
- sigaction(SIGSEGV, NULL, &old_action);
- if (old_action.sa_handler != SIG_DFL)
- return 0;
-
- sigaction(SIGABRT, NULL, &old_action);
- if (old_action.sa_handler != SIG_DFL)
- return 0;
-
- sigaction(SIGTRAP, NULL, &old_action);
- if (old_action.sa_handler != SIG_DFL)
- return 0;
-
- sigaction(SIGFPE, NULL, &old_action);
- if (old_action.sa_handler != SIG_DFL)
- return 0;
-
- sigaction(SIGBUS, NULL, &old_action);
- if (old_action.sa_handler != SIG_DFL)
- return 0;
+ /* create the handler for minidumps */
+ handler = new ExceptionHandler ("/tmp", NULL,
+ NULL, NULL, false);
+#endif
- static ExceptionHandler handler("/tmp", check_if_gdb,
- MinidumpCallback, NULL, true);
-#else
static struct sigaction *setptr;
static struct sigaction old_action;
struct sigaction sa;
@@ -352,7 +334,6 @@
sigaction(SIGBUS, NULL, &old_action);
if (old_action.sa_handler == SIG_DFL)
sigaction(SIGBUS, setptr, NULL);
-#endif
}
return 0;
}
Modified: trunk/google-breakpad/src/client/linux/handler/exception_handler.cc
==============================================================================
--- trunk/google-breakpad/src/client/linux/handler/exception_handler.cc (original)
+++ trunk/google-breakpad/src/client/linux/handler/exception_handler.cc Sun Sep 14 23:59:23 2008
@@ -37,6 +37,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <limits.h>
+#include <string.h>
#include <cassert>
#include <cstdlib>
@@ -151,6 +152,7 @@
void ExceptionHandler::SetupHandler(int signo) {
struct sigaction act, old_act;
+ memset (&act, 0, sizeof (act));
act.sa_handler = HandleException;
act.sa_flags = SA_ONSTACK;
if (sigaction(signo, &act, &old_act) < 0)
@@ -161,6 +163,7 @@
void ExceptionHandler::TeardownHandler(int signo) {
if (old_handlers_.find(signo) != old_handlers_.end()) {
struct sigaction act;
+ memset (&act, 0, sizeof (act));
act.sa_handler = old_handlers_[signo];
act.sa_flags = 0;
sigaction(signo, &act, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]