| <?php |
| $title = "Debugging WebKit"; |
| include("../header.inc"); |
| ?> |
| |
| <div class="mac-instructions"> |
| <h2>Debugging on OS X and iOS Simulator</h2> |
| <p>To debug from within Xcode, you can use the WebKit workspace. Ensure that the Products and Intermediates locations for the workspace match those used by <code>build-webkit</code> by choosing File > Workspace Settings and clicking the Advanced button, selecting Custom, Relative to Workspace, and entering WebKitBuild both for Products and for Intermediates. Note that if you have specified a custom build location in Xcode preferences, then you don’t need to do this.</p> |
| <h3>iOS Simulator</h3> |
| <h4>Debugging UIProcess or WebProcess</h4> |
| <ol> |
| <li><p><a href="run.html">Run Safari</a> with the WebKit version you built.</p></li> |
| <li> |
| <p>Execute <code>xcrun --sdk iphonesimulator lldb --attach-name MobileSafari</code> in the Terminal to debug the UIProcess.</p> |
| <p>Use <code>com.apple.WebKit.WebContent.Development</code> for the value of <code>--attach-name</code> to debug the WebProcess:</p> |
| <p class="code">xcrun --sdk iphonesimulator lldb --attach-name com.apple.WebKit.WebContent.Development</p> |
| </li> |
| </ol> |
| <h3>OS X</h3> |
| <h4>Internal Debug Menu</h4> |
| There is a Debug menu that can be enabled in Safari, and it supplies many useful options to help with debugging. To enable it, run the following in your terminal: |
| <code>defaults write com.apple.Safari IncludeInternalDebugMenu 1</code> |
| <h4>Debugging UIProcess</h4> |
| <p>Follow the instructions on the <a href="debug-mac-uiprocess.html">debugging UIProcess</a> page.</p> |
| <h4>Debugging WebProcess</h4> |
| <p>Current versions of Safari use a process for each tab, so it is easy to end up with a new WebProcess and have to reattach. If you enable the Internal Debug Menu as outlined above, you can have Safari display the Process ID of the WebProcess for each tab. Simply go to Debug > Miscellaneous Flags and select Show Web Process IDs In Page Titles. You should now see something like <code>[WP 60737]</code> in the title of every web page you navigate to, and 60737 is the Process ID of the WebProcess backing that tab.</p> |
| <ul> |
| <li> |
| <p>From the command line:</p> |
| <p>Execute the <code>debug-safari</code> or <code>debug-minibrowser</code> <a href="/coding/scripts.html">script</a> with the <code>--target-web-process</code> option. It will start the debugger with WebProcess as the target and with command-line arguments that will make WebProcess run Safari or MiniBrowser as its client. At the debugger prompt, enter <code>run</code> to start the process.</p> |
| </li> |
| <li> |
| <p>From Xcode:</p> |
| <p>Open the WebKit workspace and choose “All Source (target WebProcess)” from the Scheme pop-up menu in the toolbar, then choose Product > Run. If WebKit is already built, it is quicker to choose Product > Perform Action > Run Without Building</p> |
| </li> |
| </ul> |
| </div> |
| <div class="windows-instructions"> |
| <h2>Debugging on Windows</h2> |
| <ol> |
| <li><p>Open <code>Source/WebKit/WebKit.vcxproj/WebKit.sln</code></p> |
| <p>You can open it in either Visual Studio 2010, or Visual C++ Express 2010. |
| If you get errors about not being able to find <code>.props</code> files, run |
| update-webkit, then close and relaunch Cygwin and Visual Studio or Visual C++ |
| Express.</p> |
| </li> |
| <li><p>Set WinLauncher as the solution's StartUp project</p> |
| <p>Select the WinLauncher project in the Solution Explorer, then choose Project > |
| Set as StartUp Project. This will cause the project to turn bold in the |
| Solution Explorer.</p> |
| <img src="set-as-startup-project-vs2010.png"> |
| </li> |
| <li><p>Launch the debugger</p> |
| <p>Choose Debug > Start Debugging.</p> |
| <a href="launch-debugger-vs2010.png"><img src="launch-debugger-vs2010-small.png"></a> |
| <li><p>Alternatively, you can debug layout tests with DumpRenderTree</p> |
| <p>Set DumpRenderTreeLauncher as your startup project, set the layout test as a command argument, and launch the debugger.</p> |
| <p>In DumpRenderTreeLauncher's properties, go to Configuration Properties->Debugging and set the Command Arguments field to the full path of the layout test you want to debug, see below: </p> |
| <a href="set-debugging-properties-vs2010.png"><img src="set-debugging-properties-vs2010-small.png"></a> |
| </li> |
| </ol> |
| </div> |
| |
| <?php |
| include("../footer.inc"); |
| ?> |