Modified: trunk/Tools/ChangeLog (121121 => 121122)
--- trunk/Tools/ChangeLog 2012-06-24 21:44:47 UTC (rev 121121)
+++ trunk/Tools/ChangeLog 2012-06-24 23:07:31 UTC (rev 121122)
@@ -1,3 +1,21 @@
+2012-06-24 Dan Bernstein <[email protected]>
+
+ Made debug-{minibrowser,safari,test-runner} work with LLDB.
+
+ Reviewed by Sam Weinig.
+
+ * Scripts/debug-minibrowser: Pass INCLUDE_OPTIONS_FOR_DEBUGGING to
+ printHelpAndExitForRunAndDebugWebKitAppIfNeeded().
+ * Scripts/debug-safari: Ditto.
+ * Scripts/debug-test-runner: Ditto.
+ * Scripts/webkitdirs.pm:
+ (debugger): Added. Calls determineDebugger() if needed and returns the chosen debugger.
+ (determineDebugger): Added. Sets the debugger to "lldb" if the --use-lldb switch is present,
+ and to "gdb" otherwise.
+ (printHelpAndExitForRunAndDebugWebKitAppIfNeeded): Changed to print help for the
+ --target-web-process and --use-lldb switches if passed INCLUDE_OPTIONS_FOR_DEBUGGING.
+ (execMacWebKitAppForDebugging): Changed to use the chosen debugger.
+
2012-06-24 Adam Barth <[email protected]>
[Chromium] Release media resources after each LayoutTest on Android
Modified: trunk/Tools/Scripts/debug-minibrowser (121121 => 121122)
--- trunk/Tools/Scripts/debug-minibrowser 2012-06-24 21:44:47 UTC (rev 121121)
+++ trunk/Tools/Scripts/debug-minibrowser 2012-06-24 23:07:31 UTC (rev 121122)
@@ -33,7 +33,7 @@
use lib $FindBin::Bin;
use webkitdirs;
-printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded(INCLUDE_OPTIONS_FOR_DEBUGGING);
setConfiguration();
Modified: trunk/Tools/Scripts/debug-safari (121121 => 121122)
--- trunk/Tools/Scripts/debug-safari 2012-06-24 21:44:47 UTC (rev 121121)
+++ trunk/Tools/Scripts/debug-safari 2012-06-24 23:07:31 UTC (rev 121122)
@@ -33,7 +33,7 @@
use lib $FindBin::Bin;
use webkitdirs;
-printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded(INCLUDE_OPTIONS_FOR_DEBUGGING);
setConfiguration();
Modified: trunk/Tools/Scripts/debug-test-runner (121121 => 121122)
--- trunk/Tools/Scripts/debug-test-runner 2012-06-24 21:44:47 UTC (rev 121121)
+++ trunk/Tools/Scripts/debug-test-runner 2012-06-24 23:07:31 UTC (rev 121122)
@@ -30,7 +30,7 @@
use lib $FindBin::Bin;
use webkitdirs;
-printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
+printHelpAndExitForRunAndDebugWebKitAppIfNeeded(INCLUDE_OPTIONS_FOR_DEBUGGING);
setConfiguration();
Modified: trunk/Tools/Scripts/webkitdirs.pm (121121 => 121122)
--- trunk/Tools/Scripts/webkitdirs.pm 2012-06-24 21:44:47 UTC (rev 121121)
+++ trunk/Tools/Scripts/webkitdirs.pm 2012-06-24 23:07:31 UTC (rev 121122)
@@ -71,6 +71,7 @@
}
use constant USE_OPEN_COMMAND => 1; # Used in runMacWebKitApp().
+use constant INCLUDE_OPTIONS_FOR_DEBUGGING => 1;
our @EXPORT_OK;
@@ -83,6 +84,7 @@
my $configurationProductDir;
my $sourceDir;
my $currentSVNRevision;
+my $debugger;
my $nmPath;
my $osXVersion;
my $generateDsym;
@@ -1402,6 +1404,22 @@
$shouldTargetWebProcess = checkForArgumentAndRemoveFromARGV("--target-web-process");
}
+sub debugger
+{
+ determineDebugger();
+ return $debugger;
+}
+
+sub determineDebugger
+{
+ return if defined($debugger);
+ if (checkForArgumentAndRemoveFromARGV("--use-lldb")) {
+ $debugger = "lldb";
+ } else {
+ $debugger = "gdb";
+ }
+}
+
sub appendToEnvironmentVariableList
{
my ($environmentVariableName, $value) = @_;
@@ -2597,15 +2615,26 @@
}
}
-sub printHelpAndExitForRunAndDebugWebKitAppIfNeeded()
+sub printHelpAndExitForRunAndDebugWebKitAppIfNeeded
{
return unless checkForArgumentAndRemoveFromARGV("--help");
+
+ my ($includeOptionsForDebugging) = @_;
+
print STDERR <<EOF;
Usage: @{[basename($0)]} [options] [args ...]
--help Show this help message
--no-saved-state Disable application resume for the session on Mac OS 10.7
--guard-malloc Enable Guard Malloc (Mac OS X only)
EOF
+
+ if ($includeOptionsForDebugging) {
+ print STDERR <<EOF;
+ --target-web-process Debug the web process
+ --use-lldb Use LLDB
+EOF
+ }
+
exit(1);
}
@@ -2638,21 +2667,33 @@
sub execMacWebKitAppForDebugging($)
{
my ($appPath) = @_;
+ my $architectureSwitch;
+ my $argumentsSeparator;
- my $gdbPath = `xcrun -find gdb`;
- chomp $gdbPath;
- die "Can't find gdb executable. Is gdb installed?\n" unless -x $gdbPath;
+ if (debugger() eq "lldb") {
+ $architectureSwitch = "--arch";
+ $argumentsSeparator = "--";
+ } elsif (debugger() eq "gdb") {
+ $architectureSwitch = "-arch";
+ $argumentsSeparator = "--args";
+ } else {
+ die "Unknown debugger $debugger.\n";
+ }
+ my $debuggerPath = `xcrun -find $debugger`;
+ chomp $debuggerPath;
+ die "Can't find the $debugger executable.\n" unless -x $debuggerPath;
+
my $productDir = productDir();
$ENV{DYLD_FRAMEWORK_PATH} = $productDir;
$ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
setUpGuardMallocIfNeeded();
- my @architectureFlags = ("-arch", architecture());
+ my @architectureFlags = ($architectureSwitch, architecture());
if (!shouldTargetWebProcess()) {
- print "Starting @{[basename($appPath)]} under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
- exec { $gdbPath } $gdbPath, @architectureFlags, "--args", $appPath, argumentsForRunAndDebugMacWebKitApp() or die;
+ print "Starting @{[basename($appPath)]} under $debugger with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
+ exec { $debuggerPath } $debuggerPath, @architectureFlags, $argumentsSeparator, $appPath, argumentsForRunAndDebugMacWebKitApp() or die;
} else {
my $webProcessShimPath = File::Spec->catfile($productDir, "WebProcessShim.dylib");
my $webProcessPath = File::Spec->catdir($productDir, "WebProcess.app");
@@ -2660,8 +2701,8 @@
appendToEnvironmentVariableList("DYLD_INSERT_LIBRARIES", $webProcessShimPath);
- print "Starting WebProcess under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
- exec { $gdbPath } $gdbPath, @architectureFlags, "--args", $webProcessPath, $webKit2ExecutablePath, "-type", "webprocess", "-client-executable", $appPath or die;
+ print "Starting WebProcess under $debugger with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
+ exec { $debuggerPath } $debuggerPath, @architectureFlags, $argumentsSeparator, $webProcessPath, $webKit2ExecutablePath, "-type", "webprocess", "-client-executable", $appPath or die;
}
}