Changeset 63917 in webkit


Ignore:
Timestamp:
Jul 22, 2010 3:18:50 PM (14 years ago)
Author:
andersca@apple.com
Message:

It should be possible to attach to the WebProcess in gdb during startup
https://bugs.webkit.org/show_bug.cgi?id=42853

Reviewed by Adam Roben.

Create an unique bootstrap service name and pass it to the web process, instead of registering a per process
name (which was incorrect anyway). This lets us get rid of the requirement that the UI process always should be
the parent process of the web process, something which is false when running under the debugger.

  • UIProcess/Launcher/mac/ProcessLauncherMac.mm:

(WebKit::ProcessLauncher::launchProcess):

  • WebProcess/mac/WebProcessMainMac.mm:

(WebKit::WebProcessMain):

Location:
trunk/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r63916 r63917  
     12010-07-22  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        It should be possible to attach to the WebProcess in gdb during startup
     6        https://bugs.webkit.org/show_bug.cgi?id=42853
     7
     8        Create an unique bootstrap service name and pass it to the web process, instead of registering a per process
     9        name (which was incorrect anyway). This lets us get rid of the requirement that the UI process always should be
     10        the parent process of the web process, something which is false when running under the debugger.
     11
     12        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
     13        (WebKit::ProcessLauncher::launchProcess):
     14        * WebProcess/mac/WebProcessMainMac.mm:
     15        (WebKit::WebProcessMain):
     16
    1172010-07-22  Anders Carlsson  <andersca@apple.com>
    218
  • trunk/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm

    r62471 r63917  
    2929#include "WebProcess.h"
    3030#include "WebSystemInterface.h"
    31 
     31#include <WebCore/PlatformString.h>
    3232#include <crt_externs.h>
    3333#include <runtime/InitializeThreading.h>
     
    3636#include <wtf/PassRefPtr.h>
    3737#include <wtf/Threading.h>
     38#include <wtf/text/CString.h>
     39
     40using namespace WebCore;
    3841
    3942// FIXME: We should be doing this another way.
     
    5457    NSString *webProcessAppExecutablePath = [[NSBundle bundleWithPath:webProcessAppPath] executablePath];
    5558
     59    // Make a unique, per pid, per process launcher web process service name.
     60    CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8();
     61
    5662    const char* path = [webProcessAppExecutablePath fileSystemRepresentation];
    57     const char* args[] = { path, "-mode", "legacywebprocess", 0 };
     63    const char* args[] = { path, "-mode", "legacywebprocess", "-servicename", serviceName.data(), 0 };
    5864
    5965    // Register ourselves.
    60     kern_return_t kr = bootstrap_register2(bootstrap_port, (char*)"com.apple.WebKit.WebProcess", listeningPort, /* BOOTSTRAP_PER_PID_SERVICE */ 1);
     66    kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0);
    6167    if (kr)
    6268        NSLog(@"bootstrap_register2 result: %x", kr);
  • trunk/WebKit2/WebProcess/mac/WebProcessMainMac.mm

    r63825 r63917  
    3939#import <unistd.h>
    4040#import <wtf/Threading.h>
     41#import <wtf/text/CString.h>
    4142
    4243#if ENABLE(WEB_PROCESS_SANDBOX)
     
    5354namespace WebKit {
    5455
    55 int WebProcessMain(CommandLine*)
     56int WebProcessMain(CommandLine* commandLine)
    5657{
    5758    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     
    6970#endif
    7071
     72    String serviceName = (*commandLine)["servicename"];
     73    if (serviceName.isEmpty())
     74        return EXIT_FAILURE;
     75
     76    // Get the server port.
    7177    mach_port_t serverPort;
    72     kern_return_t kr = bootstrap_look_up2(bootstrap_port, "com.apple.WebKit.WebProcess", &serverPort, getppid(), /* BOOTSTRAP_PER_PID_SERVICE */ 1);
     78    kern_return_t kr = bootstrap_look_up2(bootstrap_port, serviceName.utf8().data(), &serverPort, 0, 0);
    7379    if (kr) {
    7480        printf("bootstrap_look_up2 result: %x", kr);
Note: See TracChangeset for help on using the changeset viewer.