simplifyFunc does some primitive simplification of function names.
(f string)
| 36 | |
| 37 | // simplifyFunc does some primitive simplification of function names. |
| 38 | func simplifyFunc(f string) string { |
| 39 | // Account for leading '.' on the PPC ELF v1 ABI. |
| 40 | funcName := strings.TrimPrefix(f, ".") |
| 41 | // Account for unsimplified names -- try to remove the argument list by trimming |
| 42 | // starting from the first '(', but skipping reserved names that have '('. |
| 43 | for _, ind := range bracketRx.FindAllStringSubmatchIndex(funcName, -1) { |
| 44 | foundReserved := slices.Contains(reservedNames, funcName[ind[0]:ind[1]]) |
| 45 | if !foundReserved { |
| 46 | funcName = funcName[:ind[0]] |
| 47 | break |
| 48 | } |
| 49 | } |
| 50 | return funcName |
| 51 | } |
| 52 | |
| 53 | // Prune removes all nodes beneath a node matching dropRx, and not |
| 54 | // matching keepRx. If the root node of a Sample matches, the sample |