SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov 和 clang 中的实现
MaskRay
https://maskray.me
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
1 Code coverage
2 gcov
3 gcov in Clang
4 Linux kernel
5 Future work
6 References
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
MaskRay
LLVM contributor
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
MaskRay
LLVM contributor
ccls owner (C++ language server)
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
MaskRay
LLVM contributor
ccls owner (C++ language server)
退休的算法竞赛 + 超算 +CTF 选手
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
MaskRay
退休的算法竞赛 + 超算 +CTF 选手
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
Code coverage
Motivation
Found a Bug
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
Code coverage
Motivation
Found a Bug
– Why is it not covered?
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
Code coverage
Motivation
Found a Bug
– Why is it not covered?
Find dead code
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
Code coverage
Code coverage tools
gcc --coverage + gcov
Clang coverage mapping clang -fprofile-instr-
generate -fcoverage-mapping + llvm-cov
clang -fsanitize-coverage=trace-pc-guard,
{edge,bb,func}
-fsanitize={address,memory,thread,...} + sancov
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov
gcov
gcc -fprofile-arcs -ftest-coverage a.c b.c #
--coverage
compile-time -fprofile-arcs ⇒ a.gcno b.gcno (notes
file)
./a.out ⇒ a.gcda b.gcda (count data file)
gcov a.c # or a. ⇒ a.c.gcov
gcov b.gcno # or b. ⇒ b.c.gcov
gcov -h
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov
lcov
lcov
https://github.com/linux-test-project/lcov,
gcov’s graphical front-end
lcov --gcov-tool gcov -c -d . -o a.info
genhtml a.info -o html
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov
lcov
% lcov --gcov-tool gcov-9 -c -d . -o a.info
Capturing coverage data from .
Found gcov version: 9.3.0
Using intermediate gcov format
Scanning . for .gcda files ...
Found 2 data files in .
Processing b.gcda
Processing a.gcda
Finished .info-file creation
% genhtml a.info -o html
Reading data file a.info
Found 2 entries.
Found common filename prefix "/tmp"
Writing .css and .png files.
Generating output.
Processing file c/a.c
Processing file c/b.c
Writing directory view page.
Overall coverage rate:
lines......: 100.0% (4 of 4 lines)
functions..: 100.0% (2 of 2 functions)
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov
Compatibility
Compatibility
.gcno/.gcda format changed several times: GCC 3.4, 4.7,
4.8, 8, 9
% gcc-9 --coverage a.c; ./a.out; gcov-10 a.
a.gcno:version 'A93*', prefer 'B00e'
a.gcda:version 'A93*', prefer version 'B00e'
File 'a.c'
Lines executed:100.00% of 2
Creating 'a.c.gcov'
% gcov-8 a.
a.gcno:version 'A93*', prefer 'A84*'
a.gcno:no functions found
a.gcda:version 'A93*', prefer version 'A84*'
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov in Clang
gcov in Clang
clang --coverage # -fprofile-arcs -ftest-
coverage
clang --coverage -Xclang -coverage-
version='408*' gcov 4.8 7 compatible
instrumenter (write .gcno, generate calls into runtime) ⇔
gcc/coverage.c
runtime (write .gcda) ⇔ libgcov.a (libgcc/libgcov-driver.c
& friends)
llvm-cov gcov ⇔ gcov
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov in Clang
My contribution
2020-05-10 [gcov] Fix .gcda decoding and support GCC 8, 9 and 10
2020-05-10 [gcov] Don't skip leading zeros when reading a string
2020-05-10 [gcov] Temporarily unsupport host-byteorder-big-endian
2020-05-10 [compiler-rt][test] Add feature host-byteorder-big-endian
2020-05-10 [gcov] Temporarily unsupport host-byteorder-big-endian
2020-05-10 [gcov] Delete CC1 option -coverage-no-function-names-in-data
2020-05-10 [gcov] Default coverage version to '407*' and delete CC1 option -coverage-cf
2020-05-10 [gcov] Implement --stdout -t
2020-05-11 [gcov] Emit GCOV_TAG_OBJECT_SUMMARY/GCOV_TAG_PROGRAM_SUMMARY correctly and f
2020-05-11 Revert part of D49132 "[gcov] Fix gcov profiling on big-endian machines"
2020-05-11 [gcov] Fix big-endian problems
2020-05-12 [gcov] Default coverage version to '408*' and delete CC1 option -coverage-ex
2020-05-12 [gcov][test] Fix clang test
2020-06-03 [gcov] Improve .gcno compatibility with gcov and use DataExtractor
2020-06-03 [gcov] Delete XFAIL: host-byteorder-big-endian
2020-06-03 [gcov] Make `Creating 'filename'` compatible with gcov
2020-06-03 [gcov] Don't error 'unexpected end of memory buffe'
2020-06-06 [gcov] Support big-endian .gcno and simplify version handling in .gcda
2020-06-06 [gcov] Delete `XFAIL: host-byteorder-big-endian` for test/
Transforms/GCOVProfiling/{exit-block.ll,function-numbering.ll}
2020-06-06 [gcov] Delete unneeded code
2020-06-06 [gcov] Improve tests and lower the minimum supported version to gcov 3.4
2020-06-07 [llvm-cov] Fix gcov version detection on big-endian
2020-06-07 [gcov][test] Delete UNSUPPORTED: host-byteorder-big-endian from test/
profile tests
2020-06-07 [gcov] Fix instrprof-gcov-__gcov_flush-terminate.test
2020-06-07 [gcov] Support .gcno/.gcda in gcov 8, 9 or 10 compatible formats
2020-06-09 [gcov][test] Add mkdir -p %t && cd %t
2020-06-16 [gcov] Refactor llvm-cov gcov and add SourceInfo
2020-06-16 [gcov] Add -i --intermediate-format
2020-06-16 [llvm-cov gcov] Don't suppress .gcov output if .gcda is corrupted
2020-06-17 [llvm-cov gcov] Support clang<11 fake 4.2 format
2020-07-01 [gcov] Move llvm_writeout_files from atexit to a static destructor
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov in Clang
Pass
# Position in the legacy pass manager pipeline
% clang --coverage -mllvm -debug-pass=Arguments -c a.c
Pass Arguments: -tti -targetlibinfo -ee-instrument
Pass Arguments: -tti -targetlibinfo -assumption-cache-tracker -profile-summary-info -insert-
gcov-profiling -strip -forceattrs -basiccg -always-inline
Pass Arguments: -tti -targetlibinfo -targetpassconfig ... -livedebugvalues -x86-seses -cfi-
instr-inserter -x86-lvi-ret -lazy-machine-block-freq -machine-opt-remark-emitter
# Close to -finstrument-functions, -fprofile-instr-generate
在 new pass manager 中的位置差不多。问题:instrument 部分位置太靠前了,而生成的函数必须提前来利用
后续的优化
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov in Clang
Instrumenter
Instrumenter
添加一个 static constructor __llvm_gcov_init,呼叫
runtime llvm_gcov_init
每个函数:@__llvm_gcov_ctr = internal global
[$n x i64] zeroinitializer, $n 为边数
basic block 转移时插入指令修改 __llvm_gcov_ctr 元
素
__llvm_gcov_writeout:输出所有 @__llvm_gcov_ctr
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov in Clang
Runtime
llvm_gcov_init
定义在 libclang_rt.profile-
x86_64.a(GCDAProfiling.c.o)
接收 writeout, flush, reset 三个 callbacks
writeout: 写.gcda
reset: 清零 counters
__gcov_flush=writeout+reset (无用,GCC 11 被移除)
设置 atexit hook,在程序退出时呼叫 writeout
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
gcov in Clang
llvm-cov gcov
llvm-cov gcov
gcov 3.4 10 + clang’s fake gcov 4.2 format
-i, --intermediate-format
-t, --stdout
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
Linux kernel
Linux kernel 的.gcda runtime
kernel/gcov/gcc_4_7.c
kernel/gcov/clang.c
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
Future work
Future work
减少 counters 数目:后移 pass
实现目前忽略的字段
gcov 8 模仿 coverage mapping,可以显示不同 template
instantiations 的行计数
llvm-cov gcov 准确支持 GCC>=9 行计数
gcov 和 clang
中的实现
MaskRay
Code coverage
gcov
lcov
Compatibility
gcov in Clang
My contribution
Pass
Instrumenter
Runtime
llvm-cov gcov
Linux kernel
Future work
References
gcov 和 clang 中的实现
References
References
https://gcc.gnu.org/onlinedocs/gcc/Gcov.html

