⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 121122 in webkit


Ignore:
Timestamp:
Jun 24, 2012, 4:07:31 PM (14 years ago)
Author:
mitz@apple.com
Message:

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.

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r121118 r121122  
     12012-06-24  Dan Bernstein  <mitz@apple.com>
     2
     3        Made debug-{minibrowser,safari,test-runner} work with LLDB.
     4
     5        Reviewed by Sam Weinig.
     6
     7        * Scripts/debug-minibrowser: Pass INCLUDE_OPTIONS_FOR_DEBUGGING to
     8        printHelpAndExitForRunAndDebugWebKitAppIfNeeded().
     9        * Scripts/debug-safari: Ditto.
     10        * Scripts/debug-test-runner: Ditto.
     11        * Scripts/webkitdirs.pm:
     12        (debugger): Added. Calls determineDebugger() if needed and returns the chosen debugger.
     13        (determineDebugger): Added. Sets the debugger to "lldb" if the --use-lldb switch is present,
     14        and to "gdb" otherwise.
     15        (printHelpAndExitForRunAndDebugWebKitAppIfNeeded): Changed to print help for the
     16        --target-web-process and --use-lldb switches if passed INCLUDE_OPTIONS_FOR_DEBUGGING.
     17        (execMacWebKitAppForDebugging): Changed to use the chosen debugger.
     18
    1192012-06-24  Adam Barth  <abarth@webkit.org>
    220
  • trunk/Tools/Scripts/debug-minibrowser

    r103640 r121122  
    3434use webkitdirs;
    3535
    36 printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
     36printHelpAndExitForRunAndDebugWebKitAppIfNeeded(INCLUDE_OPTIONS_FOR_DEBUGGING);
    3737
    3838setConfiguration();
  • trunk/Tools/Scripts/debug-safari

    r103640 r121122  
    3434use webkitdirs;
    3535
    36 printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
     36printHelpAndExitForRunAndDebugWebKitAppIfNeeded(INCLUDE_OPTIONS_FOR_DEBUGGING);
    3737
    3838setConfiguration();
  • trunk/Tools/Scripts/debug-test-runner

    r103640 r121122  
    3131use webkitdirs;
    3232
    33 printHelpAndExitForRunAndDebugWebKitAppIfNeeded();
     33printHelpAndExitForRunAndDebugWebKitAppIfNeeded(INCLUDE_OPTIONS_FOR_DEBUGGING);
    3434
    3535setConfiguration();
  • trunk/Tools/Scripts/webkitdirs.pm

    r121104 r121122  
    7272
    7373use constant USE_OPEN_COMMAND => 1; # Used in runMacWebKitApp().
     74use constant INCLUDE_OPTIONS_FOR_DEBUGGING => 1;
    7475
    7576our @EXPORT_OK;
     
    8485my $sourceDir;
    8586my $currentSVNRevision;
     87my $debugger;
    8688my $nmPath;
    8789my $osXVersion;
     
    14031405}
    14041406
     1407sub debugger
     1408{
     1409    determineDebugger();
     1410    return $debugger;
     1411}
     1412
     1413sub determineDebugger
     1414{
     1415    return if defined($debugger);
     1416    if (checkForArgumentAndRemoveFromARGV("--use-lldb")) {
     1417        $debugger = "lldb";
     1418    } else {
     1419        $debugger = "gdb";
     1420    }
     1421}
     1422
    14051423sub appendToEnvironmentVariableList
    14061424{
     
    25982616}
    25992617
    2600 sub printHelpAndExitForRunAndDebugWebKitAppIfNeeded()
     2618sub printHelpAndExitForRunAndDebugWebKitAppIfNeeded
    26012619{
    26022620    return unless checkForArgumentAndRemoveFromARGV("--help");
     2621
     2622    my ($includeOptionsForDebugging) = @_;
     2623
    26032624    print STDERR <<EOF;
    26042625Usage: @{[basename($0)]} [options] [args ...]
     
    26072628  --guard-malloc        Enable Guard Malloc (Mac OS X only)
    26082629EOF
     2630
     2631    if ($includeOptionsForDebugging) {
     2632        print STDERR <<EOF;
     2633  --target-web-process  Debug the web process
     2634  --use-lldb            Use LLDB
     2635EOF
     2636    }
     2637
    26092638    exit(1);
    26102639}
     
    26392668{
    26402669    my ($appPath) = @_;
    2641 
    2642     my $gdbPath = `xcrun -find gdb`;
    2643     chomp $gdbPath;
    2644     die "Can't find gdb executable. Is gdb installed?\n" unless -x $gdbPath;
     2670    my $architectureSwitch;
     2671    my $argumentsSeparator;
     2672
     2673    if (debugger() eq "lldb") {
     2674        $architectureSwitch = "--arch";
     2675        $argumentsSeparator = "--";
     2676    } elsif (debugger() eq "gdb") {
     2677        $architectureSwitch = "-arch";
     2678        $argumentsSeparator = "--args";
     2679    } else {
     2680        die "Unknown debugger $debugger.\n";
     2681    }
     2682
     2683    my $debuggerPath = `xcrun -find $debugger`;
     2684    chomp $debuggerPath;
     2685    die "Can't find the $debugger executable.\n" unless -x $debuggerPath;
    26452686
    26462687    my $productDir = productDir();
     
    26502691    setUpGuardMallocIfNeeded();
    26512692
    2652     my @architectureFlags = ("-arch", architecture());
     2693    my @architectureFlags = ($architectureSwitch, architecture());
    26532694    if (!shouldTargetWebProcess()) {
    2654         print "Starting @{[basename($appPath)]} under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
    2655         exec { $gdbPath } $gdbPath, @architectureFlags, "--args", $appPath, argumentsForRunAndDebugMacWebKitApp() or die;
     2695        print "Starting @{[basename($appPath)]} under $debugger with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
     2696        exec { $debuggerPath } $debuggerPath, @architectureFlags, $argumentsSeparator, $appPath, argumentsForRunAndDebugMacWebKitApp() or die;
    26562697    } else {
    26572698        my $webProcessShimPath = File::Spec->catfile($productDir, "WebProcessShim.dylib");
     
    26612702        appendToEnvironmentVariableList("DYLD_INSERT_LIBRARIES", $webProcessShimPath);
    26622703
    2663         print "Starting WebProcess under gdb with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
    2664         exec { $gdbPath } $gdbPath, @architectureFlags, "--args", $webProcessPath, $webKit2ExecutablePath, "-type", "webprocess", "-client-executable", $appPath or die;
     2704        print "Starting WebProcess under $debugger with DYLD_FRAMEWORK_PATH set to point to built WebKit in $productDir.\n";
     2705        exec { $debuggerPath } $debuggerPath, @architectureFlags, $argumentsSeparator, $webProcessPath, $webKit2ExecutablePath, "-type", "webprocess", "-client-executable", $appPath or die;
    26652706    }
    26662707}
Note: See TracChangeset for help on using the changeset viewer.