[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

aroben at apple.com aroben at apple.com
Wed Dec 22 12:14:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 69f81bc35f0bc7389bcf208b7895a3695826d12a
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 17 20:45:10 2010 +0000

    Teach run-webkit-tests, DumpRenderTree, and WebKitTestRunner how to save crash logs on Windows
    
    The crash logs are saved to /tmp/layout-test-results and have names
    like CrashLog_02bc_2010-08-17_14-36-20-108.txt.
    
    Unfortunately, crashes in the WebKit2 web process are recorded as
    time-outs by run-webkit-tests. Fixing this is covered by
    <http://webkit.org/b/44121>.
    
    Fixes <http://webkit.org/b/37859> <rdar://problem/7883560>
    DumpRenderTree should save a stack trace and/or dump file when it
    crashes
    
    Reviewed by Sam Weinig.
    
    * DumpRenderTree/win/DumpRenderTree.cpp:
    (exceptionFilter):
    (main):
    * WebKitTestRunner/win/TestControllerWin.cpp:
    (WTR::exceptionFilter):
    (WTR::TestController::platformInitialize):
    These changes set up an exception filter that prints #CRASHED to
    stderr, then lets the exception propagate normally. This allows
    run-webkit-tests to detect when we've crashed even when a post-mortem
    debugger attaches to the process.
    
    * Scripts/old-run-webkit-tests:
    (top level): Declared some variables used by the crash-log-saving
    code.
    (openDumpTool): Copy _NT_SYMBOL_PATH into the clean environment so
    that the post-mortem debugger has access to it.
    (toCygwinPath): Added. This is the opposite of toWindowsPath.
    (readFromDumpToolWithTimer): If the dump tool prints #CRASHED to
    stderr, consider it a crash.
    (setUpWindowsCrashLogSaving): Added. Saves the current post-mortem
    debugger, then sets ntsd as the post-mortem debugger. ntsd is
    configured to save a crash log and then quit automatically.
    (END): Added. Restores the previous post-mortem debugger when the
    script exits.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65537 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 8103a86..dd744db 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,46 @@
+2010-08-17  Adam Roben  <aroben at apple.com>
+
+        Teach run-webkit-tests, DumpRenderTree, and WebKitTestRunner how to
+        save crash logs on Windows
+
+        The crash logs are saved to /tmp/layout-test-results and have names
+        like CrashLog_02bc_2010-08-17_14-36-20-108.txt.
+
+        Unfortunately, crashes in the WebKit2 web process are recorded as
+        time-outs by run-webkit-tests. Fixing this is covered by
+        <http://webkit.org/b/44121>.
+
+        Fixes <http://webkit.org/b/37859> <rdar://problem/7883560>
+        DumpRenderTree should save a stack trace and/or dump file when it
+        crashes
+
+        Reviewed by Sam Weinig.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (exceptionFilter):
+        (main):
+        * WebKitTestRunner/win/TestControllerWin.cpp:
+        (WTR::exceptionFilter):
+        (WTR::TestController::platformInitialize):
+        These changes set up an exception filter that prints #CRASHED to
+        stderr, then lets the exception propagate normally. This allows
+        run-webkit-tests to detect when we've crashed even when a post-mortem
+        debugger attaches to the process.
+
+        * Scripts/old-run-webkit-tests:
+        (top level): Declared some variables used by the crash-log-saving
+        code.
+        (openDumpTool): Copy _NT_SYMBOL_PATH into the clean environment so
+        that the post-mortem debugger has access to it.
+        (toCygwinPath): Added. This is the opposite of toWindowsPath.
+        (readFromDumpToolWithTimer): If the dump tool prints #CRASHED to
+        stderr, consider it a crash.
+        (setUpWindowsCrashLogSaving): Added. Saves the current post-mortem
+        debugger, then sets ntsd as the post-mortem debugger. ntsd is
+        configured to save a crash log and then quit automatically.
+        (END): Added. Restores the previous post-mortem debugger when the
+        script exits.
+
 2010-08-17  Victor Wang  <victorw at chromium.org>
 
         Reviewed by ojan at chromium.org.
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
index a1b72e1..67e5d4b 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -1232,8 +1232,17 @@ RetainPtr<CFURLCacheRef> sharedCFURLCache()
 }
 #endif
 
+static LONG WINAPI exceptionFilter(EXCEPTION_POINTERS*)
+{
+    fputs("#CRASHED\n", stderr);
+    fflush(stderr);
+    return EXCEPTION_CONTINUE_SEARCH;
+}
+
 int main(int argc, char* argv[])
 {
+    ::SetUnhandledExceptionFilter(exceptionFilter);
+
     leakChecking = false;
 
     _setmode(1, _O_BINARY);
diff --git a/WebKitTools/Scripts/old-run-webkit-tests b/WebKitTools/Scripts/old-run-webkit-tests
index 56bcfb4..4701388 100755
--- a/WebKitTools/Scripts/old-run-webkit-tests
+++ b/WebKitTools/Scripts/old-run-webkit-tests
@@ -105,12 +105,14 @@ sub readSkippedFiles($);
 sub recordActualResultsAndDiff($$);
 sub sampleDumpTool();
 sub setFileHandleNonBlocking(*$);
+sub setUpWindowsCrashLogSaving();
 sub slowestcmp($$);
 sub splitpath($);
 sub stopRunningTestsEarlyIfNeeded();
 sub stripExtension($);
 sub stripMetrics($$);
 sub testCrashedOrTimedOut($$$$$);
+sub toCygwinPath($);
 sub toURL($);
 sub toWindowsPath($);
 sub validateSkippedArg($$;$);
@@ -184,6 +186,12 @@ my $prettyDiffTag = "pretty-diff";
 my $diffsTag = "diffs";
 my $errorTag = "stderr";
 
+# These are defined here instead of closer to where they are used so that they
+# will always be accessible from the END block that uses them, even if the user
+# presses Ctrl-C before Perl has finished evaluating this whole file.
+my $windowsPostMortemDebuggerKey = "/HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug";
+my %previousWindowsPostMortemDebuggerValues;
+
 my $realPlatform;
 
 my @macPlatforms = ("mac-tiger", "mac-leopard", "mac-snowleopard", "mac");
@@ -382,6 +390,8 @@ $testMedia = 0 if $shouldCheckLeaks && isTiger();
 # Generating remote links causes a lot of unnecessary spew on GTK build bot
 $useRemoteLinksToTests = 0 if isGtk();
 
+setUpWindowsCrashLogSaving() if isCygwin();
+
 setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root));
 my $productDir = productDir();
 $productDir .= "/bin" if isQt();
