From 50749f54cde9f63ddd99e65a6a2d45f89f237019 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 13 May 2020 20:49:07 +0200 Subject: pkg/report: add ParseAll ParseAll returns all reports in output. Use it in syz-symbolize. --- pkg/report/report.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pkg') diff --git a/pkg/report/report.go b/pkg/report/report.go index e6d13b930..ac464a177 100644 --- a/pkg/report/report.go +++ b/pkg/report/report.go @@ -224,6 +224,18 @@ func IsSuppressed(reporter Reporter, output []byte) bool { bytes.Contains(output, gceConsoleHangup) } +// ParseAll returns all successive reports in output. +func ParseAll(reporter Reporter, output []byte) (reports []*Report) { + for { + rep := reporter.Parse(output) + if rep == nil { + return + } + reports = append(reports, rep) + output = output[rep.SkipPos:] + } +} + // GCE console connection sometimes fails with this message. // The message frequently happens right after a kernel panic. // So if we see it in output where we recognized a crash, we mark the report as corrupted -- cgit mrf-deployment