| Version 1 (modified by mjs@apple.com, 21 months ago) (diff) |
|---|
Using Xcode on Mac:
Make sure “Use WebKit2 for New Windows” option is selected in the Debug menu of Safari. Open WebKit2.xcodeproj and make sure that the WebProcess is set to the Active Executable Control-click the WebProcess executable and choose Get Info. In the Debugging tab, select “Wait for next launch/push notification”. Choose Run > Debug. A dialog will appear saying that it is “Waiting for WebProcess to launch...” Open Safari.xcodeproj, Run > Debug. The WebProcess will break in the debugger and you will probably have to continue at least once before normal execution is resumed. You are now debugging both the UIProcess and the WebProcess, and your breakpoints in either should be hit accordingly. or: Open the Xcode projects for Safari and WebCore (or WebKit2, or whatever). From the Safari project, Run. From the WebCore project, choose Run > Attach to Process and choose the WebProcess. Wait for gdb to do its thing, and Continue. Now you’re debugging the WebProcess. [However, I've had lots of issues with gdb using this method.]
To prevent Safari from complaining about a web process hang when debugging:
Control-click the Safari executable and choose Get Info. Click the Arguments tab. Beneath the "Variables to be set in the environment" list, click the plus button. Add an item with name DebugInitialDelayForUnresponsiveWebProcess and value 99999999.
To debug a web process crash on launch:
Edit WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm Search for "SIGCONT", remove the line of code that sends the SIGCONT signal to the web process, and build. In Terminal launch gdb and type "attach WebProcess" OR in Xcode select Run->Attach to Process->Process ID... and type the WebProcess's process ID. Once attached, in gdb type "continue<enter>" OR in Xcode select Run->Continue.
Using Visual Studio 2005 on Windows:
Make sure the "Use WebKit2 for New Tabs" option is enabled in the Debug menu of Safari. Right after you tell Visual Studio to Run the version of Safari that you just built, hold down the Shift + Control + Alt keys. A dialog should pop up saying that you can now attach a debugger to the Web Process. Do not click OK yet. In Visual Studio select "Attach to Process ..." in the Debug Menu. In the window that comes up, select the "WebKit2WebProcess" with the title "WebKit2WebProcess has launched" and click Attach. Go back to the dialog from step 3 and click OK. You are now debugging both the UIProcess and the WebProcess, and your breakpoints in either should be hit accordingly. Alternatively, you can add a VS Toolbar Item to attach to the WebProcess.