[compiler-rt] [llvm] [InstrProf] Add debuginfod correlation support (PR #106606)

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 13:29:18 PDT 2024


================
@@ -0,0 +1,40 @@
+// REQUIRES: (linux || windows), curl
+// RUN: rm -rf %t
+
+// Default instrumented build with no profile correlation.
+// RUN: %clang_profgen -o %t.default.exe -Wl,--build-id=0x12345678 -fprofile-instr-generate -fcoverage-mapping %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp
+// RUN: env LLVM_PROFILE_FILE=%t.default.profraw %run %t.default.exe
+// RUN: llvm-profdata merge -o %t.default.profdata %t.default.profraw
+// RUN: llvm-profdata show %t.default.profdata > %t.default.profdata.show
+
+// Build with profile binary correlation.
+// RUN: %clang_profgen -o %t.correlate.exe -Wl,--build-id=0x12345678 -fprofile-instr-generate -fcoverage-mapping -mllvm -profile-correlate=binary %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp
+// Strip above binary and run
+// RUN: llvm-strip %t.correlate.exe -o %t.stripped.exe
+// RUN: env LLVM_PROFILE_FILE=%t.correlate.profraw %run %t.stripped.exe
+
+// Test llvm-profdata merge profile correlation with --debuginfod option.
+// RUN: mkdir -p %t/buildid/12345678
+// RUN: cp %t.correlate.exe %t/buildid/12345678/debuginfo
+// RUN: env DEBUGINFOD_CACHE_PATH=%t/debuginfod-cache DEBUGINFOD_URLS=file://%t llvm-profdata merge -o %t.correlate-debuginfod.profdata --debuginfod --correlate=binary %t.correlate.profraw
+// RUN: llvm-profdata show %t.correlate-debuginfod.profdata > %t.correlate-debuginfod.profdata.show
----------------
ZequanWu wrote:

```suggestion
// RUN: llvm-profdata show --all-functions --counts %t.correlate-debuginfod.profdata > %t.correlate-debuginfod.profdata.show
```

https://github.com/llvm/llvm-project/pull/106606


More information about the llvm-commits mailing list