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

Function matchSymbol

internal/binutils/disasm.go:86–107  ·  view source on GitHub ↗

matchSymbol checks if a symbol is to be selected by checking its name to the regexp and optionally its address. It returns the name(s) to be used for the matched symbol, or nil if no match

(names []string, start, end uint64, r *regexp.Regexp, address uint64)

Source from the content-addressed store, hash-verified

84// name to the regexp and optionally its address. It returns the name(s)
85// to be used for the matched symbol, or nil if no match
86func matchSymbol(names []string, start, end uint64, r *regexp.Regexp, address uint64) []string {
87 if address != 0 && address >= start && address <= end {
88 return names
89 }
90 for _, name := range names {
91 if r == nil || r.MatchString(name) {
92 return []string{name}
93 }
94
95 // Match all possible demangled versions of the name.
96 for _, o := range [][]demangle.Option{
97 {demangle.NoClones},
98 {demangle.NoParams, demangle.NoEnclosingParams},
99 {demangle.NoParams, demangle.NoEnclosingParams, demangle.NoTemplateParams},
100 } {
101 if demangled, err := demangle.ToString(name, o...); err == nil && r.MatchString(demangled) {
102 return []string{demangled}
103 }
104 }
105 }
106 return nil
107}
108
109// disassemble parses the output of the objdump command and returns
110// the assembly instructions in a slice.

Callers 1

findSymbolsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…