diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2016-09-28 17:37:42 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2016-09-28 17:37:42 +0200 |
| commit | db32fed8a15b542f3f4db9014b9dc6b03b93a979 (patch) | |
| tree | de4554456f662796440f55f9d00d1691c8a68014 /report | |
| parent | 4fc28739fa3378420a9f16773dcce86b87821b05 (diff) | |
report: always extract the first oops as description
If there are several oops messages, we need to extract and use the first one.
Diffstat (limited to 'report')
| -rw-r--r-- | report/report.go | 17 | ||||
| -rw-r--r-- | report/report_test.go | 10 |
2 files changed, 23 insertions, 4 deletions
diff --git a/report/report.go b/report/report.go index 211e49281..72a5d037d 100644 --- a/report/report.go +++ b/report/report.go @@ -248,16 +248,25 @@ func Parse(output []byte) (desc string, text []byte, start int, end int) { } func extractDescription(output []byte, oops *oops) string { + result := "" + startPos := -1 for _, format := range oops.formats { - match := format.re.FindSubmatch(output) + match := format.re.FindSubmatchIndex(output) if match == nil { continue } + if startPos != -1 && startPos <= match[0] { + continue + } + startPos = match[0] var args []interface{} - for i := 1; i < len(match); i++ { - args = append(args, string(match[i])) + for i := 2; i < len(match); i += 2 { + args = append(args, string(output[match[i]:match[i+1]])) } - return fmt.Sprintf(format.fmt, args...) + result = fmt.Sprintf(format.fmt, args...) + } + if result != "" { + return result } pos := bytes.Index(output, oops.header) if pos == -1 { diff --git a/report/report_test.go b/report/report_test.go index 4c9ae2729..ac77b4c39 100644 --- a/report/report_test.go +++ b/report/report_test.go @@ -335,6 +335,16 @@ BUG: soft lockup - CPU#3 stuck for 11s! [syz-executor:643] `: `BUG: soft lockup`, ` +BUG: spinlock lockup suspected on CPU#2, syz-executor/12636 +BUG: soft lockup - CPU#3 stuck for 11s! [syz-executor:643] +`: `BUG: spinlock lockup suspected`, + + ` +BUG: soft lockup - CPU#3 stuck for 11s! [syz-executor:643] +BUG: spinlock lockup suspected on CPU#2, syz-executor/12636 +`: `BUG: soft lockup`, + + ` BUG UNIX (Not tainted): kasan: bad access detected `: "", } |
