SlideShare a Scribd company logo
1 of 23
Download to read offline
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

More Related Content

What's hot

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
 

What's hot (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...
 

Similar to 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
 

Similar to 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
 

More from 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
 

More from 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
 

Recently uploaded

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 

Recently uploaded (20)

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

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