Bug 37859 - DumpRenderTree should save a stack trace and/or dump file when it crashes
Summary: DumpRenderTree should save a stack trace and/or dump file when it crashes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar, PlatformOnly
Depends on:
Blocks:
 
Reported: 2010-04-20 07:57 PDT by Adam Roben (:aroben)
Modified: 2010-08-17 13:51 PDT (History)
1 user (show)

See Also:


Attachments
Teach run-webkit-tests, DumpRenderTree, and WebKitTestRunner how to save crash logs on Windows (8.63 KB, patch)
2010-08-17 12:32 PDT, Adam Roben (:aroben)
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2010-04-20 07:57:34 PDT
DumpRenderTree should save a stack trace and/or dump file when it crashes. This would make tracking down crashes on the bots muuuuuuuuch easier!
Comment 1 Adam Roben (:aroben) 2010-04-20 07:58:12 PDT
<rdar://problem/7883560>
Comment 2 Adam Roben (:aroben) 2010-04-21 15:16:05 PDT
Chromium's test_shell does this via Google Breakpad.
Comment 3 Adam Roben (:aroben) 2010-08-17 07:43:29 PDT
I think we could do this by setting cdb or ntsd as the postmortem debugger in run-webkit-tests. This command:

ntsd.exe -iaec "-lines -c \"!analyze -vv;~kpn"

causes ntsd to set itself as the postmortem debugger, and, when invoked, prints an analysis of the crash and the stack traces of all threads. We just need to figure out how to get it piped to a file.

If Debugging Tools for Windows is installed, we should use the version included in it, since it will likely be newer than the version in system32. Otherwise we can fall back to the system32 version.

We'd want to install Debugging Tools for Windows on the test bots, and set up _NT_SYMBOL_PATH to point to the Safari and Microsoft symbol servers.

We'd want to save/restore any existing postmortem debugger in run-webkit-tests before setting up ntsd.
Comment 4 Adam Roben (:aroben) 2010-08-17 08:07:45 PDT
(In reply to comment #3)
> ntsd.exe -iaec "-lines -c \"!analyze -vv;~kpn"

Whoops, that should have been ~*kpn
Comment 5 Adam Roben (:aroben) 2010-08-17 08:30:10 PDT
OK, I figured out how to save to a log file. Here's a better command:

ntsd.exe -iaec "-lines -c \".logopen /t c:\cygwin\tmp\layout-test-results\DumpRenderTree.txt;!analyze -vv;~*kpn;.kill;q\""

That will save crash logs to the layout-test-results directory with names like DumpRenderTree_033c_2010-08-17_11-20-29-577.txt.
Comment 6 Adam Roben (:aroben) 2010-08-17 12:32:24 PDT
Created attachment 64618 [details]
Teach run-webkit-tests, DumpRenderTree, and WebKitTestRunner how to save crash logs on Windows
Comment 7 Sam Weinig 2010-08-17 13:22:50 PDT
Comment on attachment 64618 [details]
Teach run-webkit-tests, DumpRenderTree, and WebKitTestRunner how to save crash logs on Windows

> diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
> index b2aa836dc4ca126c4e3287d52161fc7423c744a6..24019390b32dfca7f3a532690f3fee164e4c144a 100644
> --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
> +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
> @@ -111,6 +111,7 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag
>          WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest")));
>          WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
>  
> +        CRASH();

This seems like a bad idea.

Otherwise, r=me.
Comment 8 Adam Roben (:aroben) 2010-08-17 13:31:06 PDT
(In reply to comment #7)
> (From update of attachment 64618 [details])
> > diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
> > index b2aa836dc4ca126c4e3287d52161fc7423c744a6..24019390b32dfca7f3a532690f3fee164e4c144a 100644
> > --- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
> > +++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
> > @@ -111,6 +111,7 @@ void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messag
> >          WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest")));
> >          WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
> >  
> > +        CRASH();
> 
> This seems like a bad idea.

Whoopsie!

> Otherwise, r=me.

Thanks!
Comment 9 Adam Roben (:aroben) 2010-08-17 13:51:31 PDT
Committed r65537: <http://trac.webkit.org/changeset/65537>