[PATCH] D157913: [Coverage] Allow Clang coverage to be used with debug info correlation.

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 11:32:28 PDT 2023


zequanwu added a comment.

> It seems that the `__llvm_prf_names` is retained in this mode. What is the overhead of this section generally? Can we instead use debug info to lookup function names?

With debug info correlation enabled, `__llvm_prf_names` section will only contain functions names that are not emitted to the final binary, not even in debug info. So, this section is still much smaller compared to when not enabling debug info correlation. This is used to indicate that those functions are covered but not executed.

Example from the test case above:

  $ cat a.cpp
  struct A {
    void unused_func() {}
  };
  void used_func() {}
  int main() {
    used_func();
    return 0;
  }
  $ clang -fprofile-instr-generate -fcoverage-mapping -mllvm -enable-name-compression=false -mllvm -debug-info-correlate -g a.cpp -o a.out
  $ llvm-objdump --section=__llvm_prf_names --full-contents a.out
  
  a.out:  file format elf64-x86-64
  Contents of section __llvm_prf_names:
   7b65 14005f5a 4e314131 31756e75 7365645f  .._ZN1A11unused_
   7b75 66756e63 4576                        funcEv


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157913/new/

https://reviews.llvm.org/D157913



More information about the cfe-commits mailing list