From 7a53e7e35da7468b5a6291fa3b5e1db4bcdf402f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 14 Nov 2017 09:41:55 +0100 Subject: pkg/report: combine report data into a struct Parse returns 5 variables now. Later we may want to add crash "priority". Introduce Report struct that holds all report data. --- vm/vm.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'vm') diff --git a/vm/vm.go b/vm/vm.go index a0be9cbdc..b786dc131 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -131,16 +131,19 @@ func MonitorExecution(outc <-chan []byte, errc <-chan error, needOutput bool, if !reporter.ContainsCrash(output[matchPos:]) { return defaultError, nil, output, defaultError != "", false } - desc, text, start, end, _ := reporter.Parse(output[matchPos:]) - start = start + matchPos - beforeContext + rep := reporter.Parse(output[matchPos:]) + if rep == nil { + panic(fmt.Sprintf("reporter.ContainsCrash/Parse disagree:\n%s", output[matchPos:])) + } + start := rep.Start + matchPos - beforeContext if start < 0 { start = 0 } - end = end + matchPos + afterContext + end := rep.End + matchPos + afterContext if end > len(output) { end = len(output) } - return desc, text, output[start:end], true, false + return rep.Desc, rep.Text, output[start:end], true, false } lastExecuteTime := time.Now() -- cgit mrf-deployment