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

Function initTools

internal/binutils/binutils.go:134–153  ·  view source on GitHub ↗
(b *binrep, config string)

Source from the content-addressed store, hash-verified

132}
133
134func initTools(b *binrep, config string) {
135 // paths collect paths per tool; Key "" contains the default.
136 paths := make(map[string][]string)
137 for _, t := range strings.Split(config, ",") {
138 name, path := "", t
139 if ct := strings.SplitN(t, ":", 2); len(ct) == 2 {
140 name, path = ct[0], ct[1]
141 }
142 paths[name] = append(paths[name], path)
143 }
144
145 defaultPath := paths[""]
146 b.llvmSymbolizer, b.llvmSymbolizerFound = chooseExe([]string{"llvm-symbolizer"}, []string{}, append(paths["llvm-symbolizer"], defaultPath...))
147 b.addr2line, b.addr2lineFound = chooseExe([]string{"addr2line"}, []string{"gaddr2line"}, append(paths["addr2line"], defaultPath...))
148 // The "-n" option is supported by LLVM since 2011. The output of llvm-nm
149 // and GNU nm with "-n" option is interchangeable for our purposes, so we do
150 // not need to differrentiate them.
151 b.nm, b.nmFound = chooseExe([]string{"llvm-nm", "nm"}, []string{"gnm"}, append(paths["nm"], defaultPath...))
152 b.objdump, b.objdumpFound, b.isLLVMObjdump = findObjdump(append(paths["objdump"], defaultPath...))
153}
154
155// findObjdump finds and returns path to preferred objdump binary.
156// Order of preference is: llvm-objdump, objdump.

Callers 3

getMethod · 0.85
updateMethod · 0.85
SetToolsMethod · 0.85

Calls 2

chooseExeFunction · 0.85
findObjdumpFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…