@@ -1399,6 +1409,7 @@ sub openDumpTool()
     } elsif (isCygwin()) {
         $CLEAN_ENV{HOMEDRIVE} = $ENV{'HOMEDRIVE'};
         $CLEAN_ENV{HOMEPATH} = $ENV{'HOMEPATH'};
+        $CLEAN_ENV{_NT_SYMBOL_PATH} = $ENV{_NT_SYMBOL_PATH};
 
         setPathForRunningWebKitApp(\%CLEAN_ENV);
     }
@@ -1721,6 +1732,14 @@ sub convertPathUsingCygpath($$)
     return $convertedPath;
 }
 
+sub toCygwinPath($)
+{
+    my ($path) = @_;
+    return unless isCygwin();
+
+    return convertPathUsingCygpath($path, "-u");
+}
+
 sub toWindowsPath($)
 {
     my ($path) = @_;
@@ -2071,6 +2090,10 @@ sub readFromDumpToolWithTimer(**)
             }
         }
         if (defined($lineError)) {
+            if ($lineError =~ /#CRASHED/) {
+                $status = "crashed";
+                last;
+            }
             if ($lineError =~ /#EOF/) {
                 $haveSeenEofError = 1;
             } else {
@@ -2347,3 +2370,44 @@ sub stopRunningTestsEarlyIfNeeded()
 
     return 0;
 }
+
+sub setUpWindowsCrashLogSaving()
+{
+    return unless isCygwin();
+
+    unless (defined $ENV{_NT_SYMBOL_PATH}) {
+        print "The _NT_SYMBOL_PATH environment variable is not set. Crash logs will not be saved.\nSee <http://trac.webkit.org/wiki/BuildingOnWindows#GettingCrashLogs>.\n";
+        return;
+    }
+
+    my $ntsdPath = File::Spec->catfile(toCygwinPath($ENV{PROGRAMFILES}), "Debugging Tools for Windows (x86)", "ntsd.exe");
+    unless (-f $ntsdPath) {
+        $ntsdPath = File::Spec->catfile(toCygwinPath($ENV{SYSTEMROOT}), "system32", "ntsd.exe");
+        unless (-f $ntsdPath) {
+            print STDERR "Can't find ntsd.exe. Crash logs will not be saved.\nSee <http://trac.webkit.org/wiki/BuildingOnWindows#GettingCrashLogs>.\n";
+            return;
+        }
+    }
+
+    foreach my $value qw(Debugger Auto) {
+        chomp($previousWindowsPostMortemDebuggerValues{$value} = `regtool get "$windowsPostMortemDebuggerKey/$value"`);
+    }
+
+    my $result = system $ntsdPath, "-iaec", '-lines -c ".logopen /t \"' . toWindowsPath($testResultsDirectory) . '\CrashLog.txt\";!analyze -vv;~*kpn;q"';
+    if ($result) {
+        print "Failed to set nstd.exe as the post-mortem debugger. Crash logs will not be saved.\nSee <http://trac.webkit.org/wiki/BuildingOnWindows#GettingCrashLogs>.\n";
+        %previousWindowsPostMortemDebuggerValues = ();
+        return;
+    }
+
+    print "Crash logs will be saved to $testResultsDirectory.\n";
+}
+
+END {
+    return unless isCygwin();
+
+    foreach my $value (keys %previousWindowsPostMortemDebuggerValues) {
+        my $result = system "regtool", "set", "$windowsPostMortemDebuggerKey/$value", $previousWindowsPostMortemDebuggerValues{$value};
+        !$result or print "Failed to restore \"$windowsPostMortemDebuggerKey/$value\" to its previous value \"$previousWindowsPostMortemDebuggerValues{$value}\"\n.";
+    }
+}
diff --git a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
index a3cc53a..e35ee22 100644
--- a/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
+++ b/WebKitTools/WebKitTestRunner/win/TestControllerWin.cpp
@@ -81,8 +81,17 @@ static void addQTDirToPATH()
     ::SetEnvironmentVariableW(pathEnvironmentVariable, newPath.data());
 }
 
+static LONG WINAPI exceptionFilter(EXCEPTION_POINTERS*)
+{
+    fputs("#CRASHED\n", stderr);
+    fflush(stderr);
+    return EXCEPTION_CONTINUE_SEARCH;
+}
+
 void TestController::platformInitialize()
 {
+    ::SetUnhandledExceptionFilter(exceptionFilter);
+
     _setmode(1, _O_BINARY);
     _setmode(2, _O_BINARY);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list