Bug 68499 - Extract common gdb code into its own function; Remove script gdb-safari
Summary: Extract common gdb code into its own function; Remove script gdb-safari
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-20 20:17 PDT by Daniel Bates
Modified: 2011-10-15 12:33 PDT (History)
3 users (show)

See Also:


Attachments
Patch (9.37 KB, patch)
2011-09-20 20:38 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (8.78 KB, patch)
2011-10-09 20:55 PDT, Daniel Bates
ddkilzer: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2011-09-20 20:17:30 PDT
Duplicate code is used in webkitdirs::{debugMiniBrowser, debugWebKitTestRunner, runSafari}() and in the script gdb-safari to launch gdb to debug an application. Instead of duplicating code we should extract the common code into a function.

Moreover, I propose removing the script gdb-safari since it's functionality can be folded into the functionality afforded by debug-safari.

For completeness, gdb-safari was added in changeset 9395 <http://trac.webkit.org/changeset/9395> and debug-safari was added in changeset 27878 <http://trac.webkit.org/changeset/27878>.
Comment 1 Daniel Bates 2011-09-20 20:38:59 PDT
Created attachment 108105 [details]
Patch
Comment 2 Mark Rowe (bdash) 2011-09-21 00:27:10 PDT
Please don’t delete gdb-safari without first giving webkit-dev advance notice. I’m sure that many people use it and would like to be aware of the change before it happens.
Comment 3 Daniel Bates 2011-09-21 11:33:11 PDT
(In reply to comment #2)
> Please don’t delete gdb-safari without first giving webkit-dev advance notice. I’m sure that many people use it and would like to be aware of the change before it happens.

<https://lists.webkit.org/pipermail/webkit-dev/2011-September/018021.html>
Comment 4 Daniel Bates 2011-10-05 01:07:33 PDT
Comment on attachment 108105 [details]
Patch

Clearing review flag as this patch no longer applies. Will rebase patch.
Comment 5 Daniel Bates 2011-10-09 20:55:33 PDT
Created attachment 110321 [details]
Patch

I also changed in runSafari():

my $webKitLauncherPath = File::Spec->catfile(productDir(), "WebKit.exe");
$result = system { $webKitLauncherPath } $webKitLauncherPath, @ARGV;
return $result if $result;

To:

my $webKitLauncherPath = File::Spec->catfile(productDir(), "WebKit.exe");
return system { $webKitLauncherPath } $webKitLauncherPath, @ARGV;

since the former would implicitly return undef if $result was 0 and undef has a truth value that is equivalent to 0.
Comment 6 David Kilzer (:ddkilzer) 2011-10-14 11:34:38 PDT
Comment on attachment 110321 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=110321&action=review

r=me

> Tools/Scripts/webkitdirs.pm:2067
> +        return system { $vcBuildPath } $vcBuildPath, "/debugexe", "\"$safariPath\"", @ARGV;

This returns a different value on success (e.g., when system() returns 0) than runSafari() does, but I think that's okay since it's wrapped by exitStatus() in its new use.

> Tools/Scripts/webkitdirs.pm:2084
> +        return system { $webKitLauncherPath } $webKitLauncherPath, @ARGV;

This change causes the method to return 0 instead 1 when system() returns 0 on Windows.  This also seems fine since runSafari() is only used (from a quick grep) in the run-safari script, and that is also wrapped by exitStatus().

> Tools/Scripts/webkitdirs.pm:2102
> +        debugMacWebKitApp(File::Spec->catfile(productDir(), "MiniBrowser.app", "Contents", "MacOS", "MiniBrowser")); # This call never returns.

Nit: Might be nice to think of a name for debugMacWebKitApp() that removes the need for the comment.  Like execMacWebKitAppForDebugging()?

Not necessary to land the patch, though.

> Tools/Scripts/webkitdirs.pm:2127
> +        debugMacWebKitApp(File::Spec->catfile(productDir(), "WebKitTestRunner")); # This call never returns.

Ditto.
Comment 7 Daniel Bates 2011-10-15 12:13:32 PDT
(In reply to comment #6)
> (From update of attachment 110321 [details])
> 
> > Tools/Scripts/webkitdirs.pm:2102
> > +        debugMacWebKitApp(File::Spec->catfile(productDir(), "MiniBrowser.app", "Contents", "MacOS", "MiniBrowser")); # This call never returns.
> 
> Nit: Might be nice to think of a name for debugMacWebKitApp() that removes the need for the comment.  Like execMacWebKitAppForDebugging()?

Will rename debugMacWebKitApp() to execMacWebKitAppForDebugging() since execMacWebKitAppForDebugging() better describes the behavior of this function.
Comment 8 Daniel Bates 2011-10-15 12:33:36 PDT
Committed r97562: <http://trac.webkit.org/changeset/97562>