| <!-- |
| Documentation/_templates/layout.html |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. The |
| ASF licenses this file to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance with the |
| License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| License for the specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en"> |
| <head> |
| <meta charset="utf-8" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>gcov gcov tool — NuttX latest documentation</title> |
| <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/custom.css" /> |
| |
| |
| <link rel="shortcut icon" href="../../../_static/favicon.ico"/> |
| <script src="../../../_static/jquery.js"></script> |
| <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script> |
| <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script> |
| <script src="../../../_static/doctools.js"></script> |
| <script src="../../../_static/sphinx_highlight.js"></script> |
| <script src="../../../_static/clipboard.min.js"></script> |
| <script src="../../../_static/copybutton.js"></script> |
| <script src="../../../_static/js/theme.js"></script> |
| <link rel="index" title="Index" href="../../../genindex.html" /> |
| <link rel="search" title="Search" href="../../../search.html" /> |
| <link rel="next" title="gdbstub GDBSTUB" href="../gdbstub/index.html" /> |
| <link rel="prev" title="flash_eraseall FLASH Erase-all Command" href="../flash_eraseall/index.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| <div class="wy-grid-for-nav"> |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| <a href="../../../index.html" class="icon icon-home"> NuttX |
| |
| |
| |
| </a> |
| |
| <!-- this version selector is quite ugly, should be probably replaced by something |
| more modern --> |
| |
| <div class="version-selector"> |
| <select onchange="javascript:location.href = this.value;"> |
| |
| <option value="../../../../latest" selected="selected">latest</option> |
| |
| <option value="../../../../10.0.0" >10.0.0</option> |
| |
| <option value="../../../../10.0.1" >10.0.1</option> |
| |
| <option value="../../../../10.1.0" >10.1.0</option> |
| |
| <option value="../../../../10.2.0" >10.2.0</option> |
| |
| <option value="../../../../10.3.0" >10.3.0</option> |
| |
| <option value="../../../../11.0.0" >11.0.0</option> |
| |
| <option value="../../../../12.0.0" >12.0.0</option> |
| |
| <option value="../../../../12.1.0" >12.1.0</option> |
| |
| <option value="../../../../12.2.0" >12.2.0</option> |
| |
| <option value="../../../../12.2.1" >12.2.1</option> |
| |
| <option value="../../../../12.3.0" >12.3.0</option> |
| |
| <option value="../../../../12.4.0" >12.4.0</option> |
| |
| <option value="../../../../12.5.0" >12.5.0</option> |
| |
| <option value="../../../../12.5.1" >12.5.1</option> |
| |
| <option value="../../../../12.6.0" >12.6.0</option> |
| |
| <option value="../../../../12.7.0" >12.7.0</option> |
| |
| <option value="../../../../12.8.0" >12.8.0</option> |
| |
| <option value="../../../../12.9.0" >12.9.0</option> |
| |
| <option value="../../../../12.10.0" >12.10.0</option> |
| |
| <option value="../../../../12.11.0" >12.11.0</option> |
| |
| </select> |
| </div> |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> |
| <p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../../index.html">Home</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../introduction/index.html">Introduction</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../quickstart/index.html">Getting Started</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../contributing/index.html">Contributing</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../platforms/index.html">Supported Platforms</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../components/index.html">OS Components</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Applications</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../../audioutils/index.html">Audio Utility libraries</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../boot/index.html">Bootloader Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../benchmarks/index.html">Benchmark Applications</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../canutils/index.html">CAN Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../crypto/index.html">Cryptography Library Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../fsutils/index.html">File System Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../games/index.html">Games</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../graphics/index.html">Graphics Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../industry/index.html">Industrial Applications</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../inertial/index.html">Inertial Libraries Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../interpreters/index.html">Interpreters</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../logging/index.html">Logging Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../lte/index.html">LTE Libraries and NSH Add-Ons</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../math/index.html">Math Library Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../mlearing/index.html">Machine Learning Support</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../netutils/index.html">Network Utilities</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../nsh/index.html">NuttShell (NSH)</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../sdr/index.html">Software Define Radio Libraries</a></li> |
| <li class="toctree-l2 current"><a class="reference internal" href="../index.html">System Libraries and NSH Add-Ons</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="../adb/index.html"><code class="docutils literal notranslate"><span class="pre">adb</span></code> ADB daemon application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../argtable3/index.html"><code class="docutils literal notranslate"><span class="pre">argtable3</span></code> ARGTABLE3 library</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../cdcacm/index.html"><code class="docutils literal notranslate"><span class="pre">cdcacm</span></code> USB CDC/ACM Device Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../cfgdata/index.html"><code class="docutils literal notranslate"><span class="pre">cfgdata</span></code> Cfgdata Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../cle/index.html"><code class="docutils literal notranslate"><span class="pre">cle</span></code> EMACS-like Command Line Editor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../composite/index.html"><code class="docutils literal notranslate"><span class="pre">composite</span></code> USB Composite Device Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../coredump/index.html"><code class="docutils literal notranslate"><span class="pre">coredump</span></code> Coredump tool capture system status</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../crimon/index.html"><code class="docutils literal notranslate"><span class="pre">critmon</span></code> Critcal Section Monitor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../cu/index.html"><code class="docutils literal notranslate"><span class="pre">cu</span></code> CU minimal serial terminal</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../dd/index.html"><code class="docutils literal notranslate"><span class="pre">dd</span></code> system āddā command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../debugpoint/index.html"><code class="docutils literal notranslate"><span class="pre">debugpoint</span></code> Debug Utility</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../dhcp6c/index.html"><code class="docutils literal notranslate"><span class="pre">dhcp6c</span></code> DHCP IPv6 Address Renewal</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../dhcpc/index.html"><code class="docutils literal notranslate"><span class="pre">dhcpc</span></code> DHCP Address Renewal</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../dumpstack/index.html"><code class="docutils literal notranslate"><span class="pre">dumpstack</span></code> dumpstack tool for show the task backtrace</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../fastboot/index.html"><code class="docutils literal notranslate"><span class="pre">fastboot</span></code> fastbootd</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../fdt/index.html"><code class="docutils literal notranslate"><span class="pre">fdt</span></code> fdt utility tools</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../flash_eraseall/index.html"><code class="docutils literal notranslate"><span class="pre">flash_eraseall</span></code> FLASH Erase-all Command</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">gcov</span></code> gcov tool</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#support">Support</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="#usage">Usage</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="#app-usage">App-Usage</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#examples-of-applicable-platforms">Examples of applicable platforms</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../gdbstub/index.html"><code class="docutils literal notranslate"><span class="pre">gdbstub</span></code> GDBSTUB</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../gprof/index.html"><code class="docutils literal notranslate"><span class="pre">gprof</span></code> GNU Profile tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../hex2bin/index.html"><code class="docutils literal notranslate"><span class="pre">hex2bin</span></code> Intel HEX to binary conversion</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../hexed/index.html"><code class="docutils literal notranslate"><span class="pre">hexed</span></code> Hex editor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../hostname/index.html"><code class="docutils literal notranslate"><span class="pre">hostname</span></code> āhostnameā command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../i2c/index.html"><code class="docutils literal notranslate"><span class="pre">i2c</span></code> I2C Tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../input/index.html"><code class="docutils literal notranslate"><span class="pre">input</span></code> input tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../iptables/index.html"><code class="docutils literal notranslate"><span class="pre">iptables</span></code> āiptablesā command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../libuv/index.html"><code class="docutils literal notranslate"><span class="pre">libuv</span></code> libuv asynchronous I/O Library</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../lm75/index.html"><code class="docutils literal notranslate"><span class="pre">lm75</span></code> LM75 Temperature</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../lzf/index.html"><code class="docutils literal notranslate"><span class="pre">lzf</span></code> LZF compression tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../mdio/index.html"><code class="docutils literal notranslate"><span class="pre">mdio</span></code> PHY MDIO tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../netdb/index.html"><code class="docutils literal notranslate"><span class="pre">netdb</span></code> netdb interface</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nsh/index.html"><code class="docutils literal notranslate"><span class="pre">nsh</span></code> NuttShell (NSH) example</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ntpc/index.html"><code class="docutils literal notranslate"><span class="pre">ntpc</span></code> NTP Daemon Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxcamera/index.html"><code class="docutils literal notranslate"><span class="pre">nxcamera</span></code> NxCamera video test application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxcodec/index.html"><code class="docutils literal notranslate"><span class="pre">nxcodec</span></code> NxCodec video codec test application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxdiag/index.html"><code class="docutils literal notranslate"><span class="pre">nxdiag</span></code> NuttX Diagnostic Tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxlooper/index.html"><code class="docutils literal notranslate"><span class="pre">nxlooper</span></code> NxLooper audio test application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxplayer/index.html"><code class="docutils literal notranslate"><span class="pre">nxplayer</span></code> NxPlayer Media Player</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nxrecorder/index.html"><code class="docutils literal notranslate"><span class="pre">nxrecorder</span></code> NxRecorder pcm raw data Recorder</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ofloader/index.html"><code class="docutils literal notranslate"><span class="pre">ofloader</span></code> Open flash loader</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ping/index.html"><code class="docutils literal notranslate"><span class="pre">ping</span></code> ICMP āpingā command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ping6/index.html"><code class="docutils literal notranslate"><span class="pre">ping6</span></code> ICMPv6 āping6ā command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../popen/index.html"><code class="docutils literal notranslate"><span class="pre">popen</span></code> popen()/pclose() Functions</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../psmq/index.html"><code class="docutils literal notranslate"><span class="pre">psmq</span></code> Publish Subscribe Message Queue</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ptpd/index.html"><code class="docutils literal notranslate"><span class="pre">ptpd</span></code> PTP daemon commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../readline/index.html"><code class="docutils literal notranslate"><span class="pre">readline</span></code> readline() Support</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../sched_note/index.html"><code class="docutils literal notranslate"><span class="pre">sched_note</span></code> Scheduler monitor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../setlogmask/index.html"><code class="docutils literal notranslate"><span class="pre">setlogmask</span></code> āsetlogmaskā command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../spi/index.html"><code class="docutils literal notranslate"><span class="pre">spi</span></code> SPI Tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../stackmonitor/index.html"><code class="docutils literal notranslate"><span class="pre">stackmonitor</span></code> Stack Monitor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../system/index.html"><code class="docutils literal notranslate"><span class="pre">system</span></code> System Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../taskset/index.html"><code class="docutils literal notranslate"><span class="pre">taskset</span></code> Taskset Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../tcpdump/index.html"><code class="docutils literal notranslate"><span class="pre">tcpdump</span></code> tcpdump command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../tee/index.html"><code class="docutils literal notranslate"><span class="pre">tee</span></code> Tee Command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../telnet/index.html"><code class="docutils literal notranslate"><span class="pre">telnet</span></code> Telnet chat daemon</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../telnetd/index.html"><code class="docutils literal notranslate"><span class="pre">telnetd</span></code> Telnet daemon application</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../termcurses/index.html"><code class="docutils literal notranslate"><span class="pre">termcurses</span></code> Terminal Curses control support</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../trace/index.html"><code class="docutils literal notranslate"><span class="pre">trace</span></code> Trace command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ubloxmodem/index.html"><code class="docutils literal notranslate"><span class="pre">ubloxmodem</span></code> u-blox modem configuration tool</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../uniqueid/index.html"><code class="docutils literal notranslate"><span class="pre">uniqueid</span></code> āuniqueidā command</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../uorb/index.html"><code class="docutils literal notranslate"><span class="pre">uorb</span></code> uorb(micro object request broker)</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../usbmsc/index.html"><code class="docutils literal notranslate"><span class="pre">usbmsc</span></code> USB Mass Storage Device Commands</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../vi/index.html"><code class="docutils literal notranslate"><span class="pre">vi</span></code> VI Work-Alike Text Editor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../ymodem/index.html"><code class="docutils literal notranslate"><span class="pre">ymodem</span></code> YMODEM</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../zlib/index.html"><code class="docutils literal notranslate"><span class="pre">zlib</span></code> zlib data compression library</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../zmodem/index.html"><code class="docutils literal notranslate"><span class="pre">zmodem</span></code> Zmodem Commands</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../testing/index.html">Testing</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../tools/index.html">Host Side Tools</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../wireless/index.html">Wireless Libraries and NSH Add-Ons</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../examples/index.html">Examples</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../implementation/index.html">Implementation Details</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../reference/index.html">API Reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../faq/index.html">FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../guides/index.html">Guides</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../glossary.html">Glossary</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../logos/index.html">NuttX Logos</a></li> |
| </ul> |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../../../index.html">NuttX</a> |
| </nav> |
| |
| <div class="wy-nav-content"> |
| <div class="rst-content"> |
| <div role="navigation" aria-label="Page navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li> |
| <li class="breadcrumb-item"><a href="../../index.html">Applications</a></li> |
| <li class="breadcrumb-item"><a href="../index.html">System Libraries and NSH Add-Ons</a></li> |
| <li class="breadcrumb-item active"><code class="docutils literal notranslate"><span class="pre">gcov</span></code> gcov tool</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="../../../_sources/applications/system/gcov/index.rst.txt" rel="nofollow"> View page source</a> |
| </li> |
| </ul> |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <section id="gcov-gcov-tool"> |
| <h1><code class="docutils literal notranslate"><span class="pre">gcov</span></code> gcov tool<a class="headerlink" href="#gcov-gcov-tool" title="Permalink to this heading">ļ</a></h1> |
| <p>gcov is a tool for testing code coverage. |
| After the program is run, you can view the line coverage, function coverage, |
| and branch coverage of each file.</p> |
| <section id="support"> |
| <h2>Support<a class="headerlink" href="#support" title="Permalink to this heading">ļ</a></h2> |
| <p>The current system supports four code coverage detection implementations:</p> |
| <ol class="arabic simple"> |
| <li><p>GCC native implementation</p></li> |
| <li><p>CLANG native implementation</p></li> |
| <li><p>GCC coverage nuttx mini version</p></li> |
| <li><p>CLANG coverage nuttx mini version</p></li> |
| </ol> |
| <p>The following table shows the specific differences between the four implementations |
| ends 24.11.26ļ¼</p> |
| <p>Support GCC-native CLANG-native GCC-nuttx-mini CLANG-nuttx-mini |
| Compiler version: ALL ALL GCC 13.2 and below CLANG 17.0 and below</p> |
| <p>Program coverage statistics support:</p> |
| <p>Main Program ā ā ā ā |
| Interrupt Program Ć ā ā ā</p> |
| <p>Architecture Support:</p> |
| <blockquote> |
| <div><p>arm ā ā ā ā |
| arm64 ā ā ā |
| riscv ā ā |
| X86_X64 ā ā |
| xtensa ā ā |
| sim ā ā</p> |
| </div></blockquote> |
| <section id="usage"> |
| <h3>Usage<a class="headerlink" href="#usage" title="Permalink to this heading">ļ</a></h3> |
| </section> |
| </section> |
| <section id="app-usage"> |
| <h2>App-Usage<a class="headerlink" href="#app-usage" title="Permalink to this heading">ļ</a></h2> |
| <p>Usage:</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>gcov [-d path] [-t strip] [-r] [-h] |
| </pre></div> |
| </div> |
| <p>Where:</p> |
| <blockquote> |
| <div><p>-d dump the coverage, path is the path to the coverage file, the default output is to stdout |
| -t strip the path prefix number |
| -r reset the coverage |
| -h show this text and exits.</p> |
| </div></blockquote> |
| </section> |
| <section id="examples-of-applicable-platforms"> |
| <h2>Examples of applicable platforms<a class="headerlink" href="#examples-of-applicable-platforms" title="Permalink to this heading">ļ</a></h2> |
| <ol class="arabic simple"> |
| <li><p>SIM platform usage</p></li> |
| </ol> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p>Please enable the following config</p></li> |
| </ol> |
| <blockquote> |
| <div><p># Support instrumentation of all codes in sim |
| 1. CONFIG_COVERAGE_TOOLCHAIN=y</p> |
| <p># Enable instrumentation |
| 2. CONFIG_COVERAGE_ALL=y</p> |
| <p># Enable gcov app |
| 3. CONFIG_SYSTEM_GCOV=y</p> |
| </div></blockquote> |
| <ol class="arabic simple" start="2"> |
| <li><p>Compile and run |
| <code class="docutils literal notranslate"><span class="pre">`</span> |
| <span class="pre">$</span> <span class="pre">After</span> <span class="pre">the</span> <span class="pre">code</span> <span class="pre">is</span> <span class="pre">compiled,</span> <span class="pre">a</span> <span class="pre">*.gcno</span> <span class="pre">file</span> <span class="pre">with</span> <span class="pre">the</span> <span class="pre">same</span> <span class="pre">name</span> <span class="pre">will</span> <span class="pre">be</span> <span class="pre">generated</span> <span class="pre">next</span> <span class="pre">to</span> <span class="pre">the</span> <span class="pre">*.o</span> <span class="pre">file.</span> |
| <span class="pre">$</span> <span class="pre">After</span> <span class="pre">the</span> <span class="pre">compilation</span> <span class="pre">is</span> <span class="pre">completed,</span> <span class="pre">run</span> <span class="pre">the</span> <span class="pre">code</span> <span class="pre">to</span> <span class="pre">be</span> <span class="pre">tested,</span> <span class="pre">and</span> <span class="pre">exit</span> <span class="pre">the</span> <span class="pre">sim</span> <span class="pre">after</span> <span class="pre">the</span> <span class="pre">execution</span> <span class="pre">is</span> <span class="pre">completed</span> |
| <span class="pre">`</span></code></p></li> |
| <li><p>Run the gcov app |
| <code class="docutils literal notranslate"><span class="pre">`</span> |
| <span class="pre">$</span> <span class="pre">gcov</span> <span class="pre">-d</span> <span class="pre">path_to_gcno_file</span> |
| <span class="pre">`</span></code></p></li> |
| <li><p>Check whether the generation is successful |
| <code class="docutils literal notranslate"><span class="pre">`</span> |
| <span class="pre">Execute</span> <span class="pre">the</span> <span class="pre">following</span> <span class="pre">command</span> <span class="pre">in</span> <span class="pre">the</span> <span class="pre">project</span> <span class="pre">root</span> <span class="pre">directory</span> <span class="pre">to</span> <span class="pre">check</span> <span class="pre">whether</span> <span class="pre">there</span> <span class="pre">is</span> <span class="pre">a</span> <span class="pre">gcda</span> <span class="pre">file</span> <span class="pre">generated</span> <span class="pre">(code</span> <span class="pre">coverage</span> <span class="pre">data)</span> |
| <span class="pre">find</span> <span class="pre">./</span> <span class="pre">-name</span> <span class="pre">"*.gcno"</span> |
| <span class="pre">find</span> <span class="pre">./</span> <span class="pre">-name</span> <span class="pre">"*.gcda"</span> |
| <span class="pre">`</span></code></p></li> |
| </ol> |
| </div></blockquote> |
| <ol class="arabic simple" start="2"> |
| <li><p>Applicable to device</p></li> |
| </ol> |
| <blockquote> |
| <div><p>Due to differences in implementation methods, the device side is divided into GCC and CLANG</p> |
| <ol class="arabic simple"> |
| <li><p>GCC</p></li> |
| </ol> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p>Please enable the following config</p></li> |
| </ol> |
| <blockquote> |
| <div><p># Recommended to use nuttx mini version |
| CONFIG_COVERAGE_MINI=y</p> |
| <p># Enable gcov app |
| CONFIG_SYSTEM_GCOV=y</p> |
| <p># Please add different compilation options in makefile according to the compiler |
| CFLAGS += -fprofile-arcs -ftest-coverage -fno-inline</p> |
| </div></blockquote> |
| <ol class="arabic simple" start="2"> |
| <li><p>Run the gcov app |
| <code class="docutils literal notranslate"><span class="pre">`</span> |
| <span class="pre">$</span> <span class="pre">gcov</span> <span class="pre">-d</span> <span class="pre">path_to_gcno_file</span> |
| <span class="pre">`</span></code></p></li> |
| <li><p>Export data</p></li> |
| </ol> |
| <blockquote> |
| <div><p>After running the code on the device, |
| execute the gcov -d /tmp/gcov command in the nuttx command line |
| to save the generated data to the file system. |
| You need to use your method to export the file to the host</p> |
| </div></blockquote> |
| <ol class="arabic simple" start="4"> |
| <li><p>Generate Report</p></li> |
| </ol> |
| <blockquote> |
| <div><ol class="arabic simple"> |
| <li><p>Install the tool</p></li> |
| </ol> |
| <blockquote> |
| <div><p>sudo apt install lcov</p> |
| </div></blockquote> |
| <ol class="arabic simple" start="2"> |
| <li><p>Generate report</p></li> |
| </ol> |
| <blockquote> |
| <div><p>Run the following command to generate coverage report</p> |
| <p># By default, it is generated in the root directory of the vela project. Add parameters to specify the report generation location |
| # The -t parameter specifies the gcov version, which needs to match the gcc version</p> |
| <p># sim |
| ./tools/gcov.sh -t gcov-13</p> |
| <p># arm platform |
| ./tools/gcov.sh -t arm-none-eabi-gcov</p> |
| </div></blockquote> |
| </div></blockquote> |
| <ol class="arabic simple" start="5"> |
| <li><p>Impact and precautions |
| <code class="docutils literal notranslate"><span class="pre">`</span> |
| <span class="pre">1.</span> <span class="pre">Before</span> <span class="pre">using</span> <span class="pre">the</span> <span class="pre">.tools/gcov.sh</span> <span class="pre">tool,</span> <span class="pre">you</span> <span class="pre">need</span> <span class="pre">to</span> <span class="pre">ensure</span> <span class="pre">that</span> <span class="pre">*.gcno</span> <span class="pre">and</span> <span class="pre">*.gcda</span> <span class="pre">files</span> <span class="pre">exist</span> |
| <span class="pre">2.</span> <span class="pre">If</span> <span class="pre">*.gcno</span> <span class="pre">does</span> <span class="pre">not</span> <span class="pre">exist,</span> <span class="pre">recompile</span> <span class="pre">the</span> <span class="pre">code</span> <span class="pre">after</span> <span class="pre">distclean.</span> |
| <span class="pre">3.</span> <span class="pre">If</span> <span class="pre">*.gcda</span> <span class="pre">does</span> <span class="pre">not</span> <span class="pre">exist,</span> <span class="pre">please</span> <span class="pre">check</span> <span class="pre">and</span> <span class="pre">use</span> <span class="pre">poweroff</span> <span class="pre">to</span> <span class="pre">exit</span> <span class="pre">Vela</span> <span class="pre">normally</span> |
| <span class="pre">`</span></code></p></li> |
| </ol> |
| </div></blockquote> |
| <ol class="arabic simple" start="2"> |
| <li><p>CLANG</p></li> |
| </ol> |
| <blockquote> |
| <div><p># There is a ready-made defconfig in NXboards/arm/mps/mps3-an547/configs/gcov |
| # which can be used for reference</p> |
| <ol class="arabic simple"> |
| <li><p>Please enable the following config</p></li> |
| </ol> |
| <blockquote> |
| <div><p># Recommended to use nuttx mini version |
| CONFIG_COVERAGE_MINI=y</p> |
| <p># Enable gcov app |
| CONFIG_SYSTEM_GCOV=y</p> |
| <p># Please add different compilation options in makefile according to the compiler |
| CFLAGS += -fprofile-instr-generate -fcoverage-mapping</p> |
| </div></blockquote> |
| <ol class="arabic simple" start="2"> |
| <li><p>Modify the linker script</p></li> |
| </ol> |
| <blockquote> |
| <div><p>Please find the corresponding storage location in the link |
| script for the following dataļ¼</p> |
| <p>For detailed examples, please refer to boards/arm/mps/mps3-an547/scripts/flash.ld</p> |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>__llvm_prf_names : { |
| __start__llvm_prf_names = .; |
| KEEP (*(__llvm_prf_names)) |
| __end__llvm_prf_names = .; |
| } |
| |
| __llvm_prf_data : { |
| __start__llvm_prf_data = .; |
| KEEP (*(__llvm_prf_data)) |
| __end__llvm_prf_data = .; |
| } |
| |
| __llvm_prf_vnds : { |
| __start__llvm_prf_vnds = .; |
| KEEP (*(__llvm_prf_vnds)) |
| __end__llvm_prf_vnds = .; |
| } |
| |
| __llvm_prf_cnts : { |
| __start__llvm_prf_cnts = .; |
| KEEP (*(__llvm_prf_cnts)) |
| __end__llvm_prf_cnts = .; |
| } |
| </pre></div> |
| </div> |
| </div></blockquote> |
| <ol class="arabic simple" start="3"> |
| <li><p>Run the gcov app</p></li> |
| </ol> |
| <blockquote> |
| <div><p><code class="docutils literal notranslate"><span class="pre">`</span> |
| <span class="pre">$</span> <span class="pre">gcov</span> <span class="pre">-d</span> <span class="pre">path_to_gcno_file</span> |
| <span class="pre">`</span></code></p> |
| </div></blockquote> |
| <ol class="arabic simple" start="4"> |
| <li><p>Export data</p></li> |
| <li><p>Generate Report</p></li> |
| </ol> |
| <blockquote> |
| <div><p>Please execute the following command, where</p> |
| <ol class="arabic simple"> |
| <li><p>xxxfile: the file for exporting data on the device</p></li> |
| <li><p>xxxelf: the ELF file corresponding to the device</p></li> |
| </ol> |
| <p># Convert the exported coverage data file |
| llvm-profdata merge -sparse xxxfile -o result.profdata</p> |
| <p># Generate a visualization html file |
| llvm-cov show -format=html xxxelf -instr-profile=result.profdata -output-dir=./coverage/html</p> |
| </div></blockquote> |
| </div></blockquote> |
| </div></blockquote> |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="../flash_eraseall/index.html" class="btn btn-neutral float-left" title="flash_eraseall FLASH Erase-all Command" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="../gdbstub/index.html" class="btn btn-neutral float-right" title="gdbstub GDBSTUB" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2023, The Apache Software Foundation.</p> |
| </div> |
| |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |