소스 검색

Add a helper function to check if a mapping is unsymbolizable.

The local symbolization already skips these mappings. Have the helper
which can be used when alternative symbolization flows are used.
Alexey Alexandrov 8 년 전
부모
커밋
ced695807b
2개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 2
    2
      internal/symbolizer/symbolizer.go
  2. 8
    0
      profile/profile.go

+ 2
- 2
internal/symbolizer/symbolizer.go 파일 보기

@@ -298,8 +298,7 @@ func newMapping(prof *profile.Profile, obj plugin.ObjTool, ui plugin.UI, force b
298 298
 		}
299 299
 
300 300
 		// Skip well-known system mappings
301
-		name := filepath.Base(m.File)
302
-		if name == "[vdso]" || strings.HasPrefix(name, "linux-vdso") {
301
+		if m.Unsymbolizable() {
303 302
 			continue
304 303
 		}
305 304
 
@@ -310,6 +309,7 @@ func newMapping(prof *profile.Profile, obj plugin.ObjTool, ui plugin.UI, force b
310 309
 			}
311 310
 		}
312 311
 
312
+		name := filepath.Base(m.File)
313 313
 		f, err := obj.Open(m.File, m.Start, m.Limit, m.Offset)
314 314
 		if err != nil {
315 315
 			ui.PrintErr("Local symbolization failed for ", name, ": ", err)

+ 8
- 0
profile/profile.go 파일 보기

@@ -22,6 +22,7 @@ import (
22 22
 	"fmt"
23 23
 	"io"
24 24
 	"io/ioutil"
25
+	"path/filepath"
25 26
 	"regexp"
26 27
 	"sort"
27 28
 	"strings"
@@ -583,6 +584,13 @@ func (p *Profile) HasFileLines() bool {
583 584
 	return true
584 585
 }
585 586
 
587
+// Unsymbolizable returns true if a mapping points to a binary for which
588
+// locations can't be symbolized in principle, at least now.
589
+func (m *Mapping) Unsymbolizable() bool {
590
+	name := filepath.Base(m.File)
591
+	return name == "[vdso]" || strings.HasPrefix(name, "linux-vdso")
592
+}
593
+
586 594
 // Copy makes a fully independent copy of a profile.
587 595
 func (p *Profile) Copy() *Profile {
588 596
 	p.preEncode()