瀏覽代碼

Skip unsymbolizable mapping during symbolz pass. (#368)

Alexey Alexandrov 7 年之前
父節點
當前提交
12989e0267
共有 1 個檔案被更改,包括 10 行新增5 行删除
  1. 10
    5
      internal/symbolz/symbolz.go

+ 10
- 5
internal/symbolz/symbolz.go 查看文件

34
 	symbolzRE = regexp.MustCompile(`(0x[[:xdigit:]]+)\s+(.*)`)
34
 	symbolzRE = regexp.MustCompile(`(0x[[:xdigit:]]+)\s+(.*)`)
35
 )
35
 )
36
 
36
 
37
-// Symbolize symbolizes profile p by parsing data returned by a
38
-// symbolz handler. syms receives the symbolz query (hex addresses
39
-// separated by '+') and returns the symbolz output in a string. If
40
-// force is false, it will only symbolize locations from mappings
41
-// not already marked as HasFunctions.
37
+// Symbolize symbolizes profile p by parsing data returned by a symbolz
38
+// handler. syms receives the symbolz query (hex addresses separated by '+')
39
+// and returns the symbolz output in a string. If force is false, it will only
40
+// symbolize locations from mappings not already marked as HasFunctions. Never
41
+// attempts symbolization of addresses from unsymbolizable system
42
+// mappings as those may look negative - e.g. "[vsyscall]".
42
 func Symbolize(p *profile.Profile, force bool, sources plugin.MappingSources, syms func(string, string) ([]byte, error), ui plugin.UI) error {
43
 func Symbolize(p *profile.Profile, force bool, sources plugin.MappingSources, syms func(string, string) ([]byte, error), ui plugin.UI) error {
43
 	for _, m := range p.Mapping {
44
 	for _, m := range p.Mapping {
44
 		if !force && m.HasFunctions {
45
 		if !force && m.HasFunctions {
45
 			// Only check for HasFunctions as symbolz only populates function names.
46
 			// Only check for HasFunctions as symbolz only populates function names.
46
 			continue
47
 			continue
47
 		}
48
 		}
49
+		// Skip well-known system mappings.
50
+		if m.Unsymbolizable() {
51
+			continue
52
+		}
48
 		mappingSources := sources[m.File]
53
 		mappingSources := sources[m.File]
49
 		if m.BuildID != "" {
54
 		if m.BuildID != "" {
50
 			mappingSources = append(mappingSources, sources[m.BuildID]...)
55
 			mappingSources = append(mappingSources, sources[m.BuildID]...)