Bug 86287 - run-safari and co. should support --guard-malloc command line argument
Summary: run-safari and co. should support --guard-malloc command line argument
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: Tim Horton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-12 02:18 PDT by Tim Horton
Modified: 2012-05-12 11:08 PDT (History)
1 user (show)

See Also:


Attachments
patch (3.28 KB, patch)
2012-05-12 02:24 PDT, Tim Horton
no flags Details | Formatted Diff | Diff
patch + mitzification (4.35 KB, patch)
2012-05-12 10:46 PDT, Tim Horton
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2012-05-12 02:18:40 PDT
run-webkit-tests supports the argument --guard-malloc on OS X to inject libgmalloc into Safari/WebProcess.

run-safari and debug-safari and friends should support this as well, for convenience.

I have a patch.
Comment 1 Tim Horton 2012-05-12 02:24:04 PDT
Created attachment 141563 [details]
patch

If need be (if whoever reviews this wants) we can make a gdb script that we call (-x) that turns gmalloc on only for the child process and not for gdb itself. It's kind of annoying that there doesn't seem to be a way to hand it commands right on the command line...
Comment 2 mitz 2012-05-12 09:51:48 PDT
Comment on attachment 141563 [details]
patch

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

> Tools/Scripts/webkitdirs.pm:1387
> +sub setupGuardMallocIfNeeded

This should use the verb “set up” and therefore a capital U.

> Tools/Scripts/webkitdirs.pm:1398
> +        $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib";

This will get overwritten by
    $ENV{DYLD_INSERT_LIBRARIES} = $webProcessShimPath;
in the shouldTargetWebProcess() branch of execMacWebKitAppForDebugging(). Please change that function so that it will work with the new option.
Comment 3 Tim Horton 2012-05-12 10:46:05 PDT
Created attachment 141583 [details]
patch + mitzification
Comment 4 mitz 2012-05-12 10:57:18 PDT
Comment on attachment 141583 [details]
patch + mitzification

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

> Tools/Scripts/webkitdirs.pm:2514
> +  --guard-malloc        Enable malloc guard (Mac OS X only)

I’ve never seen this called “malloc guard”. Is this what it’s called in run-webkit-tests? The man pages seem to call it Guard Malloc.
Comment 5 Tim Horton 2012-05-12 10:57:53 PDT
(In reply to comment #4)
> (From update of attachment 141583 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=141583&action=review
> 
> > Tools/Scripts/webkitdirs.pm:2514
> > +  --guard-malloc        Enable malloc guard (Mac OS X only)
> 
> I’ve never seen this called “malloc guard”. Is this what it’s called in run-webkit-tests? The man pages seem to call it Guard Malloc.

I stole the help message from run-webkit-tests, I agree it sounds a little weird. Maybe we should change it in both places?
Comment 6 mitz 2012-05-12 11:06:47 PDT
> I stole the help message from run-webkit-tests, I agree it sounds a little weird. Maybe we should change it in both places?

Good idea.
Comment 7 Tim Horton 2012-05-12 11:08:33 PDT
Landed in http://trac.webkit.org/changeset/116859

Thanks, Dan!