diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-03-22 10:12:02 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-03-22 10:12:02 +0100 |
| commit | d661fa01d9d52e8bbcf67e2ed9326d9e9676d634 (patch) | |
| tree | e71806496991b51b0c45915c10c5ebb870e2495b /dashboard | |
| parent | ae36e6e584951a17a998197b6c9a89a8666ef12f (diff) | |
dashboard/app: add sample crash report to bug page
As requested at:
https://groups.google.com/d/msg/syzkaller/zYlQ-b-QPHQ/u2jZPNRAAAAJ
Diffstat (limited to 'dashboard')
| -rw-r--r-- | dashboard/app/bug.html | 7 | ||||
| -rw-r--r-- | dashboard/app/main.go | 46 |
2 files changed, 32 insertions, 21 deletions
diff --git a/dashboard/app/bug.html b/dashboard/app/bug.html index 9de9576fa..263fd49ec 100644 --- a/dashboard/app/bug.html +++ b/dashboard/app/bug.html @@ -28,8 +28,13 @@ Page with details about a single bug. {{template "bug_list" .Dups}} {{template "bug_list" .Similar}} + {{if .SampleReport}} + <br><b>Sample crash report:</b><br> + <textarea id="log_textarea" readonly rows="25" wrap=off>{{printf "%s" .SampleReport}}</textarea><br> + {{end}} + <table class="list_table"> - <caption>Crashes ({{.Bug.NumCrashes}}):</caption> + <caption>All crashes ({{.Bug.NumCrashes}}):</caption> <tr> <th><a onclick="return sortTable('Manager', textSort)" href="#">Manager</a></th> <th><a onclick="return sortTable('Time', dateSort)" href="#">Time</a></th> diff --git a/dashboard/app/main.go b/dashboard/app/main.go index 4335967b3..41f12294b 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -60,13 +60,14 @@ type uiBuild struct { } type uiBugPage struct { - Header *uiHeader - Now time.Time - Bug *uiBug - DupOf *uiBugGroup - Dups *uiBugGroup - Similar *uiBugGroup - Crashes []*uiCrash + Header *uiHeader + Now time.Time + Bug *uiBug + DupOf *uiBugGroup + Dups *uiBugGroup + Similar *uiBugGroup + SampleReport []byte + Crashes []*uiCrash } type uiBugNamespace struct { @@ -222,7 +223,7 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error } } uiBug := createUIBug(c, bug, state, managers) - crashes, err := loadCrashesForBug(c, bug) + crashes, sampleReport, err := loadCrashesForBug(c, bug) if err != nil { return err } @@ -235,13 +236,14 @@ func handleBug(c context.Context, w http.ResponseWriter, r *http.Request) error return err } data := &uiBugPage{ - Header: commonHeader(c, r), - Now: timeNow(c), - Bug: uiBug, - DupOf: dupOf, - Dups: dups, - Similar: similar, - Crashes: crashes, + Header: commonHeader(c, r), + Now: timeNow(c), + Bug: uiBug, + DupOf: dupOf, + Dups: dups, + Similar: similar, + SampleReport: sampleReport, + Crashes: crashes, } return serveTemplate(w, "bug.html", data) } @@ -545,13 +547,13 @@ func updateBugBadness(c context.Context, bug *uiBug) { bug.NumCrashesBad = bug.NumCrashes >= 10000 && timeNow(c).Sub(bug.LastTime) < 24*time.Hour } -func loadCrashesForBug(c context.Context, bug *Bug) ([]*uiCrash, error) { +func loadCrashesForBug(c context.Context, bug *Bug) ([]*uiCrash, []byte, error) { bugHash := bugKeyHash(bug.Namespace, bug.Title, bug.Seq) bugKey := datastore.NewKey(c, "Bug", bugHash, 0, nil) // We can have more than maxCrashes crashes, if we have lots of reproducers. crashes, _, err := queryCrashesForBug(c, bugKey, maxCrashes+200) - if err != nil { - return nil, err + if err != nil || len(crashes) == 0 { + return nil, nil, err } builds := make(map[string]*Build) var results []*uiCrash @@ -560,7 +562,7 @@ func loadCrashesForBug(c context.Context, bug *Bug) ([]*uiCrash, error) { if build == nil { build, err = loadBuild(c, bug.Namespace, crash.BuildID) if err != nil { - return nil, err + return nil, nil, err } builds[crash.BuildID] = build } @@ -576,7 +578,11 @@ func loadCrashesForBug(c context.Context, bug *Bug) ([]*uiCrash, error) { } results = append(results, ui) } - return results, nil + sampleReport, _, err := getText(c, "CrashReport", crashes[0].Report) + if err != nil { + return nil, nil, err + } + return results, sampleReport, nil } func makeUIBuild(build *Build) *uiBuild { |
