diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-02-21 10:22:07 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-02-21 10:22:07 +0100 |
| commit | b6ed1478343c98348649330e66b021faa747b6e5 (patch) | |
| tree | 38df81e84acdb967a7dac486521f3856c598e1ca /prog/meta.go | |
| parent | bd2a74a31f07d383be203bcd77dfbecbc1205dd3 (diff) | |
prog: dump orig prog if Deserialize panics
We are seeing some one-off panics during Deserialization
and it's unclear if it's machine memory corrpution or
an actual bug in prog. I leam towards machine memory corruption
but it's impossible to prove without seeing the orig program.
Move git revision to prog and it's more base package
(sys can import prog, prog can't import sys).
Diffstat (limited to 'prog/meta.go')
| -rw-r--r-- | prog/meta.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/prog/meta.go b/prog/meta.go new file mode 100644 index 000000000..502309cdc --- /dev/null +++ b/prog/meta.go @@ -0,0 +1,26 @@ +// Copyright 2020 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package prog + +import ( + "strings" + "time" +) + +var ( + GitRevision string // emitted by Makefile, may contain + at the end + GitRevisionBase string // without + + gitRevisionDate string // emitted by Makefile + GitRevisionDate time.Time // parsed from gitRevisionDate +) + +func init() { + GitRevisionBase = strings.Replace(GitRevision, "+", "", -1) + if gitRevisionDate != "" { + var err error + if GitRevisionDate, err = time.Parse("Mon Jan 2 15:04:05 2006 -0700", gitRevisionDate); err != nil { + panic(err) + } + } +} |
