Title: [94955] trunk/Tools
- Revision
- 94955
- Author
- kbal...@webkit.org
- Date
- 2011-09-12 07:20:07 -0700 (Mon, 12 Sep 2011)
Log Message
[Qt][WK2] WebKitTestRunner does not produce crash logs
https://bugs.webkit.org/show_bug.cgi?id=67714
Added a simple way of generating backtrace on crash
to the web process. The implementation is similar what
we have in DRT. It depends on GNU libc functionality
so it is only enabled where we are running in such an environment.
* WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp:
(WTR::printBacktrace):
(WTR::crashHandler):
(WTR::InjectedBundle::platformInitialize):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (94954 => 94955)
--- trunk/Tools/ChangeLog 2011-09-12 13:33:56 UTC (rev 94954)
+++ trunk/Tools/ChangeLog 2011-09-12 14:20:07 UTC (rev 94955)
@@ -1,3 +1,18 @@
+2011-09-12 Balazs Kelemen <kbal...@webkit.org>
+
+ [Qt][WK2] WebKitTestRunner does not produce crash logs
+ https://bugs.webkit.org/show_bug.cgi?id=67714
+
+ Added a simple way of generating backtrace on crash
+ to the web process. The implementation is similar what
+ we have in DRT. It depends on GNU libc functionality
+ so it is only enabled where we are running in such an environment.
+
+ * WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp:
+ (WTR::printBacktrace):
+ (WTR::crashHandler):
+ (WTR::InjectedBundle::platformInitialize):
+
2011-09-11 Filip Pizlo <fpi...@apple.com>
Added my IRC nick to the committers file.
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp (94954 => 94955)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp 2011-09-12 13:33:56 UTC (rev 94954)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/qt/InjectedBundleQt.cpp 2011-09-12 14:20:07 UTC (rev 94955)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 University of Szeged. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,11 +26,62 @@
#include "config.h"
#include "InjectedBundle.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <wtf/AlwaysInline.h>
+#if HAVE(SIGNAL_H)
+#include <signal.h>
+#endif
+
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
+#include <execinfo.h>
+#endif
+
namespace WTR {
+static inline void printBacktrace()
+{
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
+ void* frames[256];
+ size_t size = backtrace(frames, 256);
+ if (!size)
+ return;
+
+ char** symbols = backtrace_symbols(frames, size);
+ if (!symbols)
+ return;
+
+ for (unsigned i = 0; i < size; ++i)
+ fprintf(stderr, "%u: %s\n", i, symbols[i]);
+
+ fflush(stderr);
+ free(symbols);
+#endif
+}
+
+#if HAVE(SIGNAL_H)
+static NO_RETURN void crashHandler(int signal)
+{
+ fprintf(stderr, "%s\n", strsignal(signal));
+ printBacktrace();
+ exit(128 + signal);
+}
+#endif
+
void InjectedBundle::platformInitialize(WKTypeRef)
{
+#if HAVE(SIGNAL_H)
+ signal(SIGILL, crashHandler); /* 4: illegal instruction (not reset when caught) */
+ signal(SIGTRAP, crashHandler); /* 5: trace trap (not reset when caught) */
+ signal(SIGFPE, crashHandler); /* 8: floating point exception */
+ signal(SIGBUS, crashHandler); /* 10: bus error */
+ signal(SIGSEGV, crashHandler); /* 11: segmentation violation */
+ signal(SIGSYS, crashHandler); /* 12: bad argument to system call */
+ signal(SIGPIPE, crashHandler); /* 13: write on a pipe with no reader */
+ signal(SIGXCPU, crashHandler); /* 24: exceeded CPU time limit */
+ signal(SIGXFSZ, crashHandler); /* 25: exceeded file size limit */
+#endif
}
} // namespace WTR
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes