Title: [191018] trunk/Tools
Revision
191018
Author
[email protected]
Date
2015-10-13 17:15:38 -0700 (Tue, 13 Oct 2015)

Log Message

[Win] Generate Crash Traces
https://bugs.webkit.org/show_bug.cgi?id=150103

Reviewed by Daniel Bates.

We were using an exception filter to try to emit "#CRASHED" to stderr
when a test program crashed. However, the modern Python implementation
seems capable of recognizing crashes on its own. Furthermore, registering
the exception handler was preventing the JIT debugger (NTSD) from
automatically attaching to the crashing program, so we were not getting
crash traces.
        
* DumpRenderTree/win/DumpRenderTree.cpp:
(main): Don't register an exception filter.
(exceptionFilter): Deleted.
* Scripts/webkitpy/common/system/crashlogs.py:
(CrashLogs): Add another regular _expression_ to handle a second crash trace
syntax I encountered during testing.
(CrashLogs._find_newest_log_win): If the old regular _expression_ doesn't match,
try the new one. The PID found by the new _expression_ is in hexadecimal, so
convert it to an integer before returning it.
* Scripts/webkitpy/port/driver.py:
(Driver._check_for_driver_crash_or_unresponsiveness): Windows was not recognizing
the "#CRASHED" state because it was appending '\r\n', rather than just '\r'. Instead,
check for "#CRASHED" after stripping off the EOL characters.
* Scripts/webkitpy/port/win.py:
(WinPort.setup_crash_log_saving): Put back the '-e %ld' flag in the debugger
invocation. This is apparently used to signal an event when the debugger is finished.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (191017 => 191018)


--- trunk/Tools/ChangeLog	2015-10-14 00:14:29 UTC (rev 191017)
+++ trunk/Tools/ChangeLog	2015-10-14 00:15:38 UTC (rev 191018)
@@ -1,3 +1,34 @@
+2015-10-13  Brent Fulgham  <[email protected]>
+
+        [Win] Generate Crash Traces
+        https://bugs.webkit.org/show_bug.cgi?id=150103
+
+        Reviewed by Daniel Bates.
+
+        We were using an exception filter to try to emit "#CRASHED" to stderr
+        when a test program crashed. However, the modern Python implementation
+        seems capable of recognizing crashes on its own. Furthermore, registering
+        the exception handler was preventing the JIT debugger (NTSD) from
+        automatically attaching to the crashing program, so we were not getting
+        crash traces.
+        
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (main): Don't register an exception filter.
+        (exceptionFilter): Deleted.
+        * Scripts/webkitpy/common/system/crashlogs.py:
+        (CrashLogs): Add another regular _expression_ to handle a second crash trace
+        syntax I encountered during testing.
+        (CrashLogs._find_newest_log_win): If the old regular _expression_ doesn't match,
+        try the new one. The PID found by the new _expression_ is in hexadecimal, so
+        convert it to an integer before returning it.
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._check_for_driver_crash_or_unresponsiveness): Windows was not recognizing
+        the "#CRASHED" state because it was appending '\r\n', rather than just '\r'. Instead,
+        check for "#CRASHED" after stripping off the EOL characters.
+        * Scripts/webkitpy/port/win.py:
+        (WinPort.setup_crash_log_saving): Put back the '-e %ld' flag in the debugger
+        invocation. This is apparently used to signal an event when the debugger is finished.
+
 2015-10-13  Alexey Proskuryakov  <[email protected]>
 
         Mac Debug and 32-bit queues should be separate

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (191017 => 191018)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2015-10-14 00:14:29 UTC (rev 191017)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2015-10-14 00:15:38 UTC (rev 191018)
@@ -1297,13 +1297,6 @@
 }
 #endif
 
-static LONG WINAPI exceptionFilter(EXCEPTION_POINTERS*)
-{
-    fputs("#CRASHED\n", stderr);
-    fflush(stderr);
-    return EXCEPTION_CONTINUE_SEARCH;
-}
-
 static Vector<const char*> initializeGlobalsFromCommandLineOptions(int argc, const char* argv[])
 {
     Vector<const char*> tests;
@@ -1414,8 +1407,6 @@
     // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
     ::SetErrorMode(0);
 
-    ::SetUnhandledExceptionFilter(exceptionFilter);
-
     leakChecking = false;
 
     _setmode(1, _O_BINARY);

Modified: trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py (191017 => 191018)


--- trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py	2015-10-14 00:14:29 UTC (rev 191017)
+++ trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py	2015-10-14 00:15:38 UTC (rev 191018)
@@ -1,4 +1,5 @@
 # Copyright (c) 2011, Google Inc. All rights reserved.
+# Copyright (c) 2015, Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -32,7 +33,8 @@
 
 class CrashLogs(object):
 
-    PID_LINE_REGEX = re.compile(r'\s+Global\s+PID:\s+\[(?P<pid>\d+)\]')
+    GLOBAL_PID_REGEX = re.compile(r'\s+Global\s+PID:\s+\[(?P<pid>\d+)\]')
+    EXIT_PROCESS_PID_REGEX = re.compile(r'Exit process \d+:(?P<pid>\w+), code')
 
     def __init__(self, host, results_directory=None):
         self._host = host
@@ -90,10 +92,15 @@
             try:
                 if not newer_than or self._host.filesystem.mtime(path) > newer_than:
                     log_file = self._host.filesystem.read_binary_file(path).decode('ascii', 'ignore')
-                    match = self.PID_LINE_REGEX.search(log_file)
+                    match = self.GLOBAL_PID_REGEX.search(log_file)
+                    if match:
+                        if int(match.group('pid')) == pid:
+                            return errors + log_file
+                    match = self.EXIT_PROCESS_PID_REGEX.search(log_file)
                     if match is None:
                         continue
-                    if int(match.group('pid')) == pid:
+                    # Note: This output comes from a program that shows PID in hex:
+                    if int(match.group('pid'), 16) == pid:
                         return errors + log_file
             except IOError, e:
                 print "IOError %s" % str(e)

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (191017 => 191018)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2015-10-14 00:14:29 UTC (rev 191017)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2015-10-14 00:15:38 UTC (rev 191018)
@@ -1,4 +1,5 @@
 # Copyright (C) 2011 Google Inc. All rights reserved.
+# Copyright (c) 2015, Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -399,7 +400,8 @@
             return True
 
     def _check_for_driver_crash_or_unresponsiveness(self, error_line):
-        if error_line == "#CRASHED\n":
+        crashed_check = error_line.rstrip('\r\n')
+        if crashed_check == "#CRASHED":
             self._crashed_process_name = self._server_process.name()
             self._crashed_pid = self._server_process.pid()
             return True

Modified: trunk/Tools/Scripts/webkitpy/port/win.py (191017 => 191018)


--- trunk/Tools/Scripts/webkitpy/port/win.py	2015-10-14 00:14:29 UTC (rev 191017)
+++ trunk/Tools/Scripts/webkitpy/port/win.py	2015-10-14 00:15:38 UTC (rev 191018)
@@ -245,7 +245,7 @@
         command_file = self.create_debugger_command_file()
         if not command_file:
             return None
-        debugger_options = '"{0}" -p %ld -g -noio -lines -cf "{1}"'.format(cygpath(ntsd_path), cygpath(command_file))
+        debugger_options = '"{0}" -p %ld -e %ld -g -noio -lines -cf "{1}"'.format(cygpath(ntsd_path), cygpath(command_file))
         registry_settings = {'Debugger': debugger_options, 'Auto': "1"}
         for key in registry_settings:
             for arch in ["--wow32", "--wow64"]:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to