Changeset 116417 in webkit


Ignore:
Timestamp:
May 8, 2012 7:00:31 AM (12 years ago)
Author:
alexis.menard@openbossa.org
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):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r116371 r116417  
     12012-05-07  Alexis Menard  <alexis.menard@openbossa.org>
     2
     3        [Qt] Unbreak debugging of WebKit2.
     4        https://bugs.webkit.org/show_bug.cgi?id=85839
     5
     6        Reviewed by Simon Hausmann.
     7
     8        When you attach GDB to a running process, it stops it.
     9        http://trac.webkit.org/changeset/115958 introduced a pause()
     10        call to wait the debugger to be attached to then continue
     11        the execution of the WebProcess. Unfortunately the pause()
     12        function does not return unless a signal handler is called.
     13        This patch introduce an event handler to exit from the paused
     14        state when the debugger send the signal SIGCONT. The old code
     15        works with older version of GDB (<7.0) but not with newer
     16        versions where the behavior of pause() is correct.
     17
     18        * qt/MainQt.cpp:
     19        (sigcontHandler):
     20        (main):
     21
    1222012-05-07  Julien Chaffraix  <jchaffraix@webkit.org>
    223
  • trunk/Source/WebKit2/qt/MainQt.cpp

    r116352 r116417  
    2929#include <stdio.h>
    3030#if !defined(NDEBUG) && defined(Q_OS_UNIX)
     31#include <signal.h>
    3132#include <unistd.h>
    3233#endif
     
    3637Q_DECL_IMPORT void initializeWebKit2Theme();
    3738}
     39
     40#if !defined(NDEBUG) && defined(Q_OS_UNIX)
     41static void sigcontHandler(int)
     42{
     43}
     44#endif
    3845
    3946static void messageHandler(QtMsgType type, const char* message)
     
    5461#if !defined(NDEBUG) && defined(Q_OS_UNIX)
    5562    if (qgetenv("QT_WEBKIT_PAUSE_WEB_PROCESS") == "1" || qgetenv("QT_WEBKIT2_DEBUG") == "1") {
    56         fprintf(stderr, "Pausing web process, please attach to PID %d and continue... ", getpid());
     63        struct sigaction newAction, oldAction;
     64        newAction.sa_handler = sigcontHandler;
     65        sigemptyset(&newAction.sa_mask);
     66        newAction.sa_flags = 0;
     67        sigaction(SIGCONT, &newAction, &oldAction);
     68        fprintf(stderr, "Pausing UI process, please attach to PID %d and send signal SIGCONT... ", getpid());
    5769        pause();
     70        sigaction(SIGCONT, &oldAction, 0);
    5871        fprintf(stderr, " OK\n");
    5972    }
  • trunk/Tools/ChangeLog

    r116416 r116417  
     12012-05-07  Alexis Menard  <alexis.menard@openbossa.org>
     2
     3        [Qt] Unbreak debugging of WebKit2.
     4        https://bugs.webkit.org/show_bug.cgi?id=85839
     5
     6        Reviewed by Simon Hausmann.
     7
     8        When you attach GDB to a running process, it stops it.
     9        http://trac.webkit.org/changeset/115958 introduced a pause()
     10        call to wait the debugger to be attached to then continue
     11        the execution of the WebProcess. Unfortunately the pause()
     12        function does not return unless a signal handler is called.
     13        This patch introduce an event handler to exit from the paused
     14        state when the debugger send the signal SIGCONT. The old code
     15        works with older version of GDB (<7.0) but not with newer
     16        versions where the behavior of pause() is correct.
     17
     18        * WebKitTestRunner/qt/main.cpp:
     19        (sigcontHandler):
     20        (main):
     21
    1222012-05-08  Christophe Dumez  <christophe.dumez@intel.com>
    223
  • trunk/Tools/WebKitTestRunner/qt/main.cpp

    r116352 r116417  
    3232#include <stdio.h>
    3333#if !defined(NDEBUG) && defined(Q_OS_UNIX)
     34#include <signal.h>
    3435#include <unistd.h>
    3536#endif
     
    6768};
    6869
     70#if !defined(NDEBUG) && defined(Q_OS_UNIX)
     71static void sigcontHandler(int)
     72{
     73}
     74#endif
     75
    6976void messageHandler(QtMsgType type, const char* message)
    7077{
     
    8188#if !defined(NDEBUG) && defined(Q_OS_UNIX)
    8289    if (qgetenv("QT_WEBKIT_PAUSE_UI_PROCESS") == "1") {
    83         fprintf(stderr, "Pausing UI process, please attach to PID %d and continue... ", getpid());
     90        struct sigaction newAction, oldAction;
     91        newAction.sa_handler = sigcontHandler;
     92        sigemptyset(&newAction.sa_mask);
     93        newAction.sa_flags = 0;
     94        sigaction(SIGCONT, &newAction, &oldAction);
     95        fprintf(stderr, "Pausing UI process, please attach to PID %d and send signal SIGCONT... ", getpid());
    8496        pause();
     97        sigaction(SIGCONT, &oldAction, 0);
    8598        fprintf(stderr, " OK\n");
    8699    }
Note: See TracChangeset for help on using the changeset viewer.