Contenu connexe

Tendances

Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDPDaniel T. Lee
 
Timing Analysis of a Linux-Based CAN-to-CAN Gateway
Timing Analysis of a Linux-Based CAN-to-CAN GatewayTiming Analysis of a Linux-Based CAN-to-CAN Gateway
Timing Analysis of a Linux-Based CAN-to-CAN GatewayMichal Sojka
 
H 264 in cuda presentation
H 264 in cuda presentationH 264 in cuda presentation
H 264 in cuda presentationashoknaik120
 
Using GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnlUsing GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnlKentaro Ebisawa
 
BPF - All your packets belong to me
BPF - All your packets belong to meBPF - All your packets belong to me
BPF - All your packets belong to me_xhr_
 
A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...
A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...
A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...Shinya Takamaeda-Y
 
A Framework for Efficient Rapid Prototyping by Virtually Enlarging FPGA Resou...
A Framework for Efficient Rapid Prototyping by Virtually Enlarging FPGA Resou...A Framework for Efficient Rapid Prototyping by Virtually Enlarging FPGA Resou...
A Framework for Efficient Rapid Prototyping by Virtually Enlarging FPGA Resou...Shinya Takamaeda-Y
 
OpenJDK Concurrent Collectors
OpenJDK Concurrent CollectorsOpenJDK Concurrent Collectors
OpenJDK Concurrent CollectorsMonica Beckwith
 
Pragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
Pragmatic Optimization in Modern Programming - Mastering Compiler OptimizationsPragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
Pragmatic Optimization in Modern Programming - Mastering Compiler OptimizationsMarina Kolpakova
 
SRv6 Mobile User Plane : Initial POC and Implementation
SRv6 Mobile User Plane : Initial POC and ImplementationSRv6 Mobile User Plane : Initial POC and Implementation
SRv6 Mobile User Plane : Initial POC and ImplementationKentaro Ebisawa
 
Code GPU with CUDA - Memory Subsystem
Code GPU with CUDA - Memory SubsystemCode GPU with CUDA - Memory Subsystem
Code GPU with CUDA - Memory SubsystemMarina Kolpakova
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerMarina Kolpakova
 
ディープニューラルネットワーク向け拡張可能な高位合成コンパイラの開発
ディープニューラルネットワーク向け拡張可能な高位合成コンパイラの開発ディープニューラルネットワーク向け拡張可能な高位合成コンパイラの開発
ディープニューラルネットワーク向け拡張可能な高位合成コンパイラの開発Shinya Takamaeda-Y
 
A CGRA-based Approach for Accelerating Convolutional Neural Networks
A CGRA-based Approachfor Accelerating Convolutional Neural NetworksA CGRA-based Approachfor Accelerating Convolutional Neural Networks
A CGRA-based Approach for Accelerating Convolutional Neural NetworksShinya Takamaeda-Y
 
Rapid Software Communications Architecture (SCA) Development for DSPs with Sp...
Rapid Software Communications Architecture (SCA) Development for DSPs with Sp...Rapid Software Communications Architecture (SCA) Development for DSPs with Sp...
Rapid Software Communications Architecture (SCA) Development for DSPs with Sp...ADLINK Technology IoT
 

