aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-05-13 20:49:07 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-05-13 20:49:07 +0200
commit50749f54cde9f63ddd99e65a6a2d45f89f237019 (patch)
tree9636206e19fbf0e4367413047aed1a6b7903e7a4 /pkg
parent1e61c8bc14f84ca8680c5a636514fb1ef2f7e091 (diff)
pkg/report: add ParseAll
ParseAll returns all reports in output. Use it in syz-symbolize.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/report/report.go12
1 files changed, 12 insertions, 0 deletions
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