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

Function findObjdump

internal/binutils/binutils.go:163–184  ·  view source on GitHub ↗

findObjdump finds and returns path to preferred objdump binary. Order of preference is: llvm-objdump, objdump. On MacOS only, also looks for gobjdump with least preference. Accepts a list of paths and returns: a string with path to the preferred objdump binary if found, or an empty string if not fou

(paths []string)

Source from the content-addressed store, hash-verified

161// a boolean if any acceptable objdump was found;
162// a boolean indicating if it is an LLVM objdump.
163func findObjdump(paths []string) (string, bool, bool) {
164 objdumpNames := []string{"llvm-objdump", "objdump"}
165 if runtime.GOOS == "darwin" {
166 objdumpNames = append(objdumpNames, "gobjdump")
167 }
168
169 for _, objdumpName := range objdumpNames {
170 if objdump, objdumpFound := findExe(objdumpName, paths); objdumpFound {
171 cmdOut, err := exec.Command(objdump, "--version").Output()
172 if err != nil {
173 continue
174 }
175 if isLLVMObjdump(string(cmdOut)) {
176 return objdump, true, true
177 }
178 if isBuObjdump(string(cmdOut)) {
179 return objdump, true, false
180 }
181 }
182 }
183 return "", false, false
184}
185
186// chooseExe finds and returns path to preferred binary. names is a list of
187// names to search on both Linux and OSX. osxNames is a list of names specific

Callers 2

initToolsFunction · 0.85
testDisasmFunction · 0.85

Calls 3

findExeFunction · 0.85
isLLVMObjdumpFunction · 0.85
isBuObjdumpFunction · 0.85

Tested by 1

testDisasmFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…