MCPcopy Create free account
hub / github.com/google/pprof / parseProcMapsFromScanner

Function parseProcMapsFromScanner

profile/legacy_profile.go:977–1008  ·  view source on GitHub ↗
(s *bufio.Scanner)

Source from the content-addressed store, hash-verified

975}
976
977func parseProcMapsFromScanner(s *bufio.Scanner) ([]*Mapping, error) {
978 var mapping []*Mapping
979
980 var attrs []string
981 const delimiter = "="
982 r := strings.NewReplacer()
983 for s.Scan() {
984 line := r.Replace(removeLoggingInfo(s.Text()))
985 m, err := parseMappingEntry(line)
986 if err != nil {
987 if err == errUnrecognized {
988 // Recognize assignments of the form: attr=value, and replace
989 // $attr with value on subsequent mappings.
990 if attr := strings.SplitN(line, delimiter, 2); len(attr) == 2 {
991 attrs = append(attrs, "$"+strings.TrimSpace(attr[0]), strings.TrimSpace(attr[1]))
992 r = strings.NewReplacer(attrs...)
993 }
994 // Ignore any unrecognized entries
995 continue
996 }
997 return nil, err
998 }
999 if m == nil {
1000 continue
1001 }
1002 mapping = append(mapping, m)
1003 }
1004 if err := s.Err(); err != nil {
1005 return nil, err
1006 }
1007 return mapping, nil
1008}
1009
1010// removeLoggingInfo detects and removes log prefix entries generated
1011// by the glog package. If no logging prefix is detected, the string

Callers 2

ParseProcMapsFunction · 0.85

Calls 2

removeLoggingInfoFunction · 0.85
parseMappingEntryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…