Tendances (20)

Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
 
Timing Analysis of a Linux-Based CAN-to-CAN Gateway
Timing Analysis of a Linux-Based CAN-to-CAN GatewayTiming Analysis of a Linux-Based CAN-to-CAN Gateway
Timing Analysis of a Linux-Based CAN-to-CAN Gateway
 
H 264 in cuda presentation
H 264 in cuda presentationH 264 in cuda presentation
H 264 in cuda presentation
 
Using GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnlUsing GTP on Linux with libgtpnl
Using GTP on Linux with libgtpnl
 
BPF - All your packets belong to me
BPF - All your packets belong to meBPF - All your packets belong to me
BPF - All your packets belong to me
 
A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...
A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...
A High Performance Heterogeneous FPGA-based Accelerator with PyCoRAM (Runner ...
 
A Framework for Efficient Rapid Prototyping by Virtually Enlarging FPGA Resou...
A Framework for Efficient Rapid Prototyping by Virtually Enlarging FPGA Resou...A Framework for Efficient Rapid Prototyping by Virtually Enlarging FPGA Resou...
A Framework for Efficient Rapid Prototyping by Virtually Enlarging FPGA Resou...
 
GTPing, How To
GTPing, How ToGTPing, How To
GTPing, How To
 
OpenJDK Concurrent Collectors
OpenJDK Concurrent CollectorsOpenJDK Concurrent Collectors
OpenJDK Concurrent Collectors
 
Ch2 arm-1
Ch2 arm-1Ch2 arm-1
Ch2 arm-1
 
Pragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
Pragmatic Optimization in Modern Programming - Mastering Compiler OptimizationsPragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
Pragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
 
SRv6 Mobile User Plane : Initial POC and Implementation
SRv6 Mobile User Plane : Initial POC and ImplementationSRv6 Mobile User Plane : Initial POC and Implementation
SRv6 Mobile User Plane : Initial POC and Implementation
 
Code GPU with CUDA - Memory Subsystem
Code GPU with CUDA - Memory SubsystemCode GPU with CUDA - Memory Subsystem
Code GPU with CUDA - Memory Subsystem
 
Understanding jvm
Understanding jvmUnderstanding jvm
Understanding jvm
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
 
ディープニューラルネットワーク向け拡張可能な高位合成コンパイラの開発
ディープニューラルネットワーク向け拡張可能な高位合成コンパイラの開発ディープニューラルネットワーク向け拡張可能な高位合成コンパイラの開発
ディープニューラルネットワーク向け拡張可能な高位合成コンパイラの開発
 
Polyraptor
PolyraptorPolyraptor
Polyraptor
 
Rsltollvm
RsltollvmRsltollvm
Rsltollvm
 
A CGRA-based Approach for Accelerating Convolutional Neural Networks
A CGRA-based Approachfor Accelerating Convolutional Neural NetworksA CGRA-based Approachfor Accelerating Convolutional Neural Networks
A CGRA-based Approach for Accelerating Convolutional Neural Networks
 
Rapid Software Communications Architecture (SCA) Development for DSPs with Sp...
Rapid Software Communications Architecture (SCA) Development for DSPs with Sp...Rapid Software Communications Architecture (SCA) Development for DSPs with Sp...
Rapid Software Communications Architecture (SCA) Development for DSPs with Sp...
 

Similaire à gcov和clang中的实现

DevFest 2022 - Skaffold 2 Deep Dive Taipei.pdf
DevFest 2022 - Skaffold 2 Deep Dive Taipei.pdfDevFest 2022 - Skaffold 2 Deep Dive Taipei.pdf
DevFest 2022 - Skaffold 2 Deep Dive Taipei.pdfKAI CHU CHUNG
 
Shakr - Container CI/CD with Google Cloud Platform
Shakr - Container CI/CD with Google Cloud PlatformShakr - Container CI/CD with Google Cloud Platform
Shakr - Container CI/CD with Google Cloud PlatformMinku Lee
 
The GStreamer-VAAPI report (GStreamer Conference 2017)
The GStreamer-VAAPI report (GStreamer Conference 2017)The GStreamer-VAAPI report (GStreamer Conference 2017)
The GStreamer-VAAPI report (GStreamer Conference 2017)Igalia
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVMJohn Lee
 
A Detailed Look at Cairo's OpenGL Spans Compositor Performance
A Detailed Look at Cairo's OpenGL Spans Compositor PerformanceA Detailed Look at Cairo's OpenGL Spans Compositor Performance
A Detailed Look at Cairo's OpenGL Spans Compositor PerformanceSamsung Open Source Group
 
Building a Bridge between Terraform and ArgoCD
Building a Bridge between Terraform and ArgoCDBuilding a Bridge between Terraform and ArgoCD
Building a Bridge between Terraform and ArgoCDCarlos Santana
 
What is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 editionWhat is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 editionIgalia
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Petr Zapletal
 
How to build 1000 microservices with Kafka and thrive
How to build 1000 microservices with Kafka and thriveHow to build 1000 microservices with Kafka and thrive
How to build 1000 microservices with Kafka and thriveNatan Silnitsky
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019corehard_by
 
Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022QAware GmbH
 
Extended and embedding: containerd update & project use cases
Extended and embedding: containerd update & project use casesExtended and embedding: containerd update & project use cases
Extended and embedding: containerd update & project use casesPhil Estes
 
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...Chris Richardson
 
Using gcov and lcov
Using gcov and lcovUsing gcov and lcov
Using gcov and lcovtest test
 
GE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoTGE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoTKai Zhao
 

Similaire à gcov和clang中的实现 (20)

DevFest 2022 - Skaffold 2 Deep Dive Taipei.pdf
DevFest 2022 - Skaffold 2 Deep Dive Taipei.pdfDevFest 2022 - Skaffold 2 Deep Dive Taipei.pdf
DevFest 2022 - Skaffold 2 Deep Dive Taipei.pdf
 
Shakr - Container CI/CD with Google Cloud Platform
Shakr - Container CI/CD with Google Cloud PlatformShakr - Container CI/CD with Google Cloud Platform
Shakr - Container CI/CD with Google Cloud Platform
 
The GStreamer-VAAPI report (GStreamer Conference 2017)
The GStreamer-VAAPI report (GStreamer Conference 2017)The GStreamer-VAAPI report (GStreamer Conference 2017)
The GStreamer-VAAPI report (GStreamer Conference 2017)
 
More kibana
More kibanaMore kibana
More kibana
 
Android RenderScript on LLVM
Android RenderScript on LLVMAndroid RenderScript on LLVM
Android RenderScript on LLVM
 
A Detailed Look at Cairo's OpenGL Spans Compositor Performance
A Detailed Look at Cairo's OpenGL Spans Compositor PerformanceA Detailed Look at Cairo's OpenGL Spans Compositor Performance
A Detailed Look at Cairo's OpenGL Spans Compositor Performance
 
Building a Bridge between Terraform and ArgoCD
Building a Bridge between Terraform and ArgoCDBuilding a Bridge between Terraform and ArgoCD
Building a Bridge between Terraform and ArgoCD
 
Serving models using KFServing
Serving models using KFServingServing models using KFServing
Serving models using KFServing
 
groovy & grails - lecture 9
groovy & grails - lecture 9groovy & grails - lecture 9
groovy & grails - lecture 9
 
What is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 editionWhat is new with JavaScript in Gnome: The 2021 edition
What is new with JavaScript in Gnome: The 2021 edition
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018Adopting GraalVM - Scale by the Bay 2018
Adopting GraalVM - Scale by the Bay 2018
 
GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
 
How to build 1000 microservices with Kafka and thrive
How to build 1000 microservices with Kafka and thriveHow to build 1000 microservices with Kafka and thrive
How to build 1000 microservices with Kafka and thrive
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
 
Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022
 
Extended and embedding: containerd update & project use cases
Extended and embedding: containerd update & project use casesExtended and embedding: containerd update & project use cases
Extended and embedding: containerd update & project use cases
 
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
CommunityOneEast 09 - Dynamic Languages: the next big thing for the JVM or an...
 
Using gcov and lcov
Using gcov and lcovUsing gcov and lcov
Using gcov and lcov
 
GE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoTGE Predix 新手入门 赵锴 物联网_IoT
GE Predix 新手入门 赵锴 物联网_IoT
 

Plus de Ray Song

C++ exception handling
C++ exception handlingC++ exception handling
C++ exception handlingRay Song
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyRay Song
 
Cyber Grand Challenge及DEFCON 24 CTF决赛介绍
Cyber Grand Challenge及DEFCON 24 CTF决赛介绍Cyber Grand Challenge及DEFCON 24 CTF决赛介绍
Cyber Grand Challenge及DEFCON 24 CTF决赛介绍Ray Song
 
OI算法竞赛中树形数据结构
OI算法竞赛中树形数据结构OI算法竞赛中树形数据结构
OI算法竞赛中树形数据结构Ray Song
 
Implementing a Simple Interpreter
Implementing a Simple InterpreterImplementing a Simple Interpreter
Implementing a Simple InterpreterRay Song
 
2011年信息学竞赛冬令营《星际探险》
2011年信息学竞赛冬令营《星际探险》2011年信息学竞赛冬令营《星际探险》
2011年信息学竞赛冬令营《星际探险》Ray Song
 
8门编程语言的设计思考
8门编程语言的设计思考8门编程语言的设计思考
8门编程语言的设计思考Ray Song
 
Introduction to makefile
Introduction to makefileIntroduction to makefile
Introduction to makefileRay Song
 

Plus de Ray Song (8)

C++ exception handling
C++ exception handlingC++ exception handling
C++ exception handling
 
r2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCyr2con 2017 r2cLEMENCy
r2con 2017 r2cLEMENCy
 
Cyber Grand Challenge及DEFCON 24 CTF决赛介绍
Cyber Grand Challenge及DEFCON 24 CTF决赛介绍Cyber Grand Challenge及DEFCON 24 CTF决赛介绍
Cyber Grand Challenge及DEFCON 24 CTF决赛介绍
 
OI算法竞赛中树形数据结构
OI算法竞赛中树形数据结构OI算法竞赛中树形数据结构
OI算法竞赛中树形数据结构
 
Implementing a Simple Interpreter
Implementing a Simple InterpreterImplementing a Simple Interpreter
Implementing a Simple Interpreter
 
2011年信息学竞赛冬令营《星际探险》
2011年信息学竞赛冬令营《星际探险》2011年信息学竞赛冬令营《星际探险》
2011年信息学竞赛冬令营《星际探险》
 
8门编程语言的设计思考
8门编程语言的设计思考8门编程语言的设计思考
8门编程语言的设计思考
 
Introduction to makefile
Introduction to makefileIntroduction to makefile
Introduction to makefile
 

Dernier

How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 

Dernier (20)

How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 

gcov和clang中的实现

  • 1. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov 和 clang 中的实现 MaskRay https://maskray.me
  • 2. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 1 Code coverage 2 gcov 3 gcov in Clang 4 Linux kernel 5 Future work 6 References
  • 3. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 MaskRay LLVM contributor
  • 4. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 MaskRay LLVM contributor ccls owner (C++ language server)
  • 5. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 MaskRay LLVM contributor ccls owner (C++ language server) 退休的算法竞赛 + 超算 +CTF 选手
  • 6. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 MaskRay 退休的算法竞赛 + 超算 +CTF 选手
  • 7. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 Code coverage Motivation Found a Bug
  • 8. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 Code coverage Motivation Found a Bug – Why is it not covered?
  • 9. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 Code coverage Motivation Found a Bug – Why is it not covered? Find dead code
  • 10. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 Code coverage Code coverage tools gcc --coverage + gcov Clang coverage mapping clang -fprofile-instr- generate -fcoverage-mapping + llvm-cov clang -fsanitize-coverage=trace-pc-guard, {edge,bb,func} -fsanitize={address,memory,thread,...} + sancov
  • 11. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov gcov gcc -fprofile-arcs -ftest-coverage a.c b.c # --coverage compile-time -fprofile-arcs ⇒ a.gcno b.gcno (notes file) ./a.out ⇒ a.gcda b.gcda (count data file) gcov a.c # or a. ⇒ a.c.gcov gcov b.gcno # or b. ⇒ b.c.gcov gcov -h
  • 12. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov lcov lcov https://github.com/linux-test-project/lcov, gcov’s graphical front-end lcov --gcov-tool gcov -c -d . -o a.info genhtml a.info -o html
  • 13. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov lcov % lcov --gcov-tool gcov-9 -c -d . -o a.info Capturing coverage data from . Found gcov version: 9.3.0 Using intermediate gcov format Scanning . for .gcda files ... Found 2 data files in . Processing b.gcda Processing a.gcda Finished .info-file creation % genhtml a.info -o html Reading data file a.info Found 2 entries. Found common filename prefix "/tmp" Writing .css and .png files. Generating output. Processing file c/a.c Processing file c/b.c Writing directory view page. Overall coverage rate: lines......: 100.0% (4 of 4 lines) functions..: 100.0% (2 of 2 functions)
  • 14. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov Compatibility Compatibility .gcno/.gcda format changed several times: GCC 3.4, 4.7, 4.8, 8, 9 % gcc-9 --coverage a.c; ./a.out; gcov-10 a. a.gcno:version 'A93*', prefer 'B00e' a.gcda:version 'A93*', prefer version 'B00e' File 'a.c' Lines executed:100.00% of 2 Creating 'a.c.gcov' % gcov-8 a. a.gcno:version 'A93*', prefer 'A84*' a.gcno:no functions found a.gcda:version 'A93*', prefer version 'A84*'
  • 15. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov in Clang gcov in Clang clang --coverage # -fprofile-arcs -ftest- coverage clang --coverage -Xclang -coverage- version='408*' gcov 4.8 7 compatible instrumenter (write .gcno, generate calls into runtime) ⇔ gcc/coverage.c runtime (write .gcda) ⇔ libgcov.a (libgcc/libgcov-driver.c & friends) llvm-cov gcov ⇔ gcov
  • 16. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov in Clang My contribution 2020-05-10 [gcov] Fix .gcda decoding and support GCC 8, 9 and 10 2020-05-10 [gcov] Don't skip leading zeros when reading a string 2020-05-10 [gcov] Temporarily unsupport host-byteorder-big-endian 2020-05-10 [compiler-rt][test] Add feature host-byteorder-big-endian 2020-05-10 [gcov] Temporarily unsupport host-byteorder-big-endian 2020-05-10 [gcov] Delete CC1 option -coverage-no-function-names-in-data 2020-05-10 [gcov] Default coverage version to '407*' and delete CC1 option -coverage-cf 2020-05-10 [gcov] Implement --stdout -t 2020-05-11 [gcov] Emit GCOV_TAG_OBJECT_SUMMARY/GCOV_TAG_PROGRAM_SUMMARY correctly and f 2020-05-11 Revert part of D49132 "[gcov] Fix gcov profiling on big-endian machines" 2020-05-11 [gcov] Fix big-endian problems 2020-05-12 [gcov] Default coverage version to '408*' and delete CC1 option -coverage-ex 2020-05-12 [gcov][test] Fix clang test 2020-06-03 [gcov] Improve .gcno compatibility with gcov and use DataExtractor 2020-06-03 [gcov] Delete XFAIL: host-byteorder-big-endian 2020-06-03 [gcov] Make `Creating 'filename'` compatible with gcov 2020-06-03 [gcov] Don't error 'unexpected end of memory buffe' 2020-06-06 [gcov] Support big-endian .gcno and simplify version handling in .gcda 2020-06-06 [gcov] Delete `XFAIL: host-byteorder-big-endian` for test/ Transforms/GCOVProfiling/{exit-block.ll,function-numbering.ll} 2020-06-06 [gcov] Delete unneeded code 2020-06-06 [gcov] Improve tests and lower the minimum supported version to gcov 3.4 2020-06-07 [llvm-cov] Fix gcov version detection on big-endian 2020-06-07 [gcov][test] Delete UNSUPPORTED: host-byteorder-big-endian from test/ profile tests 2020-06-07 [gcov] Fix instrprof-gcov-__gcov_flush-terminate.test 2020-06-07 [gcov] Support .gcno/.gcda in gcov 8, 9 or 10 compatible formats 2020-06-09 [gcov][test] Add mkdir -p %t && cd %t 2020-06-16 [gcov] Refactor llvm-cov gcov and add SourceInfo 2020-06-16 [gcov] Add -i --intermediate-format 2020-06-16 [llvm-cov gcov] Don't suppress .gcov output if .gcda is corrupted 2020-06-17 [llvm-cov gcov] Support clang<11 fake 4.2 format 2020-07-01 [gcov] Move llvm_writeout_files from atexit to a static destructor
  • 17. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov in Clang Pass # Position in the legacy pass manager pipeline % clang --coverage -mllvm -debug-pass=Arguments -c a.c Pass Arguments: -tti -targetlibinfo -ee-instrument Pass Arguments: -tti -targetlibinfo -assumption-cache-tracker -profile-summary-info -insert- gcov-profiling -strip -forceattrs -basiccg -always-inline Pass Arguments: -tti -targetlibinfo -targetpassconfig ... -livedebugvalues -x86-seses -cfi- instr-inserter -x86-lvi-ret -lazy-machine-block-freq -machine-opt-remark-emitter # Close to -finstrument-functions, -fprofile-instr-generate 在 new pass manager 中的位置差不多。问题:instrument 部分位置太靠前了,而生成的函数必须提前来利用 后续的优化
  • 18. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov in Clang Instrumenter Instrumenter 添加一个 static constructor __llvm_gcov_init,呼叫 runtime llvm_gcov_init 每个函数:@__llvm_gcov_ctr = internal global [$n x i64] zeroinitializer, $n 为边数 basic block 转移时插入指令修改 __llvm_gcov_ctr 元 素 __llvm_gcov_writeout:输出所有 @__llvm_gcov_ctr
  • 19. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov in Clang Runtime llvm_gcov_init 定义在 libclang_rt.profile- x86_64.a(GCDAProfiling.c.o) 接收 writeout, flush, reset 三个 callbacks writeout: 写.gcda reset: 清零 counters __gcov_flush=writeout+reset (无用,GCC 11 被移除) 设置 atexit hook,在程序退出时呼叫 writeout
  • 20. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 gcov in Clang llvm-cov gcov llvm-cov gcov gcov 3.4 10 + clang’s fake gcov 4.2 format -i, --intermediate-format -t, --stdout
  • 21. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 Linux kernel Linux kernel 的.gcda runtime kernel/gcov/gcc_4_7.c kernel/gcov/clang.c
  • 22. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 Future work Future work 减少 counters 数目:后移 pass 实现目前忽略的字段 gcov 8 模仿 coverage mapping,可以显示不同 template instantiations 的行计数 llvm-cov gcov 准确支持 GCC>=9 行计数
  • 23. gcov 和 clang 中的实现 MaskRay Code coverage gcov lcov Compatibility gcov in Clang My contribution Pass Instrumenter Runtime llvm-cov gcov Linux kernel Future work References gcov 和 clang 中的实现 References References https://gcc.gnu.org/onlinedocs/gcc/Gcov.html