aboutsummaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-11-14 09:41:55 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-11-14 09:41:55 +0100
commit7a53e7e35da7468b5a6291fa3b5e1db4bcdf402f (patch)
tree62d7db4c53b8ab4da2fab89c25f528904d8bf517 /vm
parentf9a8d567eb3388d0909e0d3cb6df23d345911850 (diff)
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.
Diffstat (limited to 'vm')
-rw-r--r--vm/vm.go11
1 files changed, 7 insertions, 4 deletions
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()