WebKitSite:
Update Windows debugging instructions
Reviewed by Mark Rowe.
* building/debug.html:
WebKitTools:
Make it easy to run Safari in the debugger on Windows
I've added a new script, debug-safari, which launches Safari in the
debugger. On OS X it just calls gdb-safari.
Reviewed by Mark Rowe.
* FindSafari/FindSafari.cpp:
(_tmain): Added a /debugger flag, which in combination with
/printSafariLauncher will print a script that launches Safari in the
debugger.
* Scripts/debug-safari: Added.
* Scripts/run-safari: Changed to call runSafari().
* Scripts/run-webkit-nightly.cmd: Prepends the launcher script with
vsvars32.bat, which will let us find VS/VC++ Express, and passes the
first argument along to FindSafari.
* Scripts/webkitdirs.pm:
(sub runSafari): Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27878
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-11-17 Adam Roben <aroben@apple.com>
+
+ Update Windows debugging instructions
+
+ Reviewed by Mark Rowe.
+
+ * building/debug.html:
+
2007-11-14 Brady Eidson <beidson@apple.com>
For future use
</div>
<div class="windows-instructions">
<h2>Debugging on Windows</h2>
-<p>
-You can launch the Visual Studio development environment with the following
-command:</p>
-<p class="code">devenv /debugexe Safari.exe [args to safari]</p>
-<p>The arguments to Safari should be the same ones that <tt>run-safari</tt> uses,
-namely the <tt>/frameworkPath</tt> switch (to point to the path at which the updated
-WebKit can be found) and <tt>debug</tt> if the WebKit you built is a debug version.</p>
+<p>To launch Safari in the Visual Studio or Visual C++ Express debugger, simply run:</p>
+<p class="code">debug-safari</p>
</div>
<?php
+2007-11-17 Adam Roben <aroben@apple.com>
+
+ Make it easy to run Safari in the debugger on Windows
+
+ I've added a new script, debug-safari, which launches Safari in the
+ debugger. On OS X it just calls gdb-safari.
+
+ Reviewed by Mark Rowe.
+
+ * FindSafari/FindSafari.cpp:
+ (_tmain): Added a /debugger flag, which in combination with
+ /printSafariLauncher will print a script that launches Safari in the
+ debugger.
+ * Scripts/debug-safari: Added.
+ * Scripts/run-safari: Changed to call runSafari().
+ * Scripts/run-webkit-nightly.cmd: Prepends the launcher script with
+ vsvars32.bat, which will let us find VS/VC++ Express, and passes the
+ first argument along to FindSafari.
+ * Scripts/webkitdirs.pm:
+ (sub runSafari): Added.
+
2007-11-16 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Adam Roben.
return 1;
}
- if (argc < 2 || _tcscmp(argv[1], TEXT("/printSafariLauncher"))) {
- _tprintf(TEXT("%s"), path);
+ bool printLauncher = false;
+ bool debugger = false;
+
+ for (int i = 1; i < argc; ++i) {
+ if (!_tcscmp(argv[i], TEXT("/printSafariLauncher"))) {
+ printLauncher = true;
+ continue;
+ }
+ if (!_tcscmp(argv[i], TEXT("/debugger"))) {
+ debugger = true;
+ continue;
+ }
+ }
+
+ if (!printLauncher) {
+ _tprintf(TEXT("%s\n"), path);
free(path);
return 0;
}
- TCHAR* lines[] = {
+ LPCTSTR lines[] = {
TEXT("@echo off"),
TEXT("mkdir 2>NUL \"%%TMP%%\\WebKitNightly\\Safari.resources\""),
TEXT("xcopy /y /i /d \"%sSafari.exe\" \"%%TMP%%\\WebKitNightly\""),
TEXT("xcopy /y /i /d /e \"%sSafari.resources\" \"%%TMP%%\\WebKitNightly\\Safari.resources\""),
TEXT("set PATH=\"%%CD%%;%s;%%PATH%%\""),
- TEXT("\"%%TMP%%\\WebKitNightly\\Safari.exe\" /customWebKit"),
+ };
+
+ LPCTSTR command = TEXT("\"%TMP%\\WebKitNightly\\Safari.exe\" /customWebKit");
+
+ LPCTSTR launchLines[] = {
+ TEXT("%s"),
+ };
+
+ LPCTSTR debuggerLines[] = {
+ TEXT("if exist \"%%DevEnvDir%%\\VCExpress.exe\" ("),
+ TEXT("\"%%DevEnvDir%%\\VCExpress.exe\" /debugExe %s"),
+ TEXT(") else ("),
+ TEXT("\"%%DevEnvDir%%\\devenv.exe\" /debugExe %s"),
+ TEXT(")"),
};
for (int i = 0; i < ARRAYSIZE(lines); ++i) {
_tprintf(TEXT("\n"));
}
+ LPCTSTR* endLines = debugger ? debuggerLines : launchLines;
+ for (unsigned i = 0; i < (debugger ? ARRAYSIZE(debuggerLines) : ARRAYSIZE(launchLines)); ++i) {
+ _tprintf(endLines[i], command);
+ _tprintf(TEXT("\n"));
+ }
+
free(path);
return 0;
}
--- /dev/null
+#!/usr/bin/perl -w
+
+# Copyright (C) 2007 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+# its contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# Script to run Safari in the platform's debugger for the WebKit Open Source Project.
+
+use strict;
+use FindBin;
+use lib $FindBin::Bin;
+use webkitdirs;
+
+setConfiguration();
+
+exit exitStatus(runSafari(1));
#!/usr/bin/perl -w
-# Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# Simplified "run" script for Web Kit Open Source Project.
use strict;
-use File::Temp qw/tempfile/;
use FindBin;
use lib $FindBin::Bin;
use webkitdirs;
setConfiguration();
-my $productDir = productDir();
-my $safariPath = safariPath();
# Check to see that all the frameworks are built.
checkFrameworks();
-# Set up DYLD_FRAMEWORK_PATH to point to the product directory.
-print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
-
-my @args;
-if (isOSX()) {
- $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
- $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
- @args = @ARGV;
-} elsif (isCygwin()) {
- my $script = "run-webkit-nightly.cmd";
- my $result = system "cp", "$FindBin::Bin/$script", $productDir;
- die if $result;
-
- chdir $productDir;
-
- $safariPath = "cmd";
- @args = ("/c", "call $script");
-}
-exec $safariPath, @args or die;
-
+exit exitStatus(runSafari());
@echo off
set script="%TMP%\run-webkit-nightly2.cmd"
-FindSafari.exe /printSafariLauncher > %script%
+set vsvars="%VS80COMNTOOLS%\vsvars32.bat"
+if exist %vsvars% (
+ copy %vsvars% "%script%"
+) else (
+ del "%script%"
+)
+FindSafari.exe %1 /printSafariLauncher >> "%script%"
call %script%
return WEXITSTATUS($returnvalue);
}
+sub runSafari
+{
+ my ($debugger) = @_;
+
+ if (isOSX()) {
+ return system "$FindBin::Bin/gdb-safari", @ARGV if $debugger;
+
+ my $productDir = productDir();
+ print "Starting Safari with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
+ $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
+ $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
+ return system safariPath(), @ARGV;
+ }
+
+ if (isCygwin()) {
+ my $script = "run-webkit-nightly.cmd";
+ my $result = system "cp", "$FindBin::Bin/$script", productDir();
+ return $result if $result;
+
+ my $cwd = getcwd();
+ chdir productDir();
+
+ my $debuggerFlag = $debugger ? "/debugger" : "";
+ $result = system "cmd", "/c", "call $script $debuggerFlag";
+ chdir $cwd;
+ return $result;
+ }
+
+ return 1;
+}
+
1;