/usr/share/doc/clang-3.9-doc/html/SanitizerStats.html is in clang-3.9-doc 1:3.9.1-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SanitizerStats — Clang 3.9 documentation</title>
<link rel="stylesheet" href="_static/haiku.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.9',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="top" title="Clang 3.9 documentation" href="index.html" />
<link rel="next" title="Sanitizer special case list" href="SanitizerSpecialCaseList.html" />
<link rel="prev" title="SanitizerCoverage" href="SanitizerCoverage.html" />
</head>
<body role="document">
<div class="header" role="banner"><h1 class="heading"><a href="index.html">
<span>Clang 3.9 documentation</span></a></h1>
<h2 class="heading"><span>SanitizerStats</span></h2>
</div>
<div class="topnav" role="navigation" aria-label="top navigation">
<p>
«  <a href="SanitizerCoverage.html">SanitizerCoverage</a>
  ::  
<a class="uplink" href="index.html">Contents</a>
  ::  
<a href="SanitizerSpecialCaseList.html">Sanitizer special case list</a>  »
</p>
</div>
<div class="content">
<div class="section" id="sanitizerstats">
<h1>SanitizerStats<a class="headerlink" href="#sanitizerstats" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
<li><a class="reference internal" href="#how-to-build-and-run" id="id2">How to build and run</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#id1">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>The sanitizers support a simple mechanism for gathering profiling statistics
to help understand the overhead associated with sanitizers.</p>
</div>
<div class="section" id="how-to-build-and-run">
<h2><a class="toc-backref" href="#id2">How to build and run</a><a class="headerlink" href="#how-to-build-and-run" title="Permalink to this headline">¶</a></h2>
<p>SanitizerStats can currently only be used with <a class="reference internal" href="ControlFlowIntegrity.html"><span class="doc">Control Flow Integrity</span></a>.
In addition to <code class="docutils literal"><span class="pre">-fsanitize=cfi*</span></code>, pass the <code class="docutils literal"><span class="pre">-fsanitize-stats</span></code> flag.
This will cause the program to count the number of times that each control
flow integrity check in the program fires.</p>
<p>At run time, set the <code class="docutils literal"><span class="pre">SANITIZER_STATS_PATH</span></code> environment variable to direct
statistics output to a file. The file will be written on process exit.
The following substitutions will be applied to the environment variable:</p>
<blockquote>
<div><ul class="simple">
<li><code class="docutils literal"><span class="pre">%b</span></code> – The executable basename.</li>
<li><code class="docutils literal"><span class="pre">%p</span></code> – The process ID.</li>
</ul>
</div></blockquote>
<p>You can also send the <code class="docutils literal"><span class="pre">SIGUSR2</span></code> signal to a process to make it write
sanitizer statistics immediately.</p>
<p>The <code class="docutils literal"><span class="pre">sanstats</span></code> program can be used to dump statistics. It takes as a
command line argument the path to a statistics file produced by a program
compiled with <code class="docutils literal"><span class="pre">-fsanitize-stats</span></code>.</p>
<p>The output of <code class="docutils literal"><span class="pre">sanstats</span></code> is in four columns, separated by spaces. The first
column is the file and line number of the call site. The second column is
the function name. The third column is the type of statistic gathered (in
this case, the type of control flow integrity check). The fourth column is
the call count.</p>
<p>Example:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> cat -n vcall.cc
<span class="go"> 1 struct A {</span>
<span class="go"> 2 virtual void f() {}</span>
<span class="go"> 3 };</span>
<span class="go"> 4</span>
<span class="go"> 5 __attribute__((noinline)) void g(A *a) {</span>
<span class="go"> 6 a->f();</span>
<span class="go"> 7 }</span>
<span class="go"> 8</span>
<span class="go"> 9 int main() {</span>
<span class="go"> 10 A a;</span>
<span class="go"> 11 g(&a);</span>
<span class="go"> 12 }</span>
<span class="gp">$</span> clang++ -fsanitize<span class="o">=</span>cfi -flto -fuse-ld<span class="o">=</span>gold vcall.cc -fsanitize-stats -g
<span class="gp">$</span> <span class="nv">SANITIZER_STATS_PATH</span><span class="o">=</span>a.stats ./a.out
<span class="gp">$</span> sanstats a.stats
<span class="go">vcall.cc:6 _Z1gP1A cfi-vcall 1</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="bottomnav" role="navigation" aria-label="bottom navigation">
<p>
«  <a href="SanitizerCoverage.html">SanitizerCoverage</a>
  ::  
<a class="uplink" href="index.html">Contents</a>
  ::  
<a href="SanitizerSpecialCaseList.html">Sanitizer special case list</a>  »
</p>
</div>
<div class="footer" role="contentinfo">
© Copyright 2007-2017, The Clang Team.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9.
</div>
</body>
</html>
|