aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-10-20 17:43:56 +0200
committerDmitry Vyukov <dvyukov@google.com>2015-10-20 17:43:56 +0200
commit9c10c5a1fb4a85e032dbb579671695dd1db0d0ca (patch)
tree1fc7e99287f923732467a1321cfa61572a1126c0
parent0750245eea6b2b4dd4bb4f4f974beeb2a900c1d6 (diff)
fix crash report extraction from logs
-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:])