diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2016-12-16 15:40:53 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2016-12-16 15:40:53 +0100 |
| commit | 739d40c1b8f4107ca893e6817881ac37b50df4e8 (patch) | |
| tree | 2ba5c89077748f4b86075203ca07cf76db4ca83a | |
| parent | 5d23ba9171e7afb86a7ac3a5eb89ece1c097d057 (diff) | |
report: support new stack trace format without PC values
| -rw-r--r-- | report/report.go | 17 | ||||
| -rw-r--r-- | report/report_test.go | 6 |
2 files changed, 12 insertions, 11 deletions
diff --git a/report/report.go b/report/report.go index 8ea149224..9490da17e 100644 --- a/report/report.go +++ b/report/report.go @@ -221,8 +221,8 @@ var oopses = []*oops{ var ( consoleOutputRe = regexp.MustCompile(`^\[ *[0-9]+\.[0-9]+\] `) - questionableRe = regexp.MustCompile(`\[\<[0-9a-f]+\>\] \? +[a-zA-Z0-9_.]+\+0x[0-9a-f]+/[0-9a-f]+`) - symbolizeRe = regexp.MustCompile(`\[\<([0-9a-f]+)\>\] +([a-zA-Z0-9_.]+)\+0x([0-9a-f]+)/0x([0-9a-f]+)`) + questionableRe = regexp.MustCompile(`(?:\[\<[0-9a-f]+\>\])? \? +[a-zA-Z0-9_.]+\+0x[0-9a-f]+/[0-9a-f]+`) + symbolizeRe = regexp.MustCompile(`(?:\[\<(?:[0-9a-f]+)\>\])? +(?:[0-9]+:)?([a-zA-Z0-9_.]+)\+0x([0-9a-f]+)/0x([0-9a-f]+)`) eoi = []byte("<EOI>") ) @@ -395,12 +395,12 @@ func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, err if match == nil { return line } - fn := line[match[4]:match[5]] - off, err := strconv.ParseUint(string(line[match[6]:match[7]]), 16, 64) + fn := line[match[2]:match[3]] + off, err := strconv.ParseUint(string(line[match[4]:match[5]]), 16, 64) if err != nil { return line } - size, err := strconv.ParseUint(string(line[match[8]:match[9]]), 16, 64) + size, err := strconv.ParseUint(string(line[match[6]:match[7]]), 16, 64) if err != nil { return line } @@ -429,10 +429,11 @@ func symbolizeLine(symbFunc func(bin string, pc uint64) ([]symbolizer.Frame, err } info := fmt.Sprintf(" %v:%v", file, frame.Line) modified := append([]byte{}, line...) - modified = replace(modified, match[9], match[9], []byte(info)) + modified = replace(modified, match[7], match[7], []byte(info)) if frame.Inline { - modified = replace(modified, match[4], match[9], []byte(frame.Func)) - modified = replace(modified, match[2], match[3], []byte(" inline ")) + end := match[7] + len(info) + modified = replace(modified, end, end, []byte(" [inline]")) + modified = replace(modified, match[2], match[7], []byte(frame.Func)) } symbolized = append(symbolized, modified...) } diff --git a/report/report_test.go b/report/report_test.go index ea39edd69..1555bb535 100644 --- a/report/report_test.go +++ b/report/report_test.go @@ -590,7 +590,7 @@ func TestSymbolizeLine(t *testing.T) { // Should not be symbolized. { "WARNING: CPU: 2 PID: 2636 at ipc/shm.c:162 foo+0x101/0x185\n", - "WARNING: CPU: 2 PID: 2636 at ipc/shm.c:162 foo+0x101/0x185\n", + "WARNING: CPU: 2 PID: 2636 at ipc/shm.c:162 foo+0x101/0x185 foo.c:555\n", }, // Tricky function name. { @@ -600,8 +600,8 @@ func TestSymbolizeLine(t *testing.T) { // Inlined frames. { " [<ffffffff84e5bea0>] foo+0x141/0x185\n", - " [< inline >] inlined1 net.c:111\n" + - " [< inline >] inlined2 mm.c:222\n" + + " [<ffffffff84e5bea0>] inlined1 net.c:111 [inline]\n" + + " [<ffffffff84e5bea0>] inlined2 mm.c:222 [inline]\n" + " [<ffffffff84e5bea0>] foo+0x141/0x185 kasan.c:333\n", }, // Several symbols with the same name. |
