blob: c27269d6e5df0744f6f9506243407374af74f428 [file] [log] [blame]
$title = "Debugging WebKit";
<div class="mac-instructions">
<h2>Debugging on Mac OS X</h2>
<li><p>Open a project</p>
<p>Each WebKit component -- JavaScriptCore, WebCore, and WebKit -- contains its own Xcode project. Open the project belonging to the component you want to debug.</p>
<li><p>Set the project's build products location</p>
<p>To find the WebKit you built, Xcode needs to know the build products location that <tt>build-webkit</tt> used. You can set the build products location from the project's Info window.</p>
<img src="info-tab.png">
<li><p>Set the project's active build configuration</p>
<p>Xcode also needs to know the build configuration you used. You can set the active build configuration from the project's Build window.</p>
<img src="build-window.png">
<li><p>Add a custom executable to the project</p>
<p>Choose any WebKit application you want to use for debugging. To use Safari, select /Applications/</p>
<img src="custom-executable.png">
<li><p>Set the project's active executable</p>
<p>You can set the active executable from the project's Build window. Choose the executable you just added.</p>
<li><p>Close and re-open the project</p>
<p>This will force Xcode to discover generated source files, which output to your build products location, allowing you to set breakpoints in them.</p>
<li><p>Launch the debugger</p>
<p>In the Debugger window, click the "Debug" button.</p>
<img src="debug.png">
<div class="windows-instructions">
<h2>Debugging on Windows</h2>
<p>To launch Safari in the Visual Studio or Visual C++ Express debugger, simply run:</p>
<p class="code">debug-safari</p>
<p>This command will launch the Visual Studio debugging environment, and attach to Safari connected to the debug build of WebKit.dll. There are a few things to keep in mind:
<li>The instance of Safari is not running yet. You must press the F5 key (or the 'Run' button) to see anything happen.</li>
<li>If you want to set any breakpoints, you must navigate to the particular source file you wish to investigate using the "File|Open" menu.</li>
<li><p>If you want to see the helpful output debug messages, you should edit the debug settings for the Safari solution (i.e., the pseudo-project created when the debugger attached to Safari):</p>
<img src="debug_vs2005.jpg">
<p>You should consider including the command-line switch '<span class="code">/console</span>'. This causes Safari to run with an open DOS shell in which output messages, created with the <span class="code">LOG</span> macro, appear.</p>
<img src="console_vs2005.jpg"></li>