This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 7ba8542314b55b7885d1d34891a87779338c2f62 Author: wangmingrong1 <[email protected]> AuthorDate: Wed Nov 18 10:49:53 2026 +0800 Documentation: gcov: update tools/gcov.py usage for the new CLI The script now detects the toolchain and target architecture from the ELF passed with -e, so -t is gone and -e is required. Update the examples that still used "-t gcov" / "-t arm-none-eabi-gcov", which now fail with "the following arguments are required: -e/--elf", and replace the manual llvm-profdata/llvm-cov recipe for clang with the unified invocation. Also drop the duplicated "Applicable to device" heading and the stale tools/gcov.sh reference in the same section. Signed-off-by: wangmingrong1 <[email protected]> --- Documentation/applications/system/gcov/index.rst | 41 +++++++++++++----------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/Documentation/applications/system/gcov/index.rst b/Documentation/applications/system/gcov/index.rst index 62ab2eb23b8..d4f74b313f0 100644 --- a/Documentation/applications/system/gcov/index.rst +++ b/Documentation/applications/system/gcov/index.rst @@ -90,11 +90,12 @@ Examples of applicable platforms ``` $ ./tools/configure.sh sim:nsh nsh: poweroff - $ ./nuttx/tools/gcov.py -t gcov - Then open ./gcov/result/index.html with your browser + $ ./tools/gcov.py -e nuttx -s . + Then open the report link printed by the tool + (file://<abs path>/gcov/report/index.html) with your browser ``` -2. Applicable to device + ``-a`` defaults to the current directory and ``-o`` to ``gcov``. 2. Applicable to device @@ -135,18 +136,20 @@ Examples of applicable platforms Run the following command to generate coverage report - # 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 + # The toolchain (gcc or clang) and the target architecture are + # detected from the ELF passed with -e, so the same command works + # on sim and on cross targets. -s is the directory holding the + # \*.gcno files (the build directory), -a the exported data. - # sim - ./tools/gcov.py -t gcov + # sim / arm / other targets + ./tools/gcov.py -e nuttx -s . -a path_to_exported_data - # arm platform - ./tools/gcov.py -t arm-none-eabi-gcov + # If the sources were built in another tree, map the recorded + # paths, e.g. -b /build/root=/home/me/nuttx 5. Impact and precautions ``` - 1. Before using the .tools/gcov.sh tool, you need to ensure that *.gcno and *.gcda files exist + 1. Before using the tools/gcov.py tool, you need to ensure that *.gcno and *.gcda files exist 2. If *.gcno does not exist, recompile the code after distclean. 3. If *.gcda does not exist, please check and use poweroff to exit Vela normally ``` @@ -211,13 +214,15 @@ Examples of applicable platforms 5. Generate Report - Please execute the following command, where - - 1. xxxfile: the file for exporting data on the device - 2. xxxelf: the ELF file corresponding to the device + The same command as for GCC produces the report: the ELF given with + -e tells gcov.py that the data is clang source-based coverage, the + exported \*.profraw files are passed with -a, and llvm-profdata and + llvm-cov are driven automatically. - # Convert the exported coverage data file - llvm-profdata merge -sparse xxxfile -o result.profdata + ``` + $ ./tools/gcov.py -e nuttx -a path_to_exported_data + ``` - # Generate a visualization html file - llvm-cov show -format=html xxxelf -instr-profile=result.profdata -output-dir=./coverage/html + Pass ``--llvm-html`` to render with ``llvm-cov show`` instead of + genhtml, which keeps region-level highlighting at the cost of a + report that differs from the GCC one.
