aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vm/qemu/qemu.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go
index becb097d0..eb4a7a7a9 100644
--- a/vm/qemu/qemu.go
+++ b/vm/qemu/qemu.go
@@ -291,7 +291,8 @@ func (inst *Instance) Run() {
outputMu.Unlock()
time.Sleep(5 * time.Second)
outputMu.Lock()
- loc = crashRe.FindAllIndex(output[matchPos:], -1)
+ output = output[matchPos:]
+ loc = crashRe.FindAllIndex(output, -1)
start := loc[0][0] - contextSize
if start < 0 {
start = 0
@@ -300,7 +301,9 @@ func (inst *Instance) Run() {
if end > len(output) {
end = len(output)
}
- inst.SaveCrasher(output[start:end])
+ text := append(output[start:end:end], "\n\nfound crasher:\n"...)
+ text = append(text, output[loc[0][0]:loc[0][1]]...)
+ inst.SaveCrasher(text)
}
if len(output) > 2*contextSize {
copy(output, output[len(output)-contextSize:])