Changes between Initial Version and Version 1 of Debugging With Xcode


Ignore:
Timestamp:
Mar 2, 2014 6:15:10 PM (10 years ago)
Author:
BJ Burg
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Debugging With Xcode

    v1 v1  
     1 * [https://developer.apple.com/library/mac/documentation/ToolsLanguages/Conceptual/Xcode_Overview/About_Xcode/about.html#//apple_ref/doc/uid/TP40010215-CH3-SW1 General information on using Xcode]
     2
     3= Debugging WebKit2 =
     4
     5== Method #1 ==
     6
     7 1. Make sure '''Use WebKit2 for New Windows''' option is selected in Safari’s '''Debug'''
     8 2. Open `WebKit2.xcodeproj` and make sure that the WebProcess is set to the Active Executable
     9 3. Control-click the `WebProcess` executable and choose '''Get Info'''
     10 4. In the Debugging tab, select '''Wait for next launch/push notification'''
     11 5. Choose '''Run ► Debug'''
     12 6. A dialog will appear saying: “Waiting for WebProcess to launch…”
     13 7. Open `Safari.xcodeproj` '''Run ► Debug'''
     14 8. The WebProcess will break in the debugger, and you’ll probably have to continue at least once before normal execution resumes
     15
     16You’re now debugging both the `UIProcess` and the `WebProcess`. Your breakpoints in either should be work accordingly.
     17
     18
     19== Method #2 ==
     20
     21 1. Open the Xcode projects for Safari and WebCore (or WebKit2, or whatever)
     22 2. From the Safari project, '''Run'''
     23 3. From the WebCore project, choose '''Run ► Attach to Process''', and choose the `WebProcess`
     24 4. Let `gdb` do its thing, and Continue
     25
     26You’re now debugging the `WebProcess`.  ''('''Note:''' I've had issues with `gdb` using this method.)''
     27
     28
     29= Debugging DumpRenderTree =
     30
     31= Debugging WebKitTestRunner =
     32
     33== Prevent Safari from complaining about web process hangs when debugging ==
     34
     35 1. Control-click the Safari executable and choose '''Get Info'''
     36 2. Select the '''Arguments''' tab
     37 3. Beneath the list '''Variables to be set in the environment''', click the “`✚`” button
     38 4. Add the following item:
     39  * '''Name:''' `DebugInitialDelayForUnresponsiveWebProcess`
     40  * '''Value:''' `99999999`
     41
     42== To debug a web process crash on launch: ==
     43
     44 1. Edit `WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm`
     45 2. Search for `SIGCONT`
     46 3. Remove the line of code that sends `SIGCONT` to the web process, then build
     47 4. In Terminal:
     48  a. launch `gdb`, then type `attach WebProcess` — OR
     49  b. in Xcode select '''Run  ► Attach to Process  ► Process ID...''' and type the WebProcess’s process ID
     50 5. Once attached:
     51  a. In `gdb` type `continue«enter»` — OR
     52  b. In Xcode select '''Run ► Continue'''
     53
     54== To debug a web process using Instruments/DTrace: ==
     55
     56If you’re having trouble attaching to the WebProcess, try disabling the sandbox:
     57
     58{{{defaults write com.apple.WebProcess DisableSandbox YES}}}