Bläddra i källkod

Skip unsymbolizable mapping during symbolz pass. (#368)

Alexey Alexandrov 7 år sedan
förälder
incheckning
12989e0267
1 ändrade filer med 10 tillägg och 5 borttagningar
  1. 10
    5
      internal/symbolz/symbolz.go

+ 10
- 5
internal/symbolz/symbolz.go Visa fil

@@ -34,17 +34,22 @@ var (
34 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 43
 func Symbolize(p *profile.Profile, force bool, sources plugin.MappingSources, syms func(string, string) ([]byte, error), ui plugin.UI) error {
43 44
 	for _, m := range p.Mapping {
44 45
 		if !force && m.HasFunctions {
45 46
 			// Only check for HasFunctions as symbolz only populates function names.
46 47
 			continue
47 48
 		}
49
+		// Skip well-known system mappings.
50
+		if m.Unsymbolizable() {
51
+			continue
52
+		}
48 53
 		mappingSources := sources[m.File]
49 54
 		if m.BuildID != "" {
50 55
 			mappingSources = append(mappingSources, sources[m.BuildID]...)