Title: [116417] trunk
Revision
116417
Author
[email protected]
Date
2012-05-08 07:00:31 -0700 (Tue, 08 May 2012)

Log Message

[Qt] Unbreak debugging of WebKit2.
https://bugs.webkit.org/show_bug.cgi?id=85839

Reviewed by Simon Hausmann.

Source/WebKit2:

When you attach GDB to a running process, it stops it.
http://trac.webkit.org/changeset/115958 introduced a pause()
call to wait the debugger to be attached to then continue
the execution of the WebProcess. Unfortunately the pause()
function does not return unless a signal handler is called.
This patch introduce an event handler to exit from the paused
state when the debugger send the signal SIGCONT. The old code
works with older version of GDB (<7.0) but not with newer
versions where the behavior of pause() is correct.

* qt/MainQt.cpp:
(sigcontHandler):
(main):

Tools:

When you attach GDB to a running process, it stops it.
http://trac.webkit.org/changeset/115958 introduced a pause()
call to wait the debugger to be attached to then continue
the execution of the WebProcess. Unfortunately the pause()
function does not return unless a signal handler is called.
This patch introduce an event handler to exit from the paused
state when the debugger send the signal SIGCONT. The old code
works with older version of GDB (<7.0) but not with newer
versions where the behavior of pause() is correct.

* WebKitTestRunner/qt/main.cpp:
(sigcontHandler):
(main):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (116416 => 116417)


--- trunk/Source/WebKit2/ChangeLog	2012-05-08 13:57:20 UTC (rev 116416)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-08 14:00:31 UTC (rev 116417)
@@ -1,3 +1,24 @@
+2012-05-07  Alexis Menard  <[email protected]>
+
+        [Qt] Unbreak debugging of WebKit2.
+        https://bugs.webkit.org/show_bug.cgi?id=85839
+
+        Reviewed by Simon Hausmann.
+
+        When you attach GDB to a running process, it stops it.
+        http://trac.webkit.org/changeset/115958 introduced a pause()
+        call to wait the debugger to be attached to then continue
+        the execution of the WebProcess. Unfortunately the pause()
+        function does not return unless a signal handler is called.
+        This patch introduce an event handler to exit from the paused
+        state when the debugger send the signal SIGCONT. The old code
+        works with older version of GDB (<7.0) but not with newer
+        versions where the behavior of pause() is correct.
+
+        * qt/MainQt.cpp:
+        (sigcontHandler):
+        (main):
+
 2012-05-07  Julien Chaffraix  <[email protected]>
 
         Refactor windowClipRectForLayer to remove the explicit RenderLayer dependency

Modified: trunk/Source/WebKit2/qt/MainQt.cpp (116416 => 116417)


--- trunk/Source/WebKit2/qt/MainQt.cpp	2012-05-08 13:57:20 UTC (rev 116416)
+++ trunk/Source/WebKit2/qt/MainQt.cpp	2012-05-08 14:00:31 UTC (rev 116417)
@@ -28,6 +28,7 @@
 
 #include <stdio.h>
 #if !defined(NDEBUG) && defined(Q_OS_UNIX)
+#include <signal.h>
 #include <unistd.h>
 #endif
 
@@ -36,6 +37,12 @@
 Q_DECL_IMPORT void initializeWebKit2Theme();
 }
 
+#if !defined(NDEBUG) && defined(Q_OS_UNIX)
+static void sigcontHandler(int)
+{
+}
+#endif
+
 static void messageHandler(QtMsgType type, const char* message)
 {
     if (type == QtCriticalMsg) {
@@ -53,8 +60,14 @@
 {
 #if !defined(NDEBUG) && defined(Q_OS_UNIX)
     if (qgetenv("QT_WEBKIT_PAUSE_WEB_PROCESS") == "1" || qgetenv("QT_WEBKIT2_DEBUG") == "1") {
-        fprintf(stderr, "Pausing web process, please attach to PID %d and continue... ", getpid());
+        struct sigaction newAction, oldAction;
+        newAction.sa_handler = sigcontHandler;
+        sigemptyset(&newAction.sa_mask);
+        newAction.sa_flags = 0;
+        sigaction(SIGCONT, &newAction, &oldAction);
+        fprintf(stderr, "Pausing UI process, please attach to PID %d and send signal SIGCONT... ", getpid());
         pause();
+        sigaction(SIGCONT, &oldAction, 0);
         fprintf(stderr, " OK\n");
     }
 #endif

Modified: trunk/Tools/ChangeLog (116416 => 116417)


--- trunk/Tools/ChangeLog	2012-05-08 13:57:20 UTC (rev 116416)
+++ trunk/Tools/ChangeLog	2012-05-08 14:00:31 UTC (rev 116417)
@@ -1,3 +1,24 @@
+2012-05-07  Alexis Menard  <[email protected]>
+
+        [Qt] Unbreak debugging of WebKit2.
+        https://bugs.webkit.org/show_bug.cgi?id=85839
+
+        Reviewed by Simon Hausmann.
+
+        When you attach GDB to a running process, it stops it.
+        http://trac.webkit.org/changeset/115958 introduced a pause() 
+        call to wait the debugger to be attached to then continue 
+        the execution of the WebProcess. Unfortunately the pause()
+        function does not return unless a signal handler is called.
+        This patch introduce an event handler to exit from the paused
+        state when the debugger send the signal SIGCONT. The old code
+        works with older version of GDB (<7.0) but not with newer
+        versions where the behavior of pause() is correct.
+
+        * WebKitTestRunner/qt/main.cpp:
+        (sigcontHandler):
+        (main):
+
 2012-05-08  Christophe Dumez  <[email protected]>
 
         [EFL][DRT] EFL's DRT does not fully support page visibility

Modified: trunk/Tools/WebKitTestRunner/qt/main.cpp (116416 => 116417)


--- trunk/Tools/WebKitTestRunner/qt/main.cpp	2012-05-08 13:57:20 UTC (rev 116416)
+++ trunk/Tools/WebKitTestRunner/qt/main.cpp	2012-05-08 14:00:31 UTC (rev 116417)
@@ -31,6 +31,7 @@
 
 #include <stdio.h>
 #if !defined(NDEBUG) && defined(Q_OS_UNIX)
+#include <signal.h>
 #include <unistd.h>
 #endif
 
@@ -66,6 +67,12 @@
     char** m_argv;
 };
 
+#if !defined(NDEBUG) && defined(Q_OS_UNIX)
+static void sigcontHandler(int)
+{
+}
+#endif
+
 void messageHandler(QtMsgType type, const char* message)
 {
     if (type == QtCriticalMsg) {
@@ -80,8 +87,14 @@
 {
 #if !defined(NDEBUG) && defined(Q_OS_UNIX)
     if (qgetenv("QT_WEBKIT_PAUSE_UI_PROCESS") == "1") {
-        fprintf(stderr, "Pausing UI process, please attach to PID %d and continue... ", getpid());
+        struct sigaction newAction, oldAction;
+        newAction.sa_handler = sigcontHandler;
+        sigemptyset(&newAction.sa_mask);
+        newAction.sa_flags = 0;
+        sigaction(SIGCONT, &newAction, &oldAction);
+        fprintf(stderr, "Pausing UI process, please attach to PID %d and send signal SIGCONT... ", getpid());
         pause();
+        sigaction(SIGCONT, &oldAction, 0);
         fprintf(stderr, " OK\n");
     }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to