aboutsummaryrefslogtreecommitdiffstats
path: root/report
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-10-06 16:45:42 +0200
committerDmitry Vyukov <dvyukov@google.com>2016-10-06 16:45:42 +0200
commit2cb8950047f53c3de274797101351bf6befc291d (patch)
tree6bd41a464140c829cef0e0fa018f1a83cd76cd36 /report
parent171bcbc0502269375ad08aea2903a174f871b779 (diff)
report: infer correct strip prefix from known symbol location
Diffstat (limited to 'report')
-rw-r--r--report/report.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/report/report.go b/report/report.go
index c378c9893..8aa3be076 100644
--- a/report/report.go
+++ b/report/report.go
@@ -297,8 +297,24 @@ func Symbolize(vmlinux string, text []byte) ([]byte, error) {
symbFunc := func(bin string, pc uint64) ([]symbolizer.Frame, error) {
return symb.Symbolize(bin, pc)
}
+ // Strip vmlinux location from all paths.
strip, _ := filepath.Abs(vmlinux)
strip = filepath.Dir(strip) + string(filepath.Separator)
+ // Vmlinux may have been moved, so check if we can find debug info
+ // for __sanitizer_cov_trace_pc. We know where it is located,
+ // so we can infer correct strip prefix from it.
+ if covSymbols := symbols["__sanitizer_cov_trace_pc"]; len(covSymbols) != 0 {
+ for _, covSymb := range covSymbols {
+ frames, _ := symb.Symbolize(vmlinux, covSymb.Addr)
+ if len(frames) > 0 {
+ file := frames[len(frames)-1].File
+ if idx := strings.Index(file, "kernel/kcov.c"); idx != -1 {
+ strip = file[:idx]
+ break
+ }
+ }
+ }
+ }
s := bufio.NewScanner(bytes.NewReader(text))
for s.Scan() {
line := append([]byte{}, s.Bytes